I try to follow exactly this video https://www.youtube.com/watch?v=ZlHqEOmvW6M

You can have a look what I do : https://drive.google.com/file/d/1LenDiJVxT8wQUOlMbdDZ_VkIzqLvHmLJ/view?usp=sharing

I will describe what I do :

I use modbus slave simulator in desktop as modbus slave, I use raspberry pi 3 as a master. We communicate between it .I use rasberry pi 3 to show register in modbus slave simulator ( modbus slave register that we will let it a number)

enter image description here I use 2 usb to rs 485, 1 dongle in my laptop, 1 dongle in rasberry pi3. I use eclipse ide for code.

I also try the another usb to rs 485 is usb to rs 485 v2. I also try another modbus slave simulator. All two methods, slave still no response@@.

My code :

from pymodbus.client.sync import ModbusSerialClient as ModbusClient 
from pymodbus.register_read_message import ReadInputRegistersResponse  
client = ModbusClient(method='rtu', port='/dev/ttyUSB0',stopbits=1, bytesize=8, parity='N',baurdrate='9600', timeout=0.3)  
connection = client.connect() 
value = client.read_input_registers(300, 4, unit=0x00) 

Result in :


Traceback (most recent call last):

    File "main.py", line 19, in <module>


Attribute: 'ModbusIOException' object has no attribute 'registers'

My laptop and rasberry show that 2 usb are received. I think there is no problem with code, with simulator, rasberry pi. I think the problem is link between 2 usb, and I try to link it by wire but it cant help. Do anybody have a solution (like use another kind of adapter)?

  • As I understand the error message, the value of value seems to be a ModbusIOException. Maybe you should check what object type the return value actually is. (I didn't find any details in the documentation what "A deferred response handle" is, so I don't know what types are possible for the returned value.) You might get more information about the cause of the exception by printing value before trying to print value.registers.
    – Bodo
    Jun 27, 2022 at 9:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.