wizzdev image

Hey ESP32! Wake up!

As we all know, one of the main strengths of ESP32 is the ability to go to deep sleep. In this mode CPUs, most of the RAM, and all the digital peripherals which are clocked from APB_CLK (Advanced Peripheral Bus Clock) are powered off. During deep sleep, the chip can still power RTC (Real-Time Clock) peripherals, including ULP (Ultra Low Power) coprocessor, RTC controller, and RTC memories (both fast and slow). If you use deep sleep properly, you can gain a powerful tool to reduce your power consumption, which is one of the main points of our internal project. But how to wake up the controller and how to take advantage of some of the wake up reasons?

There are several ways to wake up ESP32 from a deep sleep. The most popular is a Timer wake up, which uses a timer built-in RTC controller and doesn’t require RTC peripherals or RTC memories to be powered during sleep. This source is very useful to wake up the chip after a predefined amount of time, for example, to sample data from the sensors or check if the connection can be now established if it failed a while ago.

Another very popular wake-up mode is Touchpad mode, which uses the RTC IO module that contains logic that triggers wake up when a touch sensor interrupt occurs. Configuring the touchpad interrupt before the chip starts deep sleep is necessary for this to work. We found this source very useful in changing the operating mode of our chip, for example, from normal operating mode to WiFi Access Point mode.

External wakeup (ext0) is another wake-up reason that can be used. This mode is also using the RTC IO module, but this time logic triggers wake-up when one of RTC GPIOs is set to a predefined logic level. Unfortunately, the RTC IO module is a part of the RTC peripherals power domain, which means that the RTC peripherals will be kept powered on during deep sleep if this wake-up source is requested. This means that this is not a power-efficient solution to wake up your device and should be avoided if you think about minimizing power consumption.

External wakeup (ext1) is very similar to the previous one. It uses the RTC controller, but multiple RTC GPIOs trigger it. In this mode, RTC peripherals and RTC memories can be powered down, but if RTC peripherals are down, then internal pullup and pulldown resistors will also be disabled. If you want to use internal pullup or pulldown resistors, you need to request RTC peripherals power domain to be kept on during deep sleep and configure specific GPIOs of pullup or pulldown resistors. This mode is beneficial if you want to allow the user to control the chip, but for some reason, you can’t use Touchpad mode. 

The last way to wake-up your device is to use Ultra Low Power (ULP) Coprocessor wakeup. This coprocessor may be used to monitor ADC, sample sensors, and, what we are looking for, wake-up chip when a specific event is detected. This is possible because it can run while the chip is in a deep sleep mode and it runs the program stored in RTC slow memory. This is a strong tool that can be used in various ways, for example, triggering an action when sampled data is over a predefined threshold. 

You can find API Reference on the Espressif Systems website, which describes all the necessary functions to set up the mentioned above wake-up reasons.

 

Recent entries

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.