Unable to read correct register from pymodbusrtu server using controller (in my case TEMCO)

84 views Asked by At

I have created a modbusrtu server using pymodbus library on Pi4.I am writing values on the context using the function

def write_data(context,address, value, slave_id_reader,reg_type):
        context = context
        print(" Adddress =",address,", value =",value,", slave_id :",slave_id_reader," ,reg_type ",reg_type)
        # while True:
        context[slave_id_reader].setValues(reg_type, address, value)

when i read from the Qmodmaster software on Windows, I am receieving correct values(see attached picture). But as soon as i use another pi or controller(TEMCO) . It fails to receive correct values .Using another pi which is connected through modbusrtu protocol , i have used client code, But some times it reads the value and sometime it fails and timeout occurs.When reading through the TEMCO thrugh rs485 or any controller. the values appear sometimes which are mostly wrong and most of the time there are no values.I have checked the server settings on all of them

                        timeout=1, 
                        baudrate=9600, 
                        parity='N',
                        bytesize=8,
                        stopbits=1)

These settings are same in the controller and pi

I have tried increaasing and decreasing delay in reading the register but nothing worked.

I have created a modbus rtu server using pymodbus library on python. I am writing register from the server. Secondly, on another pi I have made a client using pymodbus library which is reading from the server.Both pi are connected serially.

These are logs printed on the Client's end. There is a frequent disconnection between the Client and the server. Sometimes it reads and sometimes it doesn't

ReadRegisterResponse (65)
ReadRegisterResponse (65)
Modbus Error: [Input/Output] Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received)
ReadRegisterResponse (65)
ReadRegisterResponse (65)
ReadRegisterResponse (65)
Modbus Error: [Input/Output] Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received)
ReadRegisterResponse (65)
ReadRegisterResponse (65)
0

There are 0 answers