cancel
Showing results for 
Search instead for 
Did you mean: 

Timer interrupt not working

kavinkumar
Associate III
Hi was trying to do work with timers in stm32 when i use the timers directy like this i could set the phase voltages correctly .
kavinkumar_1-1725618668157.png
but when i use the interrupt to set the duty cyles always the phase voltages are zero
kavinkumar_0-1725618623549.png

how to dynamically set the phase voltages in the timer interrupt

 



 
4 REPLIES 4
gbm
Lead III

1. Use the code insert feature instead of screen dumps.

2. Is your timer callback ever called? Maybe you started the timer without period interrupt enabled. Use the debugger to check it.

3. If it is called, use the debugger to check the values written to CCRx registers.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

1.Okay got it

2. Yes the timer callback is called i could see the elec angle value being updated.

kavinkumar_0-1725621473293.png

kavinkumar_1-1725621485433.png

 this is my timer config where should i enable period interrupt
3. is there a way to check the ccr registers in the live expressions?

TDK
Guru

HAL_TIM_PWM_Start does not turn on any interrupts. Use HAL_TIM_PWM_Start_IT instead if you want callbacks to happen.

 

You can add TIM1->CCR1 to the live expressions to see it.

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

kavinkumar_1-1725625570412.png

its says failed to evaluate expression

Also i'm not using HAL_TIM_PWM_Start i'm using HAL_TIM_Base_Start_IT(&htim1) to start the interrupt @TDK 

EDIT: tried using this 

 

  HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_1);
  HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_2);
  HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_3);

 

 

but still same behaviour maybe if i could see whether if the ccr values changes in the live expression would be helpful to debug