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<CR>. 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<CR> 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<CR>) 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?

  • you can try simpier alternatives to minicom echo -en "#0108.467\r" > /dev/ttySX" (and try with voltmetar) or socat - /dev/ttySX,cr, and typing command... then playing with socat params cr/crnl/baud... – Asain Kujovic Sep 12 at 15:29
  • Thank you, both commands worked like a charm. And they also can run over a ssh connection, minicom has problem with that. That leaves me puzzled, as I thought that minicom was the best software for serial communication. – Giorgio R Sep 12 at 15:56
up vote 1 down vote accepted

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.