Skip to main content

Troubleshooting an RS-485 communication [Resolved]

I have an ND-6021 Analog Input Module. It is an RS-485 device that can set a variable output voltage based on the command it receives. I am trying to make it works under a Linux Debian Stretch. I have been using minicom to see if it works properly, so I issued a read configuration command: $012. The device answers with the message !01320600: ! means it received correctly the command and the rest of the message explains how it is configured. As far as I understand, this means that the connection is set up properly and there are no hardware problems that hinder the communication.

Next step is to set the desired level of output voltage. I have connected to the device a digital voltmeter, so I can see the output voltage. I issue the command: #0108.467 and I should read on the voltmeter a value of 8.467 volts and the device should answer with >, but the voltage stays at 0 and there is no answer from the device.

I have spent hours checking the syntax of the command and it is right, so I did another test. I connected the device to a Windows laptop and using termite I issued the very same commands. The reading configuration command ($012) works and I got the same answer as in Linux, and now also the setting voltage command works: I got the > answer from the device and the output voltage is set properly.

I am confused because my test shows that the communication and the hardware settings are ok, but clearly, there is something that is not working, but what?

Question Credit: Giorgio R
Question Reference
Asked September 13, 2018
Posted Under: Unix Linux
1 Answers

usally it is a baudrate or new-line-interpretation problem. (even if commands partially works)

socat is the great tool for making and troubleshooting network and serial connections.

socat - /dev/ttySX[,params]

if empty params do not working, you can try adding explicit baud rate with param: b9600/b19200/b57600/b115200 ... all list retrieved with socat -?? | grep 'b[1-9]'

then focusing on new-line-interpretation problem, trying combinations of params: cr, crnl, echo=0 and raw

... because some modules insist on cr+lf (\r\n) line ending, some wants just '\n', sometimes back-echoing creates confusion ... and in your case module need carriage return (\r) only, so echo '#0108.467' | socat - /dev/ttySX,cr should work well.

credit: Asain Kujovic
Answered September 13, 2018
Your Answer