ESP32 Boot Parameters - GPIO0 and Other Strapping Pins
ESP32 Strapping Pins - Navigate Default and Download (Flash) Boot Modes with GPIO0 and Other Boot Configurations with Strapping GPIO Pins Boot Parameters.
Strapping pins play an important role in the architecture of all ESP32 microcontrollers, including the original ESP32, ESP32-S2, ESP32-S3, ESP32-C3, and ESP32-C6. Today we are going to explore the strapping pins common features and functions across different ESP32 versions. The strapping pins on ESP32 microcontrollers are usually used for:
Strapping Pin Meaning #
Strapping pins are a set of pins on the ESP32 or other microcontrollers that serve a unique purpose during the chip's startup or reset process. These pins act as configurators, allowing the chip to receive some parameters for its initial setup.
Think of a computer chip like a high-tech gadget that needs specific instructions to work properly. The "strapping pins" are essentially input points that help determine how the chip should behave when it starts or resets.
Common Strapping Features Across ESP32 Versions #
At each startup or reset, the ESP32 chip needs specific configuration parameters to determine its boot mode, voltage settings, and more. Let's take a look at the components that are shared among various ESP32 versions. These components sets a behavior of the chips at the startup and reset.
Boot Mode Selection #
ESP32 GPIO 0 is a crucial strapping pin for selecting the boot mode of various ESP32 microcontroller versions, including the original ESP32, ESP32-S2, and ESP32-S3. The state of GPIO0 during startup determines whether the microcontroller enters Download Mode or Default Mode.
Boot Mode 0 - Download Mode (ESP32 GPIO0 = 0 (LOW)):
- When GPIO0 is pulled low (connected to ground) during startup, it indicates Boot Mode 0.
- Typically, this is done by pressing and holding the “BOOT” button (if available) while resetting the ESP32.
- On newer ESP32 boards, this process is automated. They include circuitry that automatically pulls GPIO0 low when flashing firmware, eliminating the need for manual intervention. This feature, often referred to as "auto-reset" or "auto-flash," is common in modern ESP32 based development boards and simplifies the flashing process.
Boot Mode 1 - Default Mode (ESP32 GPIO0 = 1 (HIGH)):
- When GPIO0 is pulled high (connected to VCC or through a pull-up resistor) during startup, it indicates Boot Mode 1.
- Pull GPIO0 HIGH (connect it to VCC or leave it unconnected, as it has an internal pull-up resistor).
- Simply power on or reset the ESP32 without pressing the “BOOT” button.
- The ESP32 will boot normally and execute the program stored in its flash memory.
The boot modes of the ESP32 allows to set for operation and development process. Download Mode allows the ESP32 to receive new firmware, making it essential for uploading code, troubleshooting, or recovering from issues like corrupted flash memory. Traditionally, developers had to manually enable this mode by pressing the “BOOT” button during startup. However, newer development boards simplify this process with built-in circuitry that automatically puts the ESP32 into Download Mode when needed, eliminating the need for manual intervention.
In contrast, Default Mode is the ESP32’s standard operating state, where it executes the program stored in its flash memory. This is the mode used in production, ensuring the ESP32 performs its intended tasks, such as running IoT devices, controlling sensors, or serving as part of a larger system.
Voltage Selection #
Voltage selection is a another feature of ESP32 microcontrollers strapping pins configuration.
VDD_SPI Voltage
VDD_SPI Voltage is the supply voltage for SPI flash memory in ESP32 microcontrollers. It determines the voltage level needed for proper operation of SPI flash. Configurable on ESP32-S2, ESP32-S3 and ESP32-C3 by applying external pull-down or pull-up resistances.
ESP32-S2 and ESP32-S3:
- The strapping pin GPIO45 is associated with selecting the VDD_SPI voltage. The selection can be influenced by applying external pull-down or pull-up resistances to GPIO45.
ESP32-S3:
- Introduces additional controls for VDD_SPI voltage through eFuse bits. The eFuse_VDD_SPI_FORCE bit determines whether the VDD_SPI voltage is controlled by GPIO45 or specific eFuse bits. Depending on eFuse settings, the VDD_SPI voltage can be tied to 1.8V or 3.3V, providing flexibility in system configurations.
ESP32-C3:
- Similar to ESP32-S2 and ESP32-S3, ESP32-C3 features GPIO45 for VDD_SPI voltage selection. External pull-down or pull-up resistances can be applied to GPIO45 to influence the default voltage level during system reset.
VDD_SDIO Voltage
VDD_SDIO Voltage is associated with the supply voltage for the SDIO interface in ESP32-C6. This voltage is selected for the proper functioning of SDIO-connected devices, such as SD cards.
JTAG Signal Source Control #
JTAG Signal Source Control involves the configuration of the strapping pin during the early boot process. The strapping pin can be used to determine the source of JTAG signals, influencing how JTAG pins (MTDI, MTCK, MTMS, and MTDO) are utilized.
Interacts with eFuse settings such as EFUSE_DIS_PAD_JTAG, EFUSE_DIS_USB_JTAG, and EFUSE_JTAG_SEL_ENABLE.
Options:
- When GPIO15 is 0 (LOW), JTAG pins are sourced from the USB Serial/JTAG Controller.
- When GPIO15 is 1 (HIGH), JTAG pins follow the external circuit configuration.
- Various eFuse combinations control the behavior, allowing customization of JTAG signal sources.
You should be cautious with configurations to avoid unintended behavior, and the external circuit controlling GPIO15 should not be in a high-impedance state.
ROM Messages Printing #
ROM Messages Printing refers to the display of messages generated by the ROM code during the boot process. The ROM messages can be printed to different interfaces such as UART0 and USB Serial/JTAG Controller.
Options:
- Specific eFuse values, GPIO8 strapping, and other related eFuse settings manage the enabling, disabling, or customization of ROM code printing.
Configurations should align with the desired debugging or communication setup. You can choose where the ROM messages are sent by strapping pins configuration
ESP32 Strapping Pins Overview #
For easier comparison and understanding of the ESP32 strapping pins features, let's examine the strapping pins configurations for various ESP32 versions such as ESP32, ESP32-C3 strapping pins, ESP32-S3 strapping pins, and ESP32-C6 strapping pins. The table below outlines the default configurations and key features for each version:
ESP32 Version | Strapping Pins | Default Configurations | Parameters Controlled |
---|---|---|---|
ESP32 | MTDI, GPIO0, GPIO2, MTDO, GPIO5 | MTDI: Floating, GPIO0: Floating, GPIO2: Floating, MTDO: Floating, GPIO5: Floating | Boot Mode, VDD_SPI Voltage, ROM Messages Printing, JTAG Signal Source |
ESP32-S2 | GPIO0, GPIO45, GPIO46 | GPIO0: Pull-up, GPIO45: Pull-down, GPIO46: Pull-down | Boot Mode, VDD_SPI Voltage, ROM Messages Printing, JTAG Signal Source |
ESP32-S3 | GPIO0, GPIO3, GPIO45, GPIO46 | GPIO0: Pull-up, GPIO3: Floating, GPIO45: Pull-down, GPIO46: Pull-down | Boot Mode, VDD_SPI Voltage, ROM Messages Printing, JTAG Signal Source |
ESP32-C3 | GPIO2, GPIO8, GPIO9 | GPIO2: Floating, GPIO8: Floating, GPIO9: Pull-up | Boot Mode, ROM Messages Printing |
ESP32-C6 | MTMS, MTDI, GPIO8, GPIO9, GPIO15 | MTMS: Floating, MTDI: Floating, GPIO8: Floating, GPIO9: Pull-up, GPIO15: Floating | SDIO Edge Control, Boot Mode, ROM Messages Printing, JTAG Source |
Utilizing Strapping Pins Beyond Boot #
While strapping pins primarily serve as configuration parameters during the boot process, doesn't mean the pins must be left alone, apart the initial configuration.
Once the ESP32 microcontroller has successfully initialized, these pins transform into regular GPIO (General Purpose Input/Output) pins, available for user-defined functions. However, you must be careful when manipulating these pins during and immediately after the boot phase.
In an ideal scenario, avoiding the use of these pins altogether, as altering their states without proper consideration may lead to unexpected behavior, glitches, or even system malfunctions.
So which pins to avoid on ESP32 boards? #
To revise once more, let’s take a look at the strapping pins on different ESP32 versions. Strapping pins are used to set configurations such as ESP32 programming mode or specific boot behaviors.
It’s important to identify ESP32 reserved pins and avoid using them as GPIO pins, as they are required during boot-up and certain operational modes. The table below provides an overview of ESP32 programming pins, ESP32 pins to avoid, and their default configurations.
ESP32 Version | Strapping Pins |
---|---|
ESP32 | GPIO0, GPIO2, GPIO5, GPIO12 (MTDI), GPIO15 (MTDO) |
ESP32-S2 | GPIO0, GPIO45, GPIO46 |
ESP32-S3 | GPIO0, GPIO3, GPIO45, GPIO46 |
ESP32-C3 | GPIO2, GPIO8, GPIO9 |
ESP32-C6 | GPIO8, GPIO9, MTDI (GPIO12), GPIO14 (MTMS), GPIO15 |
Additional Resources #
- ESP32 Series Datasheet
- ESP32-S2 Series Datasheet
- ESP32-S3 Series Datasheet
- ESP32-C3 Series Datasheet
- ESP32-C6 Series Datasheet
Conclusion #
In conclusion, strapping pins play an important role in the initialization and configuration of various ESP32 microcontroller versions, including ESP32-S2, ESP32-S3, ESP32-C3, and ESP32-C6. These pins serve as gatekeepers, influencing critical parameters during startup or reset, such as boot mode, voltage selection, JTAG signal source, and more.
Across different ESP32 versions, certain common strapping pins persist, each with its unique functions and default configurations. GPIO0, for instance, is the most commonly used strapping pin, which is used to select the boot mode