I am having trouble with the eth0 1 PPS event on the i.MX8M Mini EVK. In our case, we want to use the eth0 1588 1PPS signal to precisely control the start time of an I/O event on the M4 processor (to an accuracy of within a few microseconds) . I am running ptp4l on the A53. Based on the ptp4l logs it is locking to the laptop I am using for a master clock. I enable the 1 PPS signal using:
echo 1 > /sys/class/ptp/ptp0/pps_enable
On the M4 side, I am running a program that enables and receives the 1 PPS signal as an IRQ(121). In the ISR, I read the ENET->ATVR register as well as the 32kHz RTC registers. Both sets of counters are indicating that the 1 PPS interrupt is occurring every 1.024 s, not every 1.000 s. Outside the ISR, I print the values read to the M4 debug terminal. Scraping the printed values into Matlab I have plotted the time differences. See the figure below.
Any idea what's going on?
I may be able to measure the actual period of the 1 PPS signal if someone can teach me how to route the 1 PPS signal to a pin I can observe on the EVK board. Perhaps I can redefine one of the pins used for UART3 or SAI5 that are available on J1003.
One thing I observed that may be relevant - At reset, the period register of the ENET timer is set to 1000000000. (1.000 s as this is a nanosecond counter). During the boot process this register is rewritten with 0x80000000. I tried rewriting the value to 1000000000, but it causes errors in ptp4l.
Thanks for the help.