cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Configuration for specific duration

dbgarasiya
Senior II

Hello ,

I want to configure a timer which start and runs for specific duration and stops automatically

and when again i want to start that timer i could be able to start timer and agian stops automatically

duration is fixed all time

Dipak Garasiya

13 REPLIES 13
dbgarasiya
Senior II

I have solved out this problem , actually when i have write some code , like making another gpio write as @Community member​  have suggested, i solved issue

Thanks for support @Community member​  and @berendi​ 

Looks like the debugger got confused because there was no code after the while loop. This happens with gdb.

Add an

asm("nop");

instruction when you are not sure the debugger has something to put a breakpoint on.

dbgarasiya
Senior II

which interrupt is generated when TIM_CR1_CEN becomes zero ?

It's called Update Interrupt, and it's generated every time the counter reaches the limit (even if the timer is not in one-shot mode).

Look the name of the interrupt up in the interrupt and exception vector table in the reference manual. Some timers have one global interrupt, others have separate vectors for different events.

Enable the update interrupt both in the NVIC and in the timer DIER register.