cancel
Showing results for 
Search instead for 
Did you mean: 

TIMER INTERRUPT ISSUE

contact2
Associate II
Posted on September 28, 2013 at 12:45

Hello,

I am trying to make a timer interrupt routine, which executes every 0.25us. The problem I am facing that the code length in the routine changes the duration for example running an instruction at 72MHz, the next time the routine execute is 0.35us. It seems the the timer starts counting after returning from the IRQ routine, instead of running just after overflow. I am using Auto-Reload register with value 18. Tell me what I am missing.

Regards.

#timer2 #keil #stm32f303
15 REPLIES 15
contact2
Associate II
Posted on September 28, 2013 at 20:13

contact2
Associate II
Posted on September 28, 2013 at 21:57

0690X000006051NQAQ.png
contact2
Associate II
Posted on September 28, 2013 at 21:58

0690X000006051wQAA.png

contact2
Associate II
Posted on September 28, 2013 at 22:04

Now you can see these two images. How is it possible that system has took a single (1/72MHz) 0.00000014 sec step and counter made so much progress. I am very much confused now. Please help me in making it possible for me to run it properly. Also you can see in the image UIF bit remains high even though I have cleared it. Only possible if counter gets overflowed. I am attaching my recent work as well.

________________

Attachments :

Timer2_Beispiel.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0dP&d=%2Fa%2F0X0000000bbh%2FusEd2gVzNPI1HsUDJWSvyTzx2i_tLqjD4pALgJqmnWI&asPdf=false
Posted on September 29, 2013 at 00:26

I'll have to take a look later.

I wouldn't get too hung up about the debugger, and how the core executes wrt an external free-running timer which is not under the control of the debugger, and continues ticking. The peripherals are not part of the core, and access to them is complicated. The debugger is invasive.

If you want to qualify the timer either output a signal you can measure on a scope, or use the input capture and measure the period of some external known source.

Also don't RMW (&=) the TIMx->SR, this is not how it works, just write the mask to it and don't read it.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 29, 2013 at 03:23

That project looks to be something totally different, an old F1 based one.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..