Results 1 to 6 of 6
I've been trying to send some data over a serial port on USB
it is correctly detected as ttyUSB0.
The device on the other end wakes up when receives the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-28-2012 #1Just Joined!
- Join Date
- Oct 2012
- Posts
- 9
Serial port initialization
I've been trying to send some data over a serial port on USB
it is correctly detected as ttyUSB0.
The device on the other end wakes up when receives the sequence $$$ without any CR or LF or anything else, so if I do
# screen /dev/ttyUSB0 9600
and then I type $$$ it works!
but if I do
# stty -F /dev/ttyUSB0 9600 -echo
# echo -n "\$\$\$" > /dev/ttyUSB0
it doesn't work! and it's driving me nuts!!
what is funny though is that the stty and echo solution works if minicom or screen is reading the serial port, so there must be some initialization I'm missing
doing stty -F /dev/ttyUSB0 before running screen and while screen is running reveals there are NO differences on condiguration or whatsoever
Thanks a lot for your attention!
- 10-29-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
Hello and welcome!
Does it work if you do the initial screen command first:
then, jump to another terminal and attempt the echo command:Code:screen /dev/ttyUSB0 9600
if it does work, maybe try the -sane arg to stty, sometimes that has helped me jiggle a serial port to life.Code:echo -n "\$\$\$" > /dev/ttyUSB0
- 10-29-2012 #3Just Joined!
- Join Date
- Oct 2012
- Posts
- 9
It does work if screen is issued first (as I explained), so it means screen correctly initializes the port and the settings are the same, if I input stty -F /dev/ttyUSB0 before screen and while screen is running it shows the same info.
sane did not help, but thanks anyway! any more suggestions?
- 10-29-2012 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
I was suggesting that you only initialize the serial device with screen, but actually send the '$$$' to the device with the echo command. Did you try that?
Another thing to try:
before you run the screen command, print all the serial device settings:
then run the screen initialization command.Code:stty -F /dev/ttyUSB0 -a > /tmp/stty.before
then print settings again:
then compare stty.before and stty.after - any differences?Code:stty -F /dev/ttyUSB0 -a > /tmp/stty.after
- 10-29-2012 #5Just Joined!
- Join Date
- Oct 2012
- Posts
- 9
Yes, that's what I meant, I did the screen and then separately, did the echo $$$ on another console, then it works.
- 10-29-2012 #6Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
okay, cool. did u try the before/after settings stuff?


Reply With Quote

