2023-02-02 10:19 PM
Hello. I used to use the following code for starting a timer interrupt and used to set up the pre scalar and counter such a way I get the desired frequency but now this code is not working. My LED doesn't blink at all. I just wanted to check if the code is wrong or iff my hardware has some problem.
HAL_TIM_Base_Start_IT(&htim2);
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){
if(htim->Instance == TIM2){
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
}
}
2023-02-02 10:27 PM
Have you enabled that timer interrupt in the chip configuration tool?
hth
KnarfB
2023-02-02 10:43 PM
yes it's enabled.
2023-02-02 10:51 PM
What chip?
Two ways:
hth
KnarfB
2023-02-02 10:53 PM
NUCLEO - L476RG
the code was working perfectly a week back today it just doesn't seem to work so I'm not able to understand what went wrong cause there has been no change.
2023-02-02 11:04 PM
Other interupts, eating up the CPU? Somehow disabled interrupts? Look at the registers, they do not lie.
or: roll-back your code, use git early and often https://youtu.be/hwP7WQkmECE
hth
KnarfB
2023-02-02 11:14 PM
no other interrupts are enabled and I restored the version yet I don't know it just doesn't work. I updated my STM IDE version. does that make a difference?
2023-02-03 02:06 AM
Check whether the real ISR is called, not the callback, to exclude Cube/HAL issues.
Read out and check/post content of TIM and NVIC registers.
Generic guideline for "interrupt does not fire" here.
JW