I am trying to communicate between an embedded device which runs linux and a PC which runs windows xp over a RS232 connection. On windows I use Hyperterminal, but I don't know which settings I should use. I have to set
- Bits per second
- Data bits
- Parity
- Stop bits
- Flow control
On the linux device i ran stty
to find out the settings on that side. I do NOT want to change those settings the linux device, but only read them out. But I have a hard time interpreting the output.
~$ stty -F /dev/ttyS0 -a
speed 9600 baud; rows 24; columns 80;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ;
eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iext
Bits per second
will presumably have to be set to 9600, but how do I have to interpret the remaining output from stty?
Edit:
Okay, i did a little more. Looking if getty
is running:
~# ps | grep getty
1557 root 1884 S /sbin/getty 115200 ttyS2
1558 root 1884 S /sbin/getty 38400 tty1
1600 root 2636 S grep getty
I assume this means that I am listening on the device ttyS2
and it also seems to indicate the baudrate as 115200
. Now I ran stty
to see the settings:
~# stty -F /dev/ttyS2 -a
speed 115200 baud; rows 24; columns 80;
intr = ^C; quit = ^\; erase = ^?; kill = ^X; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon
-ixoff -iuclc -ixany -imaxbel
-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
Now trying to use this in Hyperterminal, I would assume the following settings:
- Bits per second: 115200
- Data bits: 8 (because of cs8)
- Parity: None (because of -parenb)
- Stop bits: 1 (because of -cstopb)
- Flow control: none (because of -crtscts and -ixon)
But it's still not working.