Repeated reads to Timer Count giving inconsistent results

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.

0 Likes
3 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I am running this on a -030 DVK with an AXI-040 part in it. You hae a -039.

   

 

   

I hit the test case, looks like right after a rollover. Note Timer runs even when

   

you are halted, so your manual "run" command to the debugger is randomly

   

sampling the timer.

   

 

   

I notice on compile you are running an older version of Creator, updates

   

fix error and add capability, thats also could be an issue.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

As long as the devices remain within the family, they shouldn't have significant behavioural differences for IP blocks (at least, in theory), but it certainly is a point to investigate.

   

 

   

I suppose I should update the dev environment, but I would think that this basic case would have been tested long ago. I will update the environment and try again.

   

 

   

Also, the timer has a max 32 bit timeout at 1MHz, which should give it a rollover of just over an hour. It certainly takes less time than that to start the debugger and hit run. 🙂

   

 

   

I just wanted to make sure that it was valid to read from the Timer_ReadCount() multiple times during the Timer's clock period as I couldn't find any documentation to say otherwise. If updating the environment doesn't work, I will file a case. Thanks.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Actually the ReadCounter( ) is performing a capture into the FIFOs, I wonder

   

if thats an issue.

   

 

   

Note you would not want counter reset on capture checked off in config.

   

 

   

Regards, Dana.

0 Likes