cancel
Showing results for 
Search instead for 
Did you mean: 

C5 - CubeMX2/HAL2: freeRTOS timebase issues

User_MV
Associate II

Hello @st,

I am testing the C5 with freeRTOS and I am having some issues that I like to report. I am doing it from scratch (start with MCU), so it may be a configuration issue....  I enabled freeRTOS and changed the SysTick timer to tim6.

Here is the first issue: the interrupt priority is kept at 0 by default. In CubeMX1 this is automatically set to 5 (or the configured min. freeRTOS priority).

 

Anyway, after changing that, the SysTick runs, so HAL_Delay() and so on works, e.g. before you start the scheduler.

Then I setup the project and CubeIDE for freeRTOS aware debugging following UM2609 with tim7 as statistics counter.

Now the SysTick timer is way to fast.

(I thought this cause by the HAL function HAL_TIM_GetClockFreq(timebase_gethandle()); (stm32c5xx_drivers/timebase/stm32_hal_timebase_tim.c line 121)) returns 48000000 instead of 144000000 when I debug it. But maybe not since reading the prescaler and the timer period returns the correct values.....)

The problem is the generated function void HAL_TIM_UpdateCallback(hal_tim_handle_t *htim) in stm32c5xx_drivers/timebase/stm32_hal_timebase_tim.c line 255, which is used when ISR callbacks are not enabled. This function is called in the general timer ISR handler HAL_TIM_IRQHandler() and because there are no timer guards for TIM6, the sysTick counter is increased by every timer event, not just the events generated by htim6.

So I guess the bug would be: timebase timer guards missing in TIMER_IRQ function when IRQ callbacks are disabled.

 

The third think is the location of the timebase stuff. This seems to be generated and/or might need case specific changes, so having it be located under stm32c5xx_driver/ is kind of odd in my humble opinion....

 

And here are some Setup Infos:

  • CubeMX2 1.0.0 because 1.0.1 did not generate the main.c/h files (template pack was missing in the project settings)
  • MCU: C542CCU6
  • OS: MacOS
  • CubeIDE: 2.1.1. (cmake base project)
0 REPLIES 0