How to ensure reliable RS-232 connection?

I have a configuration file for a network device(2100 lines). This device is configurable only over console line. If I copy chunks of those lines into terminal(I use minicom), there will be mistakes (sometimes some characters missing, space characters added etc). Hardware flow control and software flow control doesn't help either(as I use RS232-to-USB converter, I'm even not sure, if RTS and CTS signals are implemented). I tried with cu utility, but same issues appeared. There will be mistakes even if I copy in ~100 line parts. What causes those missing/added characters? Is there a terminal emulation program under BSD, which supports pausing before each byte/line transfer? :OOO
 
See if the device supports zmodem or xmodem file transfer.
 
m4rtin said:
I have a configuration file for a network device(2100 lines). This device is configurable only over console line. If I copy chunks of those lines into terminal(I use minicom), there will be mistakes (sometimes some characters missing, space characters added etc). Hardware flow control and software flow control doesn't help either(as I use RS232-to-USB converter, I'm even not sure, if RTS and CTS signals are implemented). I tried with cu utility, but same issues appeared. There will be mistakes even if I copy in ~100 line parts. What causes those missing/added characters?

Baud rate mismatch, parity mismatch, start/stop bits mismatch, unshielded cable, ground wire in cable not connected, cable run near RF interference source. RS232 sucks. Try a different USB-serial adapter if you can. Lower baud rates are more forgiving.

Is there a terminal emulation program under BSD, which supports pausing before each byte/line transfer? :OOO

It would not be hard to do that in a script. But check the parameters listed above first.
 
SirDice said:
See if the device supports zmodem or xmodem file transfer.
unfortunately it doesn't.

wblock said:
Baud rate mismatch, parity mismatch, start/stop bits mismatch, unshielded cable, ground wire in cable not connected, cable run near RF interference source. RS232 sucks. Try a different USB-serial adapter if you can. Lower baud rates are more forgiving.
It would not be hard to do that in a script. But check the parameters listed above first.
Baud-rate, parity and start/stop bits are checked. I tried to keep the serial cable away from other cables, but there are still few errors(about one missing character or unnecessary space character for every 1000 characters). SirDice, I thought about script as well. Something which copies line after a line from a file and sends those lines to TxD. "sleep 1" after each line :) However, minicom is clearly not scriptable. Any suggestions?
 
If this is a network device I'm sure you can (temporarily) activate one of it's interfaces, assign an IP address to it and scp or tftp the configuration file.
 
wblock, aragon,
I tried with three different USB-to-RS232 adapters. Two of those were noname adapters and one was Trendnet TU-S9.

One of those noname adapters and Trendnet one used the same chip(PL-2303HX) and are identified as "Prolific Technology Inc USB-Serial controller". Other noname adapter is identified as "FTDI USB serial converter".

However, at least one of those USB-to-RS232 has ground wire clearly present- in addition to Vcc, D-, D+ and GND cables, there is an additional wire, which is soldered to USB-A connector in one end and to the DE-9 connector in the other end. PL-2303HX based USB-to-RS232 adapters should support hardware flow control as well, because PL-2303HX supports RTS and CTS(PL-2303HX datasheet http://www.stkaiser.de/anleitung/files/PL2303.pdf).

Console cable is ~1m long and I keep it away from other cables in order to avoid electromagnetic interference. Maybe buffers of USB-to-RS232 adapters get filled..or something like this..I mean if I copy line-by-line, I have had never any issues. On the other hand, if I copy chunks of lines, there are constantly some characters missing or few added. All additional ideas/suggestions are most welcome ;)

Isn't there a terminal emulation program under BSD, which supports pausing before each byte/line transfer? Or any hints, how to script something like this? :OOO
 
Thank you for all the answers. Finally I went with the socat solution:

Code:
while read line; do echo $line | socat - /dev/cuau0,raw,echo=0; sleep 2; done < configuration-file.txt

..and it works fine;) As you can see, it pauses for 2s after each command.

Just for out of interest, why do errors(some characters missing, space characters added etc) appear in case of chunks of configuration lines are pasted into terminal? I connected this device directly to my PC's serial port(skipping the RS232-to-USB converter) and still in case I copy even ~100 line chunks, the errors will sometimes appear :OOO
 
Back
Top