I made a code to call Timer2 interrupt function like this :
timerx->TIMx_PSC =42000; // prescaler
timerx->TIMx_ARR =2000; // counting number
timerx->TIMx_CR1 |=0x90; // auto reload, count down
timerx->TIMx_DIER |=0x01; // enable update interrupt
interruptsx->ISER[0]|= 1<<(TIMER2_INTERRUPT); // enable timer_interrupt
TIMER2_INTERRUPT=28
timerx->TIMx_CR1 |=0x01; // enable counter
timerx->TIMx_EGR =0x01; // update generation
and
void TIM2_IRQHandler(){
if(timer2->TIMx_SR & 0x1){
gpio_toggle_off(gpio_A,GPIO_Pin_1);
number_display(gpio_D,number0);
}
timer2->TIMx_SR=0x0;
}
The problem is : it doesn't jump to TIM2_IRQHandler(). How can I solve this problem?
TIM2_CNT
register a few times in sequence; if they're all identical, it is most certainly stopped. Do any of the flags in TIM2_SR get set after a while? \$\endgroup\$