In my application I'm using S32K148 ENET 1588 Timer in output compare mode with toggle output on compare. It is used for AVB media clock recovery. DMA is writing timestamps from a FIFO to timer's TCCR register.
I'm facing a rare issue that sometimes the DMA stops consuming timestamps and the value of TCCR register shows a timestamp which should have been consumed, but was not. The value of the timestamp read from TCCR is around 500000.
Is there a known issue with this MCU which could lead to the described problem?
The same happens (also very rare) when DMA is not used at all for writing timestamps to TCCR, but ENET 1588 Timer interrupts are used instead with MCU writes to TCCR in the interrupts.
If the TCCR register reading in this case returns 500000 value of timestamp, does it mean that prevoous written timestamp was not consumed, or that 500000 was not consumed? I'm asking as the S32K148 manual says the TCCR is double buffered.
My timestamp interval is nominal 500000 ns. ENET clock is 40MHz.
It appears that ENET 1588 Timer stops consuming timestamps, when timestamp is in range 999 999 975 to 25 ns, when IEEE 1588 time crosses 0.
Can you confirm this?
does it mean you see missing output toggle (flag is not set too) on counter overflow? By the TCCR register reading you have no indication that update was done. An update is done whenever the timer channel is enabled and on every subsequent compare. Also a compare should occurs on overflow if compare value is greater that counter when counter overflows or a compare value is less that counter after overflow.
I see that IRQ (when TCCR is written by CPU in interrupts) and DMA (when DMA is writing to TCCR) stop at specific TCCR values. It looks like when the written TCCR value is in range 999999975-0. I think 20 or 10 do not cause the issue, but I will double check. My ENET 1588 counter period is 25ns.
When timer stops, the toggling also stops and there are no more irqs nor dma transfers. I need to reset the timer to make it running and toggling again.
It also depends what is the initial value of 1588 Time set. If I set it to 24 and my first timestamp is 24+9000000 and increment the timestamps by 500000, then it also stops at 24.