2026-04-17 2:19 AM - edited 2026-04-17 2:31 AM
Hello,
I am trying to setup TIM5 channel 1 to output a signal on its output pin. I generated the code using STM32CubeMX2. I am getting an assert failed during initialization.
mx_system_init() calls mx_tim5_init() which calls HAL_TIM_OC_SetConfigChannel():
oc_config.polarity = HAL_TIM_OC_HIGH;
oc_config.idle_state = HAL_TIM_OC_IDLE_STATE_RESET;
if (HAL_TIM_OC_SetConfigChannel(&hTIM5, HAL_TIM_CHANNEL_1, &oc_config) != HAL_OK)
{
return NULL;
}In HAL_TIM_OC_SetConfigChannel function assert fails at the following line:
ASSERT_DBG_PARAM(IS_TIM_OC_OVERRIDE_STATE(p_config->override_state));
ASSERT_DBG_PARAM(IS_TIM_OC_BREAK_MODE(p_config->break_mode));The value of the override_state shown by the debugger is: (HAL_TIM_OC_OVERRIDE_SET | unknown: 0xfa). If I comment out the assert it will assert on the next line (break_mode). If I comment that line out as well the code outputs a signal on the pin.
I attached my MX2 file.
What am I missing?
-Gil
2026-04-17 4:25 AM
Hello @gil_dobjanschi and welcome to ST community!
Thank you for bringing this issue to our attention.
I reported this internally.
Internal ticket number: CDM0061871 (This is an internal tracking number and is not accessible or usable by customers).