Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone!

I'm working on a programme which uses the GPS data of my LG LN550 PNA.
I'm programming in VS2005 C++, and I've written my own serial handling functions, they work great,I've tested them.
But there's some problem. I can read about 1.7 kbytes of data from the serial port, looks like:

$GPRMC,223231.000,A,4708.0453,N,01926.0728,E,0.13,6.56,180710,,,A*6D

$GPGSA,A,2,11,03,19,,,,,,,,,,5.1,5.0,1.0*38

$GPRMC,223232.000,A,4708.0456,N,01926.0721,E,0.60,21.11,180710,,,A*50

$GPGSA,A,2,11,03,19,,,,,,,,,,5.1,5.0,1.0*38

$GPRMC,223233.000,A,4708.0461,N,01926.0715,E,0.00,,180710,,,A*79

$GPGGA,223234.000,4708.0461,N,01926.0715,E,1,03,5.0,44.0,M,40.7,M,,0000*68

That's good. I'm happy. BUT! After a few seconds, I receive:

GRC232.0,,7807,,12.71E00,101,,*9
GGAA21,91,,,,,3534103
$PM,23500A40.37N09602,,.0,870,A7
$PG,2360040.37N09602,,,3344.,,07M,006
$PS,,,11,6,,,,,.,.,.*C
GGV311,96,9,20,611,46,6,2,007*0
GGV321,65,6,1,712,82,5,71,1233*9
GGV331,20,1,82,608,60,9,92,534*E
GRC232.0,,7807,,12.71E00,101,,*B



You see, the NMEA sentences are totally mixed. If I close, and then open the port, it works for a few more seconds, but then it fails again. Closing and then opening the port all the time is not so good for me, because I need the GPRMC data in every second.
Any ideas?
Could anyone help me out of this problem?
Thank you very much!

Regards,
matu91
Posted
Comments
Richard MacCutchan 20-Jul-10 9:02am    
Closing and opening the port suggests it is resetting something in your code. Check your code a little more closely to see how you are dealing with the characters as they arrive.

1 solution

I've written my own serial handling functions, they work great,I've tested them.

Hmm, they don't seem to work that well :)

You need a listener thread filling some buffer with the incoming characters and signalling the main thread when a full sentence is ready.
The main thread should then read the sentence and restart or wake up the listener.

cheers,
AR
 
Share this answer
 
Comments
matu91 9-Aug-10 12:00pm    
Actually, I've tested them on PC. I write my programme both for PC and PNA, and when the PC version works, I write the PNA version, too.
Thanks for your answer, but it didn't help me. The results that I've copied here were made by my test programme, which writes the received characters immediately into a text file. So something else can be the problem. Maybe SirfStarIII internal buffer problem, or what? I have absolutely no idea what can be the problem. iGo works, my prog doesn't. :)
Alain Rist 10-Aug-10 2:09am    
Unfortunately the IO routines are handled differently by WinCE and Windows. Check your device SDK IO support (it's not a Windows Mobile device and should have a matching SDK).
On a WinMobile 5 smartphone, I got that working with a reader thread reading 1 char at time until '$' signalling then a listener thread which would store the sentence post a message to the app main window, reset the read buffer and restart the reader thread. Worked OK for hours or days.
cheers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900