cancel
Showing results for 
Search instead for 
Did you mean: 

Using multiple tasks in FreeRTOS

Justin1
Senior

I am having a strange problem with FreeRTOS in CubeMX, I cannot get multiple tasks to work concurrently. I use the following procedure -

Pre: Check STM32Cube_FW is fresh   (v1.9.0 used)

  • Open STM32Cube V1.0   (v5.0.0 used)
  • New Project -> 'Access To MCU Selector'
  • MCU -> 'STM32F091RC' -> 'Start Project' (sel STM32F091RCTx)
  • SYS: Timebase Source - TIM17
  • FreeRTOS: Enabled
  • Add Task: myTask02 with defaults
  • Generate Code

For the example above myTask02 fires but the defaultTask does not, what am I missing to get both working? This has always worked for me before, what is wrong now?

1 ACCEPTED SOLUTION

Accepted Solutions
Justin1
Senior

Solved it, sharing response if useful for others. In the example listed above all task timing is aligned, e.g. StartDefaultTask() & StartTask02() look like this -

void taskExample(void const * argument) {

 for(;;) {

  osDelay(1);

 }

}

So they clobber each other. Solution? Introduce timing offsets, e.g. change the osDelay() value for each task. Done!

View solution in original post

1 REPLY 1
Justin1
Senior

Solved it, sharing response if useful for others. In the example listed above all task timing is aligned, e.g. StartDefaultTask() & StartTask02() look like this -

void taskExample(void const * argument) {

 for(;;) {

  osDelay(1);

 }

}

So they clobber each other. Solution? Introduce timing offsets, e.g. change the osDelay() value for each task. Done!