aioscilloscope / Learn / An ESP32's boot message

Decode an ESP32's boot message with an oscilloscope, no firmware needed

Every ESP32 talks the moment it resets. Before any program runs, the code built into the chip (its ROM) prints a few lines on its serial port at 115,200 baud: when its ROM was made, why the chip reset, how it is booting. There is nothing to program, and the EN button repeats it as often as you like. It is the easiest real serial signal there is to practise on.

An ESP32's ROM boot message, captured after a press of EN and decoded at 115,200 baud: no program on the chip involved.

CH1Which pin

The ROM prints on UART0. Its TX pin by chip, from Espressif's ESP-IDF (the pin definitions for each chip):

ChipUART0 TX
ESP32GPIO1
ESP32-S2GPIO43
ESP32-S3GPIO43
ESP32-C3GPIO21
ESP32-C6GPIO16

On a dev board the same pin also goes to the USB-to-serial chip, which is how a serial monitor on your PC sees it; the probe and the PC can listen at the same time. The signal is 3.3 V logic, idling high.

CH2Step by step

  1. Find UART0's TX pin. On a classic ESP32 it is GPIO1, on an ESP32-S2 or S3 GPIO43, on a C3 GPIO21, on a C6 GPIO16. Dev boards usually mark it TX, TX0 or TXD0.
  2. Connect the probe. Probe tip on that pin, ground clip on any GND pin. Power the board from USB as usual: the scope only listens.
  3. Set the channel. CH1 at 1 V/div, DC coupling, probe 10×, the trace moved down so 0 to 3.3 V is on screen.
  4. Set the time base. 20 ms/div with the trigger point near the left edge: 200 ms across the screen. Memory depth 250 kpts or more, so a bit gets 10 samples or more: 115,200 × 10 × 0.2 s = 230,400 samples.
  5. Arm on the start bit. Edge trigger, source CH1, slope Falling, level 1.6 V. Press Single.
  6. Reset the chip. Press the board's EN (or RST) button once. The ROM prints its message and the scope stops on the first start bit.
  7. Decode it. Decode, B1, RS232: Tx CH1, Threshold 1.6 V, Polarity Positive, Baud 115.2kbps, Data 8 bits, Parity None, Stop Bit 1 bit, format ASCII. Stopped, the scope decodes its whole record: the event table holds the lines.

CH3What each line means

A classic ESP32's ROM message, as Espressif's documentation shows it (ESP-IDF's Flash Encryption guide, a sample boot log):

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:8452
load:0x40078000,len:13608
load:0x40080400,len:6664
entry 0x40080764

After this, the second-stage bootloader and your program print whatever they are built to print. ESP-IDF's log lines look like I (28) boot: …: the level (I for information), the milliseconds since start, and which part is speaking.

CH4Why did it reset?

The classic ESP32's reset reasons, from ESP-IDF's ROM header (the number the ROM prints is in hexadecimal):

rst:NameWhat it means
0x1POWERON_RESETPower-on reset
0x3SW_RESETSoftware reset of the digital core
0x5DEEPSLEEP_RESETWaking from deep sleep
0x7, 0x8TG0WDT_SYS_RESET, TG1WDT_SYS_RESETA watchdog timer (timer group 0 or 1) ran out: a program stopped responding
0x9RTCWDT_SYS_RESETThe RTC watchdog reset the digital core
0xcSW_CPU_RESETSoftware reset of the CPU
0xfRTCWDT_BROWN_OUT_RESETThe supply voltage was not stable (a brown-out)
0x10RTCWDT_RTC_RESETThe RTC watchdog reset the digital core and the RTC

Newer chips number and name their reasons their own way; an ESP32-S3 prints rst:0x1 (POWERON). A board that keeps resetting with a watchdog or brown-out reason is telling you something about its program or its power supply, and this message is often the only place it says so.

Change how it boots, and watch the message change

Hold the board's BOOT button (it pulls GPIO0 low), press and release EN, then release BOOT. The chip read GPIO0 low at reset, and the message says so: the boot value changes and its name becomes DOWNLOAD_BOOT(...), the mode in which it waits to be programmed. Espressif's example of that line is rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2)). Press EN alone and it boots normally again.

The same board with BOOT (GPIO0) held while EN is pressed: the boot value changes and the ROM says DOWNLOAD_BOOT.

Other strapping pins on the classic ESP32, from the same Espressif page: GPIO15 (MTDO) held low at reset silences the ROM's message; GPIO2 must be low or unconnected for download mode; GPIO12 held high selects 1.8 V for the flash, which can stop a board with 3.3 V flash from starting.

The ESP8266 and the odd 74,880 baud

The ESP32's older cousin, the ESP8266, prints its boot message at 74,880 baud, not 115,200: Espressif's documentation gives 74,880 as its boot-log rate, and says that with a 26 MHz crystal this is its power-on default. (It is also exactly 115,200 × 26 / 40.) A serial monitor at 115,200 shows a line of garbage at every reset, then readable text once the program starts at its own rate.

That makes it a good baud-rate exercise: measure one bit (1 / 74,880 = 13.4 µs) or let Auto rate measure it; NovaOS names 74,880 among the rates it compares with. The record then holds two rates, the ROM's and the program's, so measure them one part at a time (why).

If nothing sensible shows

What you seeWhy, and what to change
Nothing on the pin at resetThe wrong pin for this chip (the table above), or the ROM's message is switched off (on a classic ESP32, GPIO15 held low at reset).
It stops before the textThe line may twitch as the chip resets. Move the trigger point further left, or arm Normal and press EN twice.
Characters, but garbageWrong baud rate: 115,200 for the ESP32 family's ROM, 74,880 for the ESP8266. Turn on Auto rate to measure it.
Invalid header in the decoded textThe ROM could not read a valid bootloader from flash. Espressif lists the causes: no bootloader there, a flash wiring or power problem, flash encryption that does not match, or a strapping pin (GPIO2, GPIO12) in the wrong state.

Questions

Why does my serial monitor show garbage when the ESP resets?

The chip's ROM prints at a fixed rate, and the monitor is at another. The ESP32 family's ROM uses 115,200 baud; the ESP8266's uses 74,880. Set the monitor to that rate, or decode it on the scope.

What does rst:0x1 (POWERON_RESET) mean?

That the ESP32 started from a power-on reset. The number after rst: is the reset reason; the name beside it says what it means (the table above).

What does boot:0x13 (SPI_FAST_FLASH_BOOT) mean?

0x13 is the level of the chip's strapping pins at reset, one bit per pin; SPI_FAST_FLASH_BOOT means a normal start from flash. With the BOOT button held it reads DOWNLOAD_BOOT instead.

Do I need to program the ESP32 for this?

No. The message comes from the ROM built into the chip, before any program runs. A brand-new board prints it too.

Can I probe while the board is plugged into my PC?

Yes. The USB-to-serial chip and the probe both just listen to the TX pin. Clip the ground to the board's GND.

More to try

Every guide