Open MaciekMachni opened 2 years ago
Please check the TOD Master Reference Manual: https://github.com/opencomputeproject/Time-Appliance-Project/blob/master/Time-Card/SOM/FPGA/Doc/Tod_Master_ReferenceManual.pdf
The NMEA Master takes the time from the adjustable clock which is usually TAI (Chapter 2.4). Correction has to be done via the available register (Chapter 3.2.1.5).
@jlemon: Maybe something which could be done directly in the driver?
Just note that the difference between the two messages is at -75 seconds, which is more than 2x the current UTC vs. TAI difference. Most likely, the correction is done twice, and we're getting stale messages.
The sysfs file utc_tai_offset should apply its correction to the NMEA master, as @thschaub mentioned. I'd suggest checking that value.
Unfortunately, writing to that file has no effect: https://asciinema.org/a/RbQNaJarzDvWflWP3RoE0TDG1 Also, it does not accept negative corrections (which makes sense but prevents testing a workaround). I'll try to hack the code tomorrow, but the thing that worries me is we get the extra 1 s offset.
Edit: a bit of background on the video - the adapter is connected via SMA cable to the time card and was synchronized to the GNSS output before the test. In the test, it was running with the --free_running 1 to measure the offset and not apply the correction.
@thschaub, unfortunately, it's not fixable in the software. The NMEA offset is already set correctly at the ptp_ocp_utc_distribute() function at the driver initialization, but it seems the IP block applies the 37 s correction by default.
I tried setting the bp->nmea_out->adj_sec (which maps to the register you mentioned) to 0, resulting in the 38-second offset in the NMEA received from the Time Card NMEA UART vs. the ZED-F9T UART.
Setting the negative correction in the register results in time reverting to 1980.
The time reported in the $GPZDA NMEA message on the NMEA serial port is incorrect. It returns GPS time instead of UTC.
The upper part shows the G*ZDA message from the Time Card, while the lower - reported by the UBX module (on the UBX serial port)