cancel
Showing results for 
Search instead for 
Did you mean: 

Systick and FreeRTOS Question

TheStumbler
Associate III

My client has an application which uses FreeRTOS. Recently I wanted to do a small, simple test. I wrote a couple dozen lines of code and put it in main() before the FreeRTOS scheduler starts (my test code ends in a while(1) loop, to FreeRTOS never gets called).

This test code uses a simple counter attached to SysTick. I know from looking at the code and reading other people's issues, your application can't use SysTick because FreeRTOS uses it. But what I couldn't figure out is why my weird case wasn't working. I made sure to undefine the FreeRTOS SysTick handler, and my handler was registered. But it just wouldn't get triggered.

Is there something about just compiling with FreeRTOS that will "break" normal SysTick operation (other than where it takes over the handler, which I disabled temporarily). After wasting a couple hours, I eventually gave up. Any thoughts?

Compiler: Keil MDK-ARM 5.06 build 528 + uVision 5.24

FreeRTOS: v8.1.2

Target: STM32F405RGT

-Chris

2 REPLIES 2

Hello @TheStumbler​ ,

When using FreeRTOS, SysTick will be enabled by the operating system. In fact, your application probably uses a timer as a time base source. You can check the HAL_InitTick() function.

Moreover, you have disabled FreeRTOS scheduler starts. So the sysTick will not be configured.

Please check that you have configured your SysTick in the HAL_Init() function.

I hope this helps.

BeST Regards,

Walid

TheStumbler
Associate III

I guess I wasn't clear. My application doesn't use HAL, when runs normally, it relies on FreeRTOS for its timing requirements.

My silly test code, which I am trying to run before FreeRTOS gets started up, doesn't use HAL, either. It just handles the SysTic bare-metal, and the same code works just fine in another test program which doesn't compile with FreeRTOS.

It's not a big deal, I will just carve out the test code into its own separate program. I was just wondering why SysTick was not working when FreeRTOS isn't started. I wasted a few hours tracking it down, and finally gave up.

-Chris