minicom works, but stty does not

Hi all,

I have some trouble getting stty to talk to some serial/usb converter.
Getting minicom to work was however quite simple after I entered the following settings in addition to its standard-setup:

pu port             /dev/ttyUSB0
pu baudrate         19200
pu bits             8
pu parity           N
pu stopbits         1
pu rtscts           No 

I tried to reproduce these settings for stty:

stty 19200 cs8 -raw -parenb -cstopb crtscts -echo -F /dev/ttyUSB0 

But this does not seem to work. Because

echo "my_serial_command" /dev/ttyUSB0

does not produce any output to

cat < /dev/ttyUSB0

.

I would appreciate if anybody of you would be willing to look in the full settings of stty in order to tell me if there's maybe some other flag or option set wrong:

speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^H; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;
-parenb -parodd cs8 -hupcl -cstopb cread clocal crtscts
ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

Thanks in advance for your help,
Pa-trick.

echo "my_serial_command" /dev/ttyUSB0

That doesn't do what you think it does.

Try

echo "my_serial_command" > /dev/ttyUSB0

It'd also be good to know what device you're talking to. A modem? A cell phone? A motor controller?

Another thing you can do is run stty on the serial port while minicom is running in order to get its exact serial settings.

Thanks Corona688 for pointing me to the echo command. Indeed there was something wrong in the command. However, in addition to your hint I had to add the options -e (enable interpretation of backslash escapes) and -n (do not output the trailing newline) to the echo command and a forced carriage return \r after the command:

echo -en "my_command\r" > /dev/ttyUSB0

Using

cat < /dev/ttyUSB0 > output.dat

now outputs the messages returned from ttyUSB0 into the file output.dat.

Concerning your question which device I use: It's an RS485-to-USB converter that is connected to an optical particle counter. The serial communication needs to be done for instrument configuration and data transfer.

stty is supposed to handle that for you. There's an stty option to translate lf's into cr's, onlret.