Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Try 8 bits, no parity, one stop bit, software flow control. This comes from:

"cs8" means 8 data bits. "-crtscts" means no hardware flow control. "ixon" means soft flow control. "-cstop" means one stop bit.

share|improve this answer
    
Thank you, this makes sense. It's still not working though. Might have to check the cables etc. –  Lucas Aug 29 '11 at 16:12
    
Is something listening on that port? Do you have getty or the like running? Otherwise, you're connecting to a port that no process is listening to. –  David Schwartz Aug 29 '11 at 16:33
    
Thanks to your answer, I added my question a bit, but unfortunately it's still not working. Any ideas? –  Lucas Aug 29 '11 at 18:01
    
I would try rebooting and not messing with the device at all. Let getty manage it. You may have confused getty. Also, getting typically expects hardware flow control. –  David Schwartz Aug 29 '11 at 18:20
    
Okay, it turned out to be a wrong connection on our circuit board. But I will mark this as the answer, because it's exactly what I asked. –  Lucas Aug 31 '11 at 23:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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