RTC deviation in comparison whit GPS time ?
Ltech
Posts: 380
I try to find how to know when the next second start from a nmea gps sentence
I try to find the deviation of rtc time by using gps time
Using the "GPS_Float" Object
The problem is when do I have lo read the rtc time for making the comparison ? " IfNot rtc.Getseconds == GPS.Long_Second Do update rtc "
The GPS.Long_Second is already in the string for a while when I read the rtc .....
On the LCD my seconds do not always jump at the same moment.
I try to find the deviation of rtc time by using gps time
Using the "GPS_Float" Object
The problem is when do I have lo read the rtc time for making the comparison ? " IfNot rtc.Getseconds == GPS.Long_Second Do update rtc "
The GPS.Long_Second is already in the string for a while when I read the rtc .....
On the LCD my seconds do not always jump at the same moment.
Comments
If the datasheet is well done you'll have detailed description of the 1pps signal and a delay range for your pps signal.
Massimo
If you want, here's the code I used for testing (it's for PropGCC rather than Spin, that's the environment I'm most comfortable with). There are two .binary files which you can run with the regular Proptool. printall.binary prints all sentences with timestamps (based on the 80 MHz CNT) and delta between arrival in cycles and milliseconds; examinegps.binary prints only the GPGGA sentences, which are the first ones my GPS sends. The binaries are compiled assuming the GPS is talking on pin 4 at 4800 baud.
Output looks like: which gives the time of arrival (in cycles measured by CNT) and difference from the last sentence (in cycles and milliseconds, again as measured by CNT). "Time of arrival" is the value of CNT when the first bit of the sentence was received, and is measured in a separate COG for accuracy. As you can see there's considerable variation in when that sentence arrives, much more (I think) than the error in the Prop's RTC.
Certainly 1pps will be much more precise than Serial, but what does the long term sync of the Serial look like ?
A simple tracking lock, could remove short term jitter, to get down to something useful without needing another pin for 1pps ?
eg Two of your numbers differ by what looks close to 3 bit times at 4800 (within 1.0006404)
So do you need precise (ms) timing or do you want to get rid of long term drift?
If you accept a little jitter getting time from the serial stream on the long term will have less drift than an RTC. As long as you have GPS signal..
Massimo
The only requirement imposed by the standard is that the NMEA data for a particular second be output in that second, there is no synchronization of any part of the NMEA data with the start of the second. That's the purpose of the PPS signal. On the Garmin OEM devices I've used, there is no delay; the leading edge of the PPS signal marks the beginning of the second to +/- 1 microsecond. As others have stated, you can use the NMEA data for long-term correction, but not to find the start of any given second.
First I just need to sync my rtc, but how can I do it at the best time
I need to get it under the 1/30 of a second
When I get the right timing of second change (trough 1sec puls :-) ) I can anticipate the next second and wait the right amond of time for update the rtc
I use the gps time for normal use, but need a backup with rtc ( startup after power douwn, and "short" inside use )