freertos task switching

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

freertos task switching

2,327 Views
wxingsheng
Contributor I

I am using the csi_rgb565 example and I am trying to use rtos to run two tasks. The first task is the camera task, which captures images and displays it on the LCD, and the second task is an image processing task, which processes images slowly and runs less frequently than the camera task. I have set two tasks with the same priority but when I started the scheduler, only the camera task is running. The image processing task never runs. I have set USE_PREEEMPTION and USE_TIME_SLICING to 1 but the problem persists. Can anyone help? Thanks!

Labels (1)
Tags (1)
0 Kudos
Reply
3 Replies

2,155 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Xingsheng:

FreeRTOS uses priority based scheduler. If a higher priority task never blocks on something,  lower priority tasks will not get any time to execute.   I would suggest you check your higher priority task. for example,  vTaskDelay can release CPU, then lower priority task can have an opportunity to run.

Regards

Daniel

0 Kudos
Reply

2,155 Views
wxingsheng
Contributor I

Hi Daniel,

Both my tasks have the same priority so I don't think priority is the problem here. Also, I have added vTaskDelay to one of the tasks but the tasks still didn't switch.

0 Kudos
Reply

2,155 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Xingsheng:

Please refer to below link for task switching issues.

task not switching - FreeRTOS 

c - FreeRTOS tasks are not context switching - Stack Overflow 

Regards

Daniel

0 Kudos
Reply