Blog
ESP32 Under the Hood: FreeRTOS, Watchdogs, and Both Cores
You can use an ESP32 for years without caring about its internals. Then a watchdog reset happens, or a “core -1” shows up in the task list, and these are the questions that follow.
Is the ESP32 Running FreeRTOS in Arduino?
Yes, and most people don’t notice. The Arduino core for ESP32 sits on top of FreeRTOS: your loop() and setup() run inside a FreeRTOS task, the scheduler always running underneath. That’s why delays behave differently than on a bare AVR. So yes — you’re already writing FreeRTOS programs without FreeRTOS-looking code.
Do I need to learn FreeRTOS to use ESP32?
No. The Arduino layer hides it well enough for most projects. Two concepts are worth stealing anyway: tasks (run two loops at once) and queues (pass data without globals). Everything else, learn the day you need it — for most hobbyists, that day never comes.
Does the ESP32 Have a Watchdog Timer Running in Arduino?
Two of them, always on: a task watchdog (TWDT) that checks tasks are still yielding, and a reset watchdog that reboots the chip if everything locks up. Each protected task must “feed” the watchdog before its timeout, or the board resets with a watchdog message. Arduino feeds it for you in loop() — which is why a tight while-loop with no delay() triggers the reset. It’s protection, not punishment, though it doesn’t feel that way at 2am.
How to Leverage Both Cores of ESP32 in Arduino?
xTaskCreatePinnedToCore() pins a task to core 0 or 1. loop() defaults to core 1; core 0 runs Wi-Fi and system stuff — so pin heavy processing to core 1 and leave core 0 alone. For how to leverage both cores of esp32 in arduino: split independent work (sensors, display) into two tasks and share data with queues, not bare globals. It works until two tasks fight over one resource.
Can ESP32 Do Floating Point?
Yes — the chip has a hardware FPU, so float math is native, not software-emulated like on an AVR. The gotcha: floats inside an ISR still hurt, and FPU registers add context-switch overhead, so hot float loops aren’t free. Fast, yes; free, no.
What Does ESP32 vTaskList Core -1 Mean?
That line appears when you print the FreeRTOS task table. “Core -1” marks tasks not pinned to either core — the scheduler can run them anywhere. Not an error; most tasks show -1 unless explicitly pinned. If you expected a pinned task to show its core and it says -1, your pin didn’t take.
How to Use FreeRTOS Timers with ESP32 Arduino?
Software timers fire a callback once or repeatedly from a timer task — handy for periodic work that shouldn’t block anything. For how to use freertos timers with esp32 arduino: create with xTimerCreate(), start with xTimerStart(), keep the callback short. The trap: callbacks can’t block or call delay(). People discover that one the hard way.
How to Suspend the Default Task on ESP32 Arduino?
The default task is the one running your loop(). Suspend it with vTaskSuspend(NULL) — but suspending loop() also stops Arduino background chores that libraries expect to breathe. “Pause my logic” is safer with a flag; saving power is a deep-sleep question, not a suspend question.
How many tasks can an ESP32 run?
Technically dozens; practically, as many as RAM allows — each task reserves its own stack, and 4–8KB per task disappears fast from ~320KB usable. More than ten concurrent tasks is a design smell. Stack overflow symptoms: random crashes, corrupted data, watchdog resets — the debugging FAQ covers that.
How do the two ESP32 cores share memory?
Both cores see the same RAM and flash — that’s the easy part. The hard part: “shared” means race conditions. Two cores writing one variable, no locks, silent corruption. Mutexes and queues exist for exactly this. The core 0/1 split is about scheduling, not memory ownership — and it’s the same machinery our long-range sensor node build leans on.
Meet the Cores Personally
Architecture posts describe; simulators let you eavesdrop. Run the same blink on classic, C3 and S3 — each greets you by name on the Serial Monitor. The watchdog and scheduler behavior this FAQ explains lives one layer below what you will watch, but the chip identity is right there in the banner.