Freertos global variables (newbie)

Greetings from Raining Greece. Guess what.. Here I am again after some days playing with a code and FreeRTOS

If we were living in the same continent ti would be KY pleasure... Maybe I can :beer: online :wink:

So my first conclusions are that I must use often the "vTaskDelay"

In one occasion the cpu was running so fast that couldnt switch on one Relay via Gpio pin = High
After setting it high and with additional of the delay worked

Annother conclusion is that if I don't use the vTaskDelay command in the Tasks I am getting an error for watchdog time and the cpu reboots

So the use of the vTaskDelay is mandatory I guess to leave time to check all the tasks when have the same level priority.

I read that the vTaskDelay(); counts on ticks and the vTaskDelay(ms / portTTICK_PERIOD_MS) ; measure time in ms (converting them to ticks obviously)

So what is the best method to use?

vTaskDelay(1);
vTaskDelay(10 / portTTICK_PERIOD_MS) ;

Then I guess that you pinned your task to core 0, what's not a good idea. Also you are polling all the time, what also is not a good idea in a real time OS. Can you show some code snippets where you needed vTaskDelay()?

I prefer using delay() with ms time and which translates into vTaskDelay() on the ESP32.

That's correct you need to work out the time it takes the relay to react and account for that in the delay

if it reboots you're doing something wrong
maybe something like putting a task into suspend while releasing it from suspend.]
that would cause a crash

just play with the first one first
then later you can play with the second one

You can find a good read on the use of vTaskDelay on this thread
we have dealt with this subject in massive depth

https://forum.arduino.cc/t/esp32-getting-to-the-core-of-the-task/1161303/1

you will find lots of answers and experiments there