Repeated reads to Timer Count giving inconsistent results | Cypress Semiconductor
Repeated reads to Timer Count giving inconsistent results
I have a timer running on a 1MHz clock, and repeated calls to Timer_ReadCounter() occassionally give inconsistent results. I will see the second call to Timer_ReadCounter() return a larger value than the previous call (not a rollover). I assume this is because I am polling at a higher rate than the 1MHz Timer clock? If so, why wouldn't the timer simply report the same count as the previous query?
Stepping through each line in the debugger provides the desired result, but when I let it run, I will hit my failure test case in my main code. A test project is attached.