Communication consistency error

Forum Home Forums Runtime Bugs Communicator Bugs Communication consistency error

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1926


    I have a Modbus server running on a Raspberry Pi that communicates with a Modbus client on a desktop computer. Everything is working fine but I have a consistency problem. There is a repeated communication error [1] [2] when communicating with the server that ultimately nulls the current device data [3] in the device data section in the communicator.

    I need to optimize my system so I would really appreciate it if you advise me on how to deal with this bug. I’m posting some screenshots as well to give you insight of what I mean.




    The communication log “says” that RPi drops the connection. Do you develop the Modbus server by yourself or use 3rd party software? Is there any logs of the Modbus server?


    No I developed it by myself using the pymodbus library on the RPi. Unfortunately there are no logs for the Modbus server as I only run a Python code prompting it to act as a server. I can post to you the main loop though where I suspect the problem of communication lies since the values are never actually nullified in the server’s registers.

    from pymodbus.server.async import StartTcpServer
    from pymodbus.device import ModbusDeviceIdentification
    from pymodbus.datastore import ModbusSequentialDataBlock
    from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
    from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer
    from twisted.internet.task import LoopingCall

    def main()
    global pi

    # main loop
    while True:
    store = ModbusSlaveContext(
    di = ModbusSequentialDataBlock(0, [0]*100),
    co = ModbusSequentialDataBlock(0, [0]*100),
    hr = ModbusSequentialDataBlock(0, [0]*100),
    ir = ModbusSequentialDataBlock(0, [0]*100))
    context = ModbusServerContext(slaves=store, single=True)

    identity = ModbusDeviceIdentification()
    identity.VendorName = ‘pymodbus’
    identity.ProductCode = ‘PM’
    identity.VendorUrl = ‘’
    identity.ProductName = ‘pymodbus Server’
    identity.ModelName = ‘pymodbus Server’
    identity.MajorMinorRevision = ‘1.0’

    delaytime = AtlasI2C.long_timeout
    pi = Temp()
    time = 5 # 5 seconds delaytime = 5 # 5 seconds delay
    writer = LoopingCall(read_context,a=(context,))
    loop = LoopingCall(f=updating_writer, a=(context,))
    loop.start(8) # initially delay by time

    StartTcpServer(context, identity=identity, address=(“”, 5022))

    except KeyboardInterrupt:

    if __name__ == ‘__main__’:


    To find a cause, debug and log needed. The source code is not enough.

    There is a new possibility recently developed: you can install Rapid SCADA on your RPi and pass data from RPi to PC using Rapid SCADA internal protocol. This functionality is implemented by Rapid Gate module. You can download it by this link. In case of follow up questions, be free to ask.

    Send me a letter to receive a trial key for Rapid Gate.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.