Skip to main content
gil_dobjanschi
Senior
Apr 17, 2026 09:19 UTC
Solved

HAL_TIM_OC_SetConfigChannel asserts on override_state

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

 

Saket_OmBest answer
ST Technical Moderator
Jun 25, 2026 14:40 UTC

Hello ​@gil_dobjanschi 

The issue has been solved in the new STM32C5 Ecosystem release 2.1.0. 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om

3 replies

ST Technical Moderator
Apr 17, 2026 11:25 UTC

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).

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Saket_OmBest answer
ST Technical Moderator
Jun 25, 2026 14:40 UTC

Hello ​@gil_dobjanschi 

The issue has been solved in the new STM32C5 Ecosystem release 2.1.0. 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
gil_dobjanschi
Senior
Jun 25, 2026 15:48 UTC

Hi ​@Saket_Om,

I confirm that the issue was solved.

Regards,

-Gil