Skip to main content
Junde
Senior III
April 3, 2023
Solved

Why cubeMx recommend I use the timer, not systick, when I config freeRTOS?

  • April 3, 2023
  • 2 replies
  • 2064 views

Hi,

The same as the title, I'm confused that why NOT just use systick as the tick of RTOS.

The aim of the systick is for good portability of the RTOS, yes?

0693W00000bhPRGQA2.png

This topic has been closed for replies.
Best answer by Pavel A.

> The aim of the systick is for good portability of the RTOS, yes?

Yes, FreeRTOS, for one, uses systick as its tick timer. The CubeMX/IDE configurator fully supports this and lets the RTOS manage the systick.

But the "HAL" library also needs a tick timer, by default it is the systick as the simplest choice. When the user's project contains a RTOS, the Cube advises to use a different timer for the "HAL" library.

Can these two timers be merged together? Sometimes yes, but generally no.

If you don't use the HAL library at all, there is no need for a separate timer for it and the whole issue disappears.

2 replies

Pavel A.
Pavel A.Best answer
Super User
April 3, 2023

> The aim of the systick is for good portability of the RTOS, yes?

Yes, FreeRTOS, for one, uses systick as its tick timer. The CubeMX/IDE configurator fully supports this and lets the RTOS manage the systick.

But the "HAL" library also needs a tick timer, by default it is the systick as the simplest choice. When the user's project contains a RTOS, the Cube advises to use a different timer for the "HAL" library.

Can these two timers be merged together? Sometimes yes, but generally no.

If you don't use the HAL library at all, there is no need for a separate timer for it and the whole issue disappears.

Junde
JundeAuthor
Senior III
April 3, 2023

@Pavel A.​ 

OK, I got it.

Thank yours.