cancel
Showing results for 
Search instead for 
Did you mean: 

Hi. I am very new for ST mcus.. Here, I am trying to set set timer2 for interrupt. Assigned PE2 for toggle, In STM32Cube IDE, set clock, enabled tim2 global interrupt. but I am not getting timer interrupt under void HAL_TI();

ATiwa.3
Associate
 
5 REPLIES 5
LCE
Principal

Check if the timer has started at all by reading its control register CR1 (reg TIM2->CR1, bit TIM_CR1_CEN).

TDK
Guru

What is HAL_TI() and why are you expecting interrupts there?

Some source code would be explanatory.

The timer update interrupt would call HAL_TIM_PeriodElapsedCallback.

If you feel a post has answered your question, please click "Accept as Solution".

Hi Thanks for your reply. The routine was HAL_TIM_PeriodElapsedCallback(); but due to less available character space, only  HAL_TI(); was blw to write.

I think I am missing something very minute but very critical parameter. I tried with all possible clock configs, prescalers, postscallers for 1us tick period, but unable to get interrupt.

Can you please help me out by some Enable Routine by special function registers?

Does PE2 toggle?

Observe the TIM registers, mainly DIER (is the Update interrupt enabled?). Some generic hints to solve interrupts not firing here.

JW

Interrupting at 1 MHz (1us) is not practical.

If you want to measure elapsed time with this granularity, free run in maximal count, and read the count value, deltaing the different from current vs initial value.

>>..but due to less available character space

Don't put the entire question in the title/summary, but rather in the body field for the question itself. You can also Edit posts, see V icon in upper right of message areas.

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