Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Modbus, update, timeout and retries


  • My Modbus serial to have the following configuration:
    57600 bps
    8 data bits
    Even parity
    1 stop bit
    rtu
    Slave 1 has the following parameters:
    10 input register
    5 holding register
    2 coil status
    1 input status
    polling the network as follows:
    update = 1s = 500ms timeout retries = 2
    So this works fine, and get updated readings in 1 second, then i created the slave 2 with only 1 holding register, but do not have the slave 2 connected to network. I observed that the rate of reading (new value) in the first slave increased to 4 seconds on average.
    I considered the following hypothesis: as no slave 2 connected on the network takes poolling:
    retries (2) * timeout (500ms) = 1 second, so would expect a value slightly greater than 1 second, but I get 4 seconds.
    Decreases update for 100ms and after several attempts, tests via Modbus read date, could decrease the timeout to 300ms, again for the first slave everything works fine, but when the active slave 2 (the one holding register), the rate of slave 1 increases for 4 seconds.
    I consider polling the network equal to the number of slaves by update (all connected slaves and enabled)?
    My hypothesis is correct? Why the discrepancy when a slave does not respond?
    My goal is to poll the network complete in 1 second, if any slave network for some reason loses connection to scan rate goes to 4 seconds degrading much time to scan desired. Any idea to work around that?

    I appreciate any help.


  • In my own tests the timeout and retries always work as expected. Note though that the number of poll attempts is (retries + 1). I.e. if you set retries to 0, at least one attempt will always be made. So, if a slave is offline the amount of time it will take for a poll attempt to complete will be (timeout + latency) * (retries + 1).

    I don't know where the 4 seconds is coming from. If you have more than one slave offline, is the delay still just 4s, or 4s per offline slave? Perhaps there is some strange latency in the raising of the exception?

    If you want to get 1s polling going on with minimal failure latency, i'd say set your timeout to as low as it can practically be, and set retries to zero.


  • New adjust:
    Update period = 50ms
    Timeout (ms) = 100ms
    retries 2
    test with Modbus read data: No response from slave 1
    Enable Data Source and Data Points with 1 slave and work fine.
    Enable Data Source and Data Points with 2 or 3 slaves and i get the follow message:
    'Data Source': com.serotonin.modbus4j.exception.ModbusTransportException: com.serotonin.messaging.TimeoutException: request=com.serotonin.modbus4j.serial.rtu.RtuMessageRequest@42ea05a3
    get updated readings in 2 second
    changing retries = 0
    sometimes with any munber of slave , when i set some data point, the message triggers again.
    get updated readings in 1 second
    In the slave, all routines are executed in 20ms.