Communication Modbus

Hello, I am having a problem with Modbus connection.

To explain it better, here is my equipment:
-cmmt-fest servo drive
-onion omega2+ : Linux module for connected devices and sensors
i tried to connect to the servo drive from my pc and it works perfectly but with the omega2+ it doesn't even connect
 
Are you trying to communicate Modbus/TCP (Ethernet) or Modbus RTU (RS-485)?

Are you using a Modbus library or have you written your own Modbus code?

If it's Modbus/TCP, make sure that both devices have compatible IP settings (for example, one may be 192.168.1.100 and the other 192.168.1.101, both with subnet masks of 255.255.255.0).

If it's Modbus RTU, the Omega2+ does not support RS-485 natively. Therefore, you must use a TTL to RS-485 module or breadboard an RS-485 transceiver and connect it to the Omega2+'s serial port. You will also need a GPIO pin to control the RS-485 driver enable signal.

You may also want to have a look at the Onion forums, such as this:
https://community.onion.io/topic/1959/modbus-rtu/8
 
i am trying to communicate Modbus/TCP (Ethernet), i am also using a Modbus library and my devices have compatible ip settings(192.168.0.10 and 192.168.0.3)
 
Please provide as much detail and context as possible so that we are able to assist you further.

Which Modbus library are you using? Can you post your code? Can you ping the Modbus servo drive from the Omega2+?

When you got communications working with your PC, were you using the same Modbus library? Is your PC a Linux PC? What are the IP settings of your computer? Can you ping both the Modbus servo drive and Omega2+ from your PC?
 
yes sure !
i am using the pymodbus-2.5.3, the same as used on my pc (windows distribution), and yes i am able to ping my servo drive from the omega2+ .
i can also ping both the servo drive and omega2+ from my pc
here's my code :
Capture d'écran 2024-06-25 144704.png
 
Thank you for the code. Is this the same exact code you're running on your PC successfully?

You said the Omega2+ does not even connect. How have you determined this? Where in your code is it failing? Is an error code returned by one of the ModbusTcpClient functions? If so, what is the error code? Have you tried enabling the logging code that is commented out? Does this provide any additional insight to the issue?
 
I made some modification in IP addresses, i think there was some collisions. thanks a lot for your help.
but i have another question, how can i convert the ReadHoldingRegistersResponse type to integer ?
 
Top