cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS systick

YasirR
Associate

Originally posted in MCUs forum; moved to MPUs, as STM32MP is an MPU - not an MCU.


Hello Everyone,

I am working with FreeRTOS on an STM32MP157CAA and configuring the CM4 core in engineering mode using CubeIDE. According to the documentation, it's necessary to select a timer other than SysTick for the HAL timebase. However, in CubeIDE, under the SYS settings in the Pinout tab, I only see SysTick available as an option.

When I generate the code, I receive the following warning:

 

WARNING:
When RTOS is used, it is strongly recommended to use a HAL timebase source other than the SysTick. The HAL time base source can be changed from the Pinout tab under SYS.

 

Despite this, I am unable to select any other timebase source besides SysTick.

Could anyone provide guidance on how to configure a different HAL timebase source for FreeRTOS in this setup? Any advice or workaround would be greatly appreciated.

Thank you!

6 REPLIES 6
AScha.3
Super User

Hi,

just give it (select in Cube...) a timer , you anyway not need for your program, i took TIM6 :

AScha3_0-1719563724346.png

Then it uses this and adjust it...you dont need to care about it.

If you feel a post has answered your question, please click "Accept as Solution".

Hi AScha.3,

Thank you for your response. I understand what you mean. As I mentioned, I am unable to select any other timer; only SysTick is available as an option. Unlike in your case, I do not see any other timers like TIM6 highlighted for selection.

Do I need to configure anything else to enable the other timers, or is there another step I am missing to make these timers available for selection? Any guidance would be greatly appreciated.

 

Please have a look on the attached picture.

 

Hmmm...

1. you can only select timers, that are not used (by you), state : grey, unused on left side.

2. timers (in clock tree need a clock...) check in clock tree, you have clocks everywhere:

AScha3_0-1719564631630.png

 

If you feel a post has answered your question, please click "Accept as Solution".

I have the same "problem" and am not impressed by the solution that is provided by the STM Cube solution.

Looking at my system, I can see that there is a generated function called HAL_TIM_PeriodElapsedCallback() which calls the HAL_IncTick() function. This function increments uwTick and the only function using uwTick is the HAL_GetTick() function. 

Since in my case (and in a lot of the other cases I have seen and read about) the tick frequency of both the HAL and FreeRTOS is 1 kHz, the simple solution would be to call this HAL_IncTick function from within the FreeRTOS SysTick interrupt handler. Even simpler would be to let the HAL use the FreeRTOS tick value.
At least, as long as you are not using FreeRTOS in tickless mode.

As a more general issue: there are a lot of HAL functions using HAL_Delay() and this function does nothing else than just blocking the CPU until the tick value reaches a certain value. This is not something I'd like to do in an RTOS driven system - I would even call this a critical flaw in the system.


@YasirR wrote:

Unlike in your case, I do not see any other timers like TIM6 highlighted for selection.


Possibly because @AScha.3 was looking at the MCU version of CubeMX, but you're using the MPU version?

I've moved the thread from the MCU forum to the MPU forum now.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@RobJ ,

>a lot of HAL functions using HAL_Delay()

really ? Give some examples, please.

+

Basically on a RTOS the "delay", blocking/waiting , should not be used at all.

On running rtos the matching "delay" is tx_thread_sleep(x) (Azure, or similar);

So its waiting here (this task) also, but other tasks running on, using 100% of cpu time.

 

If you feel a post has answered your question, please click "Accept as Solution".