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:
What Are Strapping Pins? #
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 #
GPIO0 is a critical strapping pin in various ESP32 microcontroller versions, such as original ESP32 Series, ESP32-S2 and ESP32-S3, which influences the boot mode.
Boot Mode 0 - Download Mode (GPIO0 = 0 (LOW)):
- When GPIO0 is pulled low (connected to ground) during startup, it indicates Boot Mode 0.
- The ESP32 enters Download Mode, allowing it to receive new firmware via flashing tools.
Boot Mode 1 - Default Mode (GPIO0 = 1 (HIGH)):
- When GPIO0 is pulled high (connected to VCC or through a pull-up resistor) during startup, it indicates Boot Mode 1.
- The ESP32 enters the default normal operating mode, where it executes the program stored in the flash memory.
If you're using a development board, it usually comes with a button tied to GPIO0, allowing you to easily switch between normal and programming modes.
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, let's take a look at the different ESP32 version's strapping pins features and the ESP32 Strapping Pins Default Configuration in a table:
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, lets take a look at the strapping pins on different ESP32 versions, and remember to avoid them using as GPIO pins.
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