Skip to main content
gil_dobjanschi
Senior
April 17, 2026
Solved

HAL_TIM_OC_SetConfigChannel asserts on override_state

  • April 17, 2026
  • 3 replies
  • 212 views

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

 

Best answer by Saket_Om

Hello ​@gil_dobjanschi 

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

3 replies

ST Technical Moderator
April 17, 2026

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
June 25, 2026

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
June 25, 2026

Hi ​@Saket_Om,

I confirm that the issue was solved.

Regards,

-Gil