Search code examples
scheduled-tasksfreertosrtos

Using freeRTOS to set up 1ms interrupt with systick_Handler causing tasks to only run once


I'm completely new to freeRTOS. I had two tasks set up to run sequentially and my program ran fine. However, when I added SysTick_Config and SysTick_Handler it will only run my tasks once and then I believe just sit on idleTask (not sure if thats the right terminology). How do I solve this problem so that my tasks run like they did before with systick_handler working as well?

Here is a screenshot of my code

I apologize if the question doesn't make sense please let me know if I need to elaborate.


Solution

  • By default, FreeRTOS configures and uses SysTick for its own timing purposes, like periodic execution of the scheduler, software timers, blocking function timeouts etc. So, SysTick and the related interrupt aren't directly available for the user. You shouldn't alter SysTick in your user code.

    There may be ways to change this default behavior (I'm not sure), but normally you shouldn't need it. FreeRTOS needs a timer and using a more capable TIM module instead of SysTick would be a waste.