On 06/20/22 11:39, David Woolley wrote:
> On 20/06/2022 00:32, chris wrote:
>> Don't really understand what's meant by "input capture timer" ?. Is
>> that related to some polling method, or what ?...
>
> I believe they mean a hardware clock, that can be read directly by the
> software, and is also latched into a register when the PPS signal
> arrives. A variation might be to start a hardware timer when the PPS
> arrives, again making it directly readable.
Still doesn't explain how the pps state change gets into the
system at hardware level. Devil in the detail, as usual.
It sounds like a polled system, not an interrupt driven one,
which can never be as accurate as the latter. Assuming a poll
rate of say, 1mS, not unreasonable for a modern cpu, Then if
the pps state change is not seen at one poll, but is seen at
the next, then the uncertainty can never be better than that
1mS, since it cannot be known when during that 1 mS the state
transition occurred. Best results for ntp really need a true
real time os, but it's far more common to use general purpose
os's because of the out of the box functionality., but not
ideal.
>
> Also, whilst NMEA is low priority, I suspect it is not uncommon to have
> its generation scheduled at the PPS time, making it much closer to the
> last PPS than the next.
Working through the path, would expect the nmea sentence to be
synchronised to the pps, but that's not the end of the story.
GPS engines, ones seen here, typically run at 2400 or 4800 bauds,
or ~200uS per bit. Assume the sentence is 6 bytes, 10 bits per
byte, that's 12.5mS to end of message. The host must then decode
that, say 20mS total processing time. Depending on the host, that
could be fairly deterministic and the delay corrected for, but
the overall system is still limited to a 1 second bounded
uncertainty, not good at all for a public ntp server.
Sorry, but interrupt driven systems are the only way to get it
right...
Chris