Esp32 Ulp Coprocessor
The ultra-low-power (ULP) coprocessor is a second, deliberately tiny and simple processor core living inside the RTC power domain specifically so the chip can keep checking a sensor during deep sleep without waking the main CPU — and the entire design rationale is that waking the main core costs orders of magnitude more energy than the sensor check itself. The main CPU core, caches, and bus fabric take real time and real current to power back up and resume execution from deep sleep; for a task as simple as "read this ADC value and compare it to a threshold," paying that full wake-up cost every time is wasteful — the ULP coprocessor exists to do exactly that class of trivial, repetitive check while everything else on the die stays powered off.
The ULP's instruction set and memory are deliberately minimal — a few hundred bytes of program memory and a small instruction set rather than anything resembling the main core's capability — because adding more capability would mean adding more silicon that has to stay powered in the RTC domain, directly undermining the microamp-scale budget the whole mechanism exists to protect. A more powerful coprocessor could run more sophisticated sensor-fusion logic without waking the main CPU, but every added gate in the always-on domain draws leakage current continuously, every hour of every day the product is deployed — the ULP's minimalism isn't a missed opportunity for more features, it's the direct consequence of the same power-budget discipline that makes deep sleep worth anything in the first place.
The ULP's program has to be written and debugged almost like embedded assembly on a much older, simpler processor, because its minimal instruction set doesn't support the abstractions a developer writing the main application firmware takes for granted. A main-core application developer works in C with a full RTOS, standard libraries, and debugging tools; ULP programs are typically written in a restricted assembly or a heavily limited C subset, with no OS, no dynamic memory, and often no direct debugger access during execution — which means the threshold-check logic running during every deep-sleep interval has to be validated far more carefully up front than main-core code, since there's no equivalent of attaching a debugger to catch a mistake once the product has shipped and is running unattended in the field.
Choosing what logic belongs on the ULP versus what has to wait for a main-CPU wake is itself a product-level design decision, not a fixed hardware boundary — and getting it wrong in either direction costs something real. Pushing too much complexity onto the ULP risks exceeding its tiny program-memory budget or introducing bugs that are hard to catch given its limited debug visibility; pushing too little onto the ULP means waking the full system for checks simple enough that the ULP could have handled them alone, burning exactly the deep-sleep power budget the mechanism exists to protect — the right split is usually "anything that's a simple threshold or pattern check stays on the ULP; anything that needs real computation, networking, or complex logic triggers a full wake," and that line has to be drawn deliberately for each product rather than assumed.
The ULP coprocessor is what turns "deep sleep" from an all-or-nothing state into something a battery-powered sensor product can actually use productively: a deliberately minimal always-on core that keeps watching a sensor at microamp-scale cost, waking the full, far more power-hungry main system only on the specific occasions that condition is actually met.