RS485 Adapter Woes

Sorry, I posted this in another forum and could not figure out how to move it here. I will try to delete the other post. This area seems more appropriate for this issue.

Hello,
I am trying to connect to a Modbus/RTU device from a ConnectPort X4 via a digi RS485 adapter and having a problem where I get a timeout.

I connected to the CX4 via telnet and ran a trace:

1069206:ia:DEBG:MBRTU: Estimated Req length is 8
1069207:ia:INFO:mbrtu:p00 recv req 2
1069207:ia:DEBG: 01 03 0F 3C 00 0A 06 D5
1069207:ia:DEBG:rte[0]: return[2]
1069209:ia:INFO:mbrtu:p01 send req 2
1069210:ia:DEBG: 01 03 0F 3C 00 0A 06 D5
1069210:ia:WARN:mbrtu:p01 disconnect event
1069210:ia:DEBG:mbrtu:p01 Zigbee slave connect 00:13:a2:00:40:4b:fc:00!
1069210:ia:WARN:Failed to bind Zigbee socket (endpoint=232)
1069211:ia:WARN:Failed to register Zigbee interface
1071708:ia:WARN:mbrtu:p00 message timeout error

It looks like the Cx4 is having trouble connecting to the XBee in the Rs485 Adapter.

Here are the settings:

Gateway X4 - XBee version 2164 (Coordinator API)
PANID = 0x000000000000000c
ZS = 0

RS-485 Adapter XBee version 2264 (Router AT)
PANID = 0x000000000000000c
D6 = 0
D7 = 7
RO = 3
SM = 0
ZS = 0

Industrial Automation Settings

Source

Protocol Modbus/RTU
Transport TCP
Port 502
Message timeout 2500
Character timeout 50

Destination
Type: Send message to XBEE
Extended Address 00:13:a2:00:40:4b:fc:00! (matches XBee Network discovery reading)
Protocol Modbus/RTU
Response timeout 2500
Character timeout 20

Does anybody have any idea why the two are not talking?

Have you looked through these pages?
http://www.digi.com/wiki/developer/index.php/Category:Modbus

For one thing your destination ‘char timeout’ should be at least 500 msec, not the default of 20.

The key to your problem are these two lines:
1069210:ia:WARN:Failed to bind Zigbee socket (endpoint=232)
1069211:ia:WARN:Failed to register Zigbee interface

Do you have some Python code running? The X4’s Modbus bridge and Python cannot both ‘own’ the endpoint 232. Either you use Modbus and do not allow Python to bind on 0xe8 (232), or you allow Python to talk to the serial XBee and avoid using the Modbus bridge.

The good news is that if you DO require Python and Modbus bridge to ‘share’ the serial channel to serial XBee, then you can use a simple UDP socket between the two.
http://www.digi.com/wiki/developer/index.php/Integrating_the_Digi_IA_Modbus_Bridge_to_Python

So your Python can issue Modbus/TCP requests to localhost (127.0.01) and then the Modbus bridge will get you a response … or direct ALL of the Modbus through a UDP socket on localhost (127.0.0.1) and then your Python would own the 232 channel and proxies the Modbus requests.

If that doesn’t make sense - ask more, as I work a lot with Modbus over the XBee mesh.