Having trouble debugging application using timer interrupts

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.
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

 Hi,

   

I have searched the forum archives and read several posts regarding the use of timers and read the datasheet a few times but still having problems.

   

I have dropped a timer component on my worksheet and set up as 32 bit time with interrupt on TC. Period register set to 24000, clock = 24 MHz. (1ms timer).

   

Within the interrupt I have counters being compared to determine timeout of several functions (UART functions).

   

When I single step (F11) through the code to debug it, The timer interrupt seems to continually run (steps into the isr, through the code and immediately back to start of isr as though it has not been reset?

   

If I set up a simple LED flash to test the timer routine for say 500ms, the timing of the interrupt appears ok.

   

I have attached the complete project if this helps identify what I have missed here.

   

Thanks in advance.

0 Likes
1 Reply
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

 I found the issue. The hardware timer keeps running while debugging and therefore is always timed out.

   

I changed the Timer component to a CLOCK and use an isr from the clock as my timer base (ticks off 1ms increments). All is working well now.

0 Likes