This is I guess a continuation of
http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/501774
I'm trying to capture 4x input channels in High Resolution.
I built a naive NHET program and ran it in the simulator, and the HR bits in the captured timestamps seem temporally incorrect (out of order).
Specifically, I set HR=1, LR=8, 80MHz with this program:
L00: CNT {next=L01, reg=A, max=0x1FFFFFF } L01: WCAP {next=L02, reg=A, pin=CC2, event=RISE, cond_addr=L02, hr_lr=HIGH, data=0, hr_data=0 } L02: WCAP {next=L03, reg=A, pin=CC4, event=RISE, cond_addr=L03, hr_lr=HIGH, data=0, hr_data=0 } L03: WCAP {next=L04, reg=A, pin=CC6, event=RISE, cond_addr=L04, hr_lr=HIGH, data=0, hr_data=0 } L04: WCAP {next=L00, reg=A, pin=CC8, event=RISE, cond_addr=L00, hr_lr=HIGH, data=0, hr_data=0 }
And created a Stimulus file (HET IDE won't let me copy/paste) which triggers pins (2,4,6) high at cycles (5,15,10) and low at cycles (25,30,35),
repeating every 50 cycles. The goal was to (a) keep the input frequency lower than the loop frequency, (b) have a high probability of multiple
captures within a loop and (c) have the captures out of order wrt the program.
In the second input cycle, WaveViewer indicates that pin 6 indeed triggers 5 HR clocks (62ns) before pin 4, but the Memory window indicates
pin 4's capture Data (LR,HR)=(9,2) and pin 6's (LR,HR)=(9,4).
That seems to say that pin 4 went high before pin 6, when actually the opposite was the case. It also seems to say that the captures were
2 clocks apart rather than 5, which is somewhat more than rounding error.
Is this an artifact of the "synchronization" mentioned in the note "WCAP in HR mode" in sec 17.5.3.23? Or am I just missing something obvious?