|
Home > Archive > Unix Programming > January 2006 > Reading data from gps on serial port
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Reading data from gps on serial port
|
|
| James Brodie 2006-01-24, 6:23 pm |
| I have plugged into my linux machine and I want to be able to write a
program to read the data it outputs on /dev/ttyUSB0. The problem I am
having is that the data I see when running 'cat /dev/ttyUSB0' isn't the
standard NMEA data that the GPS should be outputting. I have tested
this with two of these units and both are the same. I was wondering if
there were some settings for the port that would correct this problem.
For a very short while it was functioning correctly with the correct
output but after disconnecting and reconnecting the gps unit, it
stopped functioning correctly again.
Any ideas?
| |
| David Schwartz 2006-01-24, 6:23 pm |
|
"James Brodie" <james.brodie@gmail.com> wrote in message
news:1138147776.512744.82720@f14g2000cwb.googlegroups.com...
>I have plugged into my linux machine and I want to be able to write a
> program to read the data it outputs on /dev/ttyUSB0. The problem I am
> having is that the data I see when running 'cat /dev/ttyUSB0' isn't the
> standard NMEA data that the GPS should be outputting. I have tested
> this with two of these units and both are the same. I was wondering if
> there were some settings for the port that would correct this problem.
>
> For a very short while it was functioning correctly with the correct
> output but after disconnecting and reconnecting the gps unit, it
> stopped functioning correctly again.
>
> Any ideas?
What are you getting?
Two obvious possible problems are:
1) The baud rate is not set correctly.
2) The GPS has NMEA mode and at least one other mode and as in another
mode.
DS
| |
| James Brodie 2006-01-24, 8:56 pm |
| Hi
I get something that somewhat looks like NMEA, but isn't:
$PS,,,,,512.12,000000,0,E*55
GA01100,55,,,,,0000,976
Sometimes after running 'cat /dev/ttyUSB0' I get nothing at all.
The GPS also has a binary mode but I'm sure that it is not in binary
mode. I can change it between NMEA and binary.
What are the commands to check/set the baud rate from the terminal?
| |
| David Schwartz 2006-01-24, 8:56 pm |
|
"James Brodie" <james.brodie@gmail.com> wrote in message
news:1138150745.283112.243580@g44g2000cwa.googlegroups.com...
> Hi
>
> I get something that somewhat looks like NMEA, but isn't:
>
> $PS,,,,,512.12,000000,0,E*55
> GA01100,55,,,,,0000,976
>
>
> Sometimes after running 'cat /dev/ttyUSB0' I get nothing at all.
>
> The GPS also has a binary mode but I'm sure that it is not in binary
> mode. I can change it between NMEA and binary.
> What are the commands to check/set the baud rate from the terminal?
You should be using some kind of actual tool, like 'minicom'. Using
'cat' just isn't going to work for a variety of reasons.
DS
| |
| James Brodie 2006-01-24, 8:56 pm |
| Thanks for your suggestion. I will check that program out.
For interests sake, what are the reasons that 'cat' will not work?
and also, will i be able to read the data in a C program just the same
way that I read a normal serial port?
| |
| David Schwartz 2006-01-24, 8:56 pm |
|
"James Brodie" <james.brodie@gmail.com> wrote in message
news:1138151257.164391.91980@o13g2000cwo.googlegroups.com...
> Thanks for your suggestion. I will check that program out.
>
> For interests sake, what are the reasons that 'cat' will not work?
You can't set the baud rate. You can't send a break to the other side.
You can't flush the port on startup. You can send and receive at the same
time.
> and also, will i be able to read the data in a C program just the same
> way that I read a normal serial port?
You should be able to.
DS
|
|
|
|
|