STM32C5 FreeRTOS low-power example hitting ASSERT_DBG_STATE
I was playing around with CubeMX2 (Version: 1.1.1) and some examples.
I took the current STM32CubeC5 FreeRTOS low-power example (git tag cadccf7), generated the CMake project, compiled it in STM32Cube for VSCode and started debugging it… which worked fine initially.
I then wanted to enable the “Debug” options inside “HALE System Init” in CubeMX2.

After re-generating the project code and compiling it, it did not run properly anymore.
It always became stuck inside “ASSERT_DBG_STATE(htim->global_state, HAL_TIM_STATE_ACTIVE);” in “HAL_TIM_Stop_IT” located in “stm32c5xx_hal_tim.c”.
The callstack was like this:
mx_freertos_app.c → app_freertos_post_sleep → mx_pwr_exit_low_power → mx_rcc_init → HAL_UpdateCoreClock → HAL_InitTick (in stm32_hal_timebase_tim.c ) → HAL_TIM_Stop_IT
My actual questions:
- Is this just a “bug” in the example? If so, how should the code inside “app_freertos_post_sleep” or around it actually look like?
- If this is a problem somewhere else - How can I fix it or when will it be fixed in the drivers/HAL?
