Difference between
__HAL_TIM_ENABLE_IT(INTERRUPT, HANDLE); and HAL_NVIC_EnableIRQ(interrupt)?
I am genuinely confused about the usage of this function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-09 6:38 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-09 7:03 AM
> __HAL_TIM_ENABLE_IT(INTERRUPT, HANDLE);
Parameters appear to be the other way round https://github.com/STMicroelectronics/STM32CubeL4/blob/5e1553e07706491bd11f4edd304e093b6e4b83a4/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h#L1240 :
#define__HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))
i.e. this enables one particular source of interrupt in TIM, see TIMx_DIER register description in any TIM chapter of RM to your STM32.
There are several sources per timer, and while sometimes they have individual interrupts, in most timers they are simply ORed to one common interrupt; see the Interrupt chapter in RM to your STM32.
> HAL_NVIC_EnableIRQ(interrupt)
This is just a "decorated" Cube/HAL version of the CMSIS-standard NVIC_EnableIRQ(IRQn), i.e. function which enables one particular interrupt in NVIC. Read the NVIC chapter in Programming Manual to the core of your STM32.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-09 7:03 AM
> __HAL_TIM_ENABLE_IT(INTERRUPT, HANDLE);
Parameters appear to be the other way round https://github.com/STMicroelectronics/STM32CubeL4/blob/5e1553e07706491bd11f4edd304e093b6e4b83a4/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h#L1240 :
#define__HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))
i.e. this enables one particular source of interrupt in TIM, see TIMx_DIER register description in any TIM chapter of RM to your STM32.
There are several sources per timer, and while sometimes they have individual interrupts, in most timers they are simply ORed to one common interrupt; see the Interrupt chapter in RM to your STM32.
> HAL_NVIC_EnableIRQ(interrupt)
This is just a "decorated" Cube/HAL version of the CMSIS-standard NVIC_EnableIRQ(IRQn), i.e. function which enables one particular interrupt in NVIC. Read the NVIC chapter in Programming Manual to the core of your STM32.
JW
