Skip to main content
Justin1
Associate III
February 5, 2019
Solved

Using multiple tasks in FreeRTOS

  • February 5, 2019
  • 1 reply
  • 1429 views

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?

This topic has been closed for replies.
Best answer by Justin1

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!

1 reply

Justin1
Justin1AuthorBest answer
Associate III
February 5, 2019

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!