I'm trying to use IEEE1588 time-stamping capability on a Vybrid Tower kit TWR-VF65GS10.
I'm using the 50MHz external clock to clock the ENET module, thus I use an increment value (ENET_ATINC) of 20 (0x14). That way I can directly read values expressed in nano-second.
It seems to work correctly, but when I use the timestamp counter (ENET_ATVR) to measure some code performance I get a strange behaviour :
I make 2 succesive readings of ENET_ATVR (which first needs to set the CAPTURE flag of ENET_ATCR register), then I compare the 2 values.
On a very small piece of code, most of the time, the difference is an almost constant value (560 or 580 ns), but sometimes (?!) values are not consistant at all. I can observe various behaviors :
- Increment is not consistent :
t1 = 0x7AD650B4
t2 = 0x7AD6548C
diff. = 984
==> the difference is greater that 580, but primarily it is not a multiple of 20 ?!
- The difference is negative :
t1 = 0x0862D280
t2 = 0x0862D0C4
diff. = -444
Here, the expected t2 value is 0x0862D4C4 (seems to be a defect on bit 10), but this is not always so trivial e.g. :
t1 = 0x60EB193C
t2 = 0x60EB135C
I also note another strange behavior : I launch my SW normally, then I break and disable time-stamping (I set ENET_ATCR=0) with my debugger (Lauterbach Trace32).
Then I set the CAPTURE flag many times to acquire some ATVR values. What I get is 2 different values separated by the increment value. Values are not coming in a regular flow, e.g. :
It seems that data come from a dual buffer. Could it be the origin of the problem ?
Here is my IEEE1588 registers configuration :
I experiment this on both ENET0 and ENET1
Did someone face such an issue ?
Thanks for any help