vTaskDelay below 10 ms

AndreaS73
Posts: 14
Joined: Tue Jan 16, 2024 8:16 am

vTaskDelay below 10 ms

Postby AndreaS73 » Tue Nov 12, 2024 5:27 pm

In my ESP32-S3 code I noticed that in my main loop I have to add `vTaskDelay(1)` otherwise I get a wdt reset.
I guess this is because if I don't suspend for a while my thread, the others cannot run.

Since `CONFIG_FREERTOS_HZ` is defined as 100, a delay of just 1 tick is 10 ms, too much!
Is there a way to suspend a task for less than a tick?
What may happen if I change that value to 1000? I mean, something bad can happen like UART or other timing-critical stuff?

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

Re: vTaskDelay below 10 ms

Postby ESP_Sprite » Tue Nov 12, 2024 11:55 pm

Mostly, the overhead of FreeRTOS is increased as its task switching code is called 10x more often. You're probably better off solving whatever issue you have in another way, though; isn't there a peripheral that can do what you want without involving the CPU too much?

MicroController
Posts: 1733
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: vTaskDelay below 10 ms

Postby MicroController » Wed Nov 13, 2024 8:00 am

Or, generally, try to use blocking function calls (mostly those whith a TickType_t maxwait parameter); and possibly create multiple tasks which can each handle different things and which block 'concurrently'.

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: vTaskDelay below 10 ms

Postby DrMickeyLauer » Wed Nov 13, 2024 1:02 pm

This might be interesting for you: https://github.com/mickeyl/esp-microsleep

Who is online

Users browsing this forum: No registered users and 60 guests