Solution to avoid immediate TIM IRQ in CMSIS.
Hi,
I 'm trying to code TIM to count 5s for me using CMSIS. Using the code snippet provided below I got IRQ immediately.
RCC->APBENR2 |= RCC_APBENR2_TIM16EN ; // Enable TIM16 clock
TIM16->PSC = 16000 - 1 ; // 1 ms
TIM16->ARR = 10000 - 1 ; // 10 s = 10000 * 1 ms
TIM16->DIER |= TIM_DIER_UIE ; // Enable interrupt generation
NVIC_SetPriority ( TIM16_IRQn , 0 ) ; // Configure interrupt priority
NVIC_EnableIRQ ( TIM16_IRQn ) ; // Enable interrupt
TIM16->CR1 |= TIM_CR1_CEN ; // Start count TIM16I know the solution for HAL to avoid immediate IRQ would be:
__HAL_TIM_CLEAR_IT ( &htim16 , TIM_IT_UPDATE ) ;
Please help to find relevant solution in CMSIS, because I stucked.
V/r
yabool2001
