2021-05-27 02:09 AM
Hello,
I want to activate three output compare interrupts in my timer peripheral. I want to use Output Compare for this purpose because then I can change the time. However, in STM32CubeMx there is a button to activate a global TIM2 interrupt, but there is no output compare interrupt. Even when I activate the output compare. Am I missing something?
Solved! Go to Solution.
2021-05-29 03:39 AM
Hello Eden.757,
the setting output/compare interrupt for the respective channels is not available in the STM32CubeMX. The respective CCxIE bits (Capture/Compare interrupt enable) are set inside the code when you are using related HAL functions. In your case you will be interested in these respective functions:
HAL_StatusTypeDef HAL_TIM_OC_Start_IT (TIM_HandleTypeDef * htim, uint32_t Channel);
HAL_StatusTypeDef HAL_TIM_OC_Stop_IT (TIM_HandleTypeDef * htim, uint32_t Channel);
More information you can in the HAL and low-layer drivers user manual related to MCU family you are using. For the STM32F4 mcus family the manual could be found here. The TIM HAL functions across the families are rather similar. Please click on Select as Best if my reply fully answered your question. This will help other users with the same problem to find the solution faster!
2021-05-29 03:39 AM
Hello Eden.757,
the setting output/compare interrupt for the respective channels is not available in the STM32CubeMX. The respective CCxIE bits (Capture/Compare interrupt enable) are set inside the code when you are using related HAL functions. In your case you will be interested in these respective functions:
HAL_StatusTypeDef HAL_TIM_OC_Start_IT (TIM_HandleTypeDef * htim, uint32_t Channel);
HAL_StatusTypeDef HAL_TIM_OC_Stop_IT (TIM_HandleTypeDef * htim, uint32_t Channel);
More information you can in the HAL and low-layer drivers user manual related to MCU family you are using. For the STM32F4 mcus family the manual could be found here. The TIM HAL functions across the families are rather similar. Please click on Select as Best if my reply fully answered your question. This will help other users with the same problem to find the solution faster!