Page 1 of 1

freeRTOS scheduling on esp32

Posted: Wed Jun 28, 2017 8:15 am
by preetam
Hi All,

I am working on multiple tasks, i have around 6 tasks and would like to implement round robbin scheduling as follows.
task1 is at priority 6 and task2 to task 6 are at 5.

here is what i have done till now in brief. Each task is created after esp32 recieves the IP. Each tasks has log at the start that shows it is created. Each task also has a log inside there loop that shows whether it running or not.

I have enabled configUSE_TIME_SLICING to 1 in FreeRTOSConfig.h, as per my understanding this enables round robbin scheduling.
But somehow only task 1(Highest priority) and task 2, and task 3 are running. whereas task2 to task6 should run in round robbin.

Could someone let me know whether this is right and also is there any other way to schedule them.

Thank you
Paul

Re: freeRTOS scheduling on esp32

Posted: Wed Jun 28, 2017 9:08 am
by ESP_Sprite
Fyi, timeslicing already is on in FreeRTOS (if it's not defined, it defaults to 1). How do you create your tasks exactly?

Re: freeRTOS scheduling on esp32

Posted: Wed Jun 28, 2017 9:11 am
by preetam
Hi ,

After i get ip, i have tasks creator function to create all tasks with a delay of 50 ticks between each creation.

I am not pinning the tasks to any core.
Thanks
Paul

Re: freeRTOS scheduling on esp32

Posted: Wed Jun 28, 2017 3:11 pm
by ESP_Sprite
Can you share your code so we can try to reproduce this?

Re: freeRTOS scheduling on esp32

Posted: Wed Jun 28, 2017 3:49 pm
by www.freertos.org
If you are not sure how the scheduler selects which task to execute then I would recommend reading the first few chapters of the book that can be downloaded from here.

Re: freeRTOS scheduling on esp32

Posted: Thu Jun 29, 2017 9:39 am
by preetam
Hi All,

I am able to schedule now properly.
previously a created task acquired a mutex and then got deleted without giving away the mutex back. The same mutex has to be acquired before creating additional tasks. hence sometimes the tasks were created and sometimes not.

Thank you
Paul

Re: freeRTOS scheduling on esp32

Posted: Thu Jun 29, 2017 11:09 am
by ESP_Sprite
Glad you got it solved!