f***@free.fr
2010-10-16 11:40:47 UTC
Hello Guys
This may be of interest to this list
I recently used a GPS module as a time and date reference in an embedded project.
As GPS has a Y2K style bug, the week counter rollover, which happens every 1024 weeks (roughly 20 years), i tried the receiver i use with a test generator capable of sending a GPS signal with a random timestamp.
And guess what, my module handles this wrongly, and jumps back to 1999 if a cold boot is done after April 6, 2019
several issues with that :
- the date is invalid, obviously
- UTC time is correct, but a local time calculated on this will sometimes be off +- 1hr, due to wrong DST calculation
- some receivers may not get a position (mine was fixing correctly)
- Finally, gpsd (and other SW probably) interprets the date "99" in GPRMC as 2099, which gives a 32bit overflow in unix time, gpsmon reports an error "negative date" and a date in 1969 (probably a -1 returned from the unix time lib), if i enable the GPZDA frame on the Rx, it reports "correctly" 1999. A 64 bit system will probably report 2099
Some suggestions :
- correcting the GPRMC date detection to 20xx except 1999 for "99" would perhaps be a good thing to do. At least gpsd will be synchron to the GPS info, and no averflow will happen on 32 bit time_t systems. Of course we loose one year before the 2100 bug, but fair enough, that's an order of magnitude away from now than 2019
- trying to compensate the 20 year error can be dangerous coz based on the machine time which can be corrupt also, and, for some applications,will later be based on GPS, etc... but it's feasible if the detection is based on a proper window (ex : machine_utc - gps_utc = n*1024 weeks +- 1 month). The non-trivial part is calculating offsets of exactly n*1024 weeks in UTC in seconds...
- maintaining a list of tested devices and bad guys. Crappy GPS chipsets exist, and will probaqbly still be in production in 2019 (and many systems in use will fail due to crappy design). People need to test devices with test transmitters. I volunteer.
The first device on the non-compliant craplist :
GPS-320FW, from RF solutions http://www.rfsolutions.co.uk
Sold by RS for 42Euro
probably manufactured by unitraq as GP-320FW : http://www.unitraq.com/ (TW)
The chipset is : SE4100L (front end) & PL-6313 (prolific. Yes, these guys that make USB<>RS232 adapter chips with crappy drivers)
doc : http://www.rfsolutions.co.uk/acatalog/DS320-2.pdf
binary protocol : http://www.rfsolutions.co.uk/acatalog/DS-41COM-2.pdf (specific, as usual, someone ever seen one that starts with %% ?)
Don't know who does the firmware. The device sends out "$PLCS,REV,PLN012054S07,070312,145743" at reset., (not documented !!)
some logs (various NMEA settings): http://f4eru.free.fr/gpslog/
http://tycho.usno.navy.mil/gps_week.html
http://www.swaviator.com/html/issueJJ99/WNROandGPS.html
http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm
...
Sto
f4eru at free.fr
This may be of interest to this list
I recently used a GPS module as a time and date reference in an embedded project.
As GPS has a Y2K style bug, the week counter rollover, which happens every 1024 weeks (roughly 20 years), i tried the receiver i use with a test generator capable of sending a GPS signal with a random timestamp.
And guess what, my module handles this wrongly, and jumps back to 1999 if a cold boot is done after April 6, 2019
several issues with that :
- the date is invalid, obviously
- UTC time is correct, but a local time calculated on this will sometimes be off +- 1hr, due to wrong DST calculation
- some receivers may not get a position (mine was fixing correctly)
- Finally, gpsd (and other SW probably) interprets the date "99" in GPRMC as 2099, which gives a 32bit overflow in unix time, gpsmon reports an error "negative date" and a date in 1969 (probably a -1 returned from the unix time lib), if i enable the GPZDA frame on the Rx, it reports "correctly" 1999. A 64 bit system will probably report 2099
Some suggestions :
- correcting the GPRMC date detection to 20xx except 1999 for "99" would perhaps be a good thing to do. At least gpsd will be synchron to the GPS info, and no averflow will happen on 32 bit time_t systems. Of course we loose one year before the 2100 bug, but fair enough, that's an order of magnitude away from now than 2019
- trying to compensate the 20 year error can be dangerous coz based on the machine time which can be corrupt also, and, for some applications,will later be based on GPS, etc... but it's feasible if the detection is based on a proper window (ex : machine_utc - gps_utc = n*1024 weeks +- 1 month). The non-trivial part is calculating offsets of exactly n*1024 weeks in UTC in seconds...
- maintaining a list of tested devices and bad guys. Crappy GPS chipsets exist, and will probaqbly still be in production in 2019 (and many systems in use will fail due to crappy design). People need to test devices with test transmitters. I volunteer.
The first device on the non-compliant craplist :
GPS-320FW, from RF solutions http://www.rfsolutions.co.uk
Sold by RS for 42Euro
probably manufactured by unitraq as GP-320FW : http://www.unitraq.com/ (TW)
The chipset is : SE4100L (front end) & PL-6313 (prolific. Yes, these guys that make USB<>RS232 adapter chips with crappy drivers)
doc : http://www.rfsolutions.co.uk/acatalog/DS320-2.pdf
binary protocol : http://www.rfsolutions.co.uk/acatalog/DS-41COM-2.pdf (specific, as usual, someone ever seen one that starts with %% ?)
Don't know who does the firmware. The device sends out "$PLCS,REV,PLN012054S07,070312,145743" at reset., (not documented !!)
some logs (various NMEA settings): http://f4eru.free.fr/gpslog/
http://tycho.usno.navy.mil/gps_week.html
http://www.swaviator.com/html/issueJJ99/WNROandGPS.html
http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm
...
Sto
f4eru at free.fr