cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Cube and FreeRTOS Don't Cooperate

groufosse
Associate II
Posted on June 16, 2014 at 21:08

Hi,

I'm having a very difficult time getting FreeRTOS v8 to run with CUBE/HAL. I started out using CUBE to generate a basic example for an ADC input configuration, and a timer that will count up (or down) and execute an interrupt handler.

I can seem to get that to work, but when I add in FreeRTOS, it will not run. As soon as the Timer Init function is run, it will not allow the FreeRTOS scheduler to operate. In addition, when CUBE generates the ''void SystemClock_Config(void)

'' function, it has this assignment:

RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

If the first type (RCC_CLOCKTYPE_HCLK) is not removed, the timer interrupt will not function or initialize at all.

To get FreeRTOS to  run, I must comment out the Timer Init (in other words, don't run it at all) FreeRTOS operates with no problem. In addition, after creating the example in CUBE and adding FreeRTOS (what it calls ''middlewares'') it generates the file ''FreeRTOSConfig.h''. At the bottom of the file there is a commented out define for the FreeRTOS xSystickHandler. It warns to NOT un-comment it as it will break the HAL systick.

I'm hoping someone can shed some light on these mysteries please?

Could anyone in this forum provide a working example of how to configure when using both HAL and FreeRTOS?

Thank you...

#timer #clock #hal #freertos
2 REPLIES 2
jeanmark
Associate II
Posted on June 18, 2014 at 09:35

Hi,

Try to set timer's interrupt priority lower than configMAX_PRIORITIES.

stm32cube-t
Senior III
Posted on July 21, 2014 at 17:02

Please note we don't support FreeRTOS v8 yet (v7.6 is supported).

There is a known issue that shall be patched manually for now (stm32fxxx_it.c). Please confirm if this solves your issue:

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM4Cube%2bFreeRTOS%20xTaskIncrementTick%28%29%20could%20be%20called%20when%20pxCurrentTCB%20%3d%3d%20NULL

Best Regards