LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
LinkBack Search this Thread
Old 07-24-2008, 08:13 AM   #1
OdieQ
Member
 
Registered: Jan 2004
Location: Stockholm, Sweden
Distribution: Debian, Slackware
Posts: 71

Rep: Reputation: 15
SOLVED: Can't send data on serial port (recieving works)


I am trying to communicate with my GPS reciever (a Magellan SporTrak handheld) via the serial port. If I turn on the continuous reporting on the unit, I can read its output using either minicom or simply cat /dev/ttyS0.

However, I can't seem to send any commands to it. I get no error messages, just nothing happens. I get the exact same results on two different computers, running either Debian, Slackware, Ubuntu, DSL, or FreeBSD. On one of the computers, I managed to get Windows running and it works without a hitch there (except that I had a hard time finding a functioning terminal app), so I know the hardware is ok.

I have been using the serial port before on Linux (although it's been a couple of years now), and have no recollection of there being any special tricks involved. What can I be doing wrong?

--
uname -a
Code:
Linux godzilla 2.6.25-2-486 #1 Fri Jul 18 17:03:35 UTC 2008 i686 GNU/Linux
stty -F /dev/ttyS0 -a
Code:
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; 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 = 0;
-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

Last edited by OdieQ; 07-25-2008 at 10:05 AM. Reason: problem solved
 
Old 07-25-2008, 01:14 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 57
Are you confirmed, and are you sending the correct end of line chars ?
 
Old 07-25-2008, 05:19 AM   #3
OdieQ
Member
 
Registered: Jan 2004
Location: Stockholm, Sweden
Distribution: Debian, Slackware
Posts: 71

Original Poster
Rep: Reputation: 15
Yes, the sent data is correct. I have constructed text files with the proper NMEA sentences including \r\n eols. I used the same text files on the Windows machine, so I know they are correct as well.

What do you mean by confirmed?
 
Old 07-25-2008, 06:30 AM   #4
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 49
You have output character substitution on - do you really want that? You can turn it off by requesting 'raw' mode:
stty -F /dev/ttyS0 raw

You can also send code (if it's not too long and inconvenient) via 'echo':
echo -e -n 'blah\n' > /dev/ttyS0

The only other thing I can think of is check the manual for peculiarities of the device; the 'send' and 'receive' rates need not be the same and some devices are peculiar - asking for an 'auto' report for example may send NMEA messages at 4800bps (maximum rate required to meet NMEA specs) while the input side of things runs at another speed. You might also need a slightly different config string when the device is spitting out automatic reports.
 
Old 07-25-2008, 09:43 AM   #5
OdieQ
Member
 
Registered: Jan 2004
Location: Stockholm, Sweden
Distribution: Debian, Slackware
Posts: 71

Original Poster
Rep: Reputation: 15
Thank you, pinniped!

The stty raw option did the trick, it works beautifully now. As I suspected, it was just some simple oversight on my part.

Thanks everyone!

Last edited by OdieQ; 07-25-2008 at 10:04 AM. Reason: I have now verified the results
 
Old 07-25-2008, 02:39 PM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 57
Darn, pinniped beat me to it. I'd have to get up pretty early.
 
Old 07-25-2008, 02:48 PM   #7
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 954

Rep: Reputation: 34
not as bad as my experiances with serial communication to GPS devises,
ive had to link RTS to CTS in the past as the GPS device diddnt do hardware flow control
 
Old 07-26-2008, 04:38 AM   #8
OdieQ
Member
 
Registered: Jan 2004
Location: Stockholm, Sweden
Distribution: Debian, Slackware
Posts: 71

Original Poster
Rep: Reputation: 15
Well, many GPS devices use NMEA-0183, which is not the same as EIA-232. It uses the same (or nearly so) over-the-wire protocol, but only has ground (typically the ships pseudo-ground, ie the minus pole of the battery), and data wires (each unit is either a listener or a talker).

My particular unit (as most hand-helds) is intended for communication with a PC, so has a more complete EIA-232 support, including speeds up to 19k2 baud, which is nice.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send byte from serial port neutron001 Linux - Software 9 03-31-2008 05:48 PM
How To Send Data To A Port On An IP? aaron4katie Programming 4 01-16-2007 03:58 AM
Send an .hex file by serial port ODSunal Programming 2 12-09-2004 08:12 PM
reading data from a serial port mchitrakar Linux - Networking 3 12-04-2004 01:24 PM
accessing data from serial port PrerakParikh Linux - Hardware 2 08-24-2004 10:17 PM


All times are GMT -5. The time now is 04:18 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration