freeRTOS scheduling on esp32

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

freeRTOS scheduling on esp32

Postby preetam » Wed Jun 28, 2017 8:15 am

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

ESP_Sprite
Posts: 9040
Joined: Thu Nov 26, 2015 4:08 am

Re: freeRTOS scheduling on esp32

Postby ESP_Sprite » Wed Jun 28, 2017 9:08 am

Fyi, timeslicing already is on in FreeRTOS (if it's not defined, it defaults to 1). How do you create your tasks exactly?

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

Re: freeRTOS scheduling on esp32

Postby preetam » Wed Jun 28, 2017 9:11 am

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

ESP_Sprite
Posts: 9040
Joined: Thu Nov 26, 2015 4:08 am

Re: freeRTOS scheduling on esp32

Postby ESP_Sprite » Wed Jun 28, 2017 3:11 pm

Can you share your code so we can try to reproduce this?

www.freertos.org
Posts: 2
Joined: Tue Jan 17, 2017 8:16 pm

Re: freeRTOS scheduling on esp32

Postby www.freertos.org » Wed Jun 28, 2017 3:49 pm

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.

preetam
Posts: 49
Joined: Thu Jan 26, 2017 2:31 pm
Location: Germany

Re: freeRTOS scheduling on esp32

Postby preetam » Thu Jun 29, 2017 9:39 am

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

ESP_Sprite
Posts: 9040
Joined: Thu Nov 26, 2015 4:08 am

Re: freeRTOS scheduling on esp32

Postby ESP_Sprite » Thu Jun 29, 2017 11:09 am

Glad you got it solved!

Who is online

Users browsing this forum: No registered users and 138 guests