xEventGroupSetBits and task scheduler

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

xEventGroupSetBits and task scheduler

Postby fly135 » Sat Dec 15, 2018 12:02 am

Does calling xEventGroupSetBits cause the scheduler to immediately check tasks or does it still run at 10msec intervals. Asking for a friend. :lol:

My coworker wants to sample the ADC at 1khz. The ADC read is in a task and he uses a 1khz timer callback to call xEventGroupSetBits. I'm thinking that it does not invoke the scheduler immediately, and think we should read the ADC in an interrupt routine. Are there any caveats to reading the ADC in an interrupt? It doesn't say anything in the docs WRT that.

John A

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: xEventGroupSetBits and task scheduler

Postby fly135 » Tue Dec 18, 2018 3:55 pm

At the very minimum, can I use the adc read routine in an interrupt. I realize the other question is a FreeRTOS thing and may be best asked on a FreeRTOS forum.

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

Re: xEventGroupSetBits and task scheduler

Postby ESP_Sprite » Wed Dec 19, 2018 2:47 am

I just checked: xEventGroupSetBits uses xTaskRemoveFromUnorderedEventList to unblock a task, and that is pre-emptive (as in: will actively switch over to the unblocked task or tell the other core to do so).

In general, all FreeRTOS functions that unblock a higher priority task should immediately switch to that task. (If they don't, things like tickless operation would be impossible.)

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: xEventGroupSetBits and task scheduler

Postby fly135 » Wed Dec 19, 2018 4:30 am

Awesome! That makes sense according to what I saw in the semaphore thread.

Who is online

Users browsing this forum: No registered users and 97 guests