Use following drop-down to just to section:
Checking out the hardware device:
To find port(s): <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-cyan-blue-color">ls -l /dev/cu.*|grep SLAB</mark> crw-rw-rw- 1 root wheel 18, 5 Aug 29 10:27 /dev/cu.SLAB_USBtoUART esptool read-mac ~ Will try to read all available ports esptool --port /dev/cu.SLAB_USBtoUART read-mac ~ Read specific port esptool --chip esp32 --port /dev/cu.SLAB_USBtoUART read-mac ~ Same but with chip type ---------------------------------------------------------------------------------------------------- <strong><em>If you pass the <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">wrong</mark> chip type:</em></strong> esptool --chip esp32c3 --port /dev/cu.SLAB_USBtoUART read-mac esptool v5.0.2 Serial port /dev/cu.SLAB_USBtoUART: Connecting...................... <mark style="background-color:#ffffff" class="has-inline-color has-vivid-red-color">A fatal error occurred: This chip is ESP32, not ESP32-C3. Wrong chip argument?</mark>
<strong>esptool --port /dev/cu.SLAB_USBtoUART read-mac</strong> esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. MAC: 6c:c8:40:4e:16:a4 Hard resetting via RTS pin...
What that means per Google AI:
The
esptool read-maccommand outputs information about the ESP32 chip and retrieves its unique MAC address. This information is retrieved by communicating with the ROM bootloader on the chip via a serial port.Output breakdown
Here is a breakdown of the specific output you provided:
esptool v5.0.2: This indicates the version of theesptoolutility being used.Connected to ESP32 on /dev/cu.SLAB_USBtoUART: The tool successfully connected to an ESP32 board.
/dev/cu.SLAB_USBtoUARTis the serial port on macOS, indicating the USB-to-UART bridge that facilitates communication with the chip.Chip type: ESP32-D0WD-V3 (revision v3.1): The tool correctly identified the specific model and revision of the ESP32 chip.Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None: The tool read the chip’s features from its internal eFuses.
Wi-Fi, BT: The chip has both Wi-Fi and Bluetooth capabilities.Dual Core + LP Core: It has two main processor cores and a low-power (LP) core.240MHz: The CPU runs at a speed of 240 MHz.Vref calibration in eFuse: The voltage reference for the ADC is calibrated and stored in the chip’s eFuses.Crystal frequency: 40MHz: The tool detected that the ESP32 is using a 40 MHz crystal oscillator.MAC: 6c:c8:40:4e:16:a4: This is the crucial output from theread_maccommand. It is the unique, factory-assigned MAC address for your device’s Wi-Fi Station interface.Stub flasher running: Theesptoolhas successfully uploaded and is running a small piece of code (the “stub”) in the chip’s RAM to perform the requested operation.MAC: 6c:c8:40:4e:16:a4: The MAC address is displayed again.Hard resetting via RTS pin...: After completing the requested action, the tool sends a signal via the RTS (Request To Send) pin to reset the ESP32, allowing it to exit the bootloader and start running its normal firmware.
Getting flash-id
<strong>esptool --port /dev/cu.SLAB_USBtoUART flash-id</strong> esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Flash Memory Information: ========================= Manufacturer: 5e Device: 4016 Detected flash size: 4MB Flash voltage set by a strapping pin: 3.3V Hard resetting via RTS pin...
esptool read-flash vs esptool dump-mem?
esptool read_flashandesptool dump_memdiffer in which type of memory they target.read_flashaccesses non-volatile flash memory, which is where your firmware and data are stored permanently.dump_mem, by contrast, targets the volatile RAM (Random Access Memory).
Aspect esptool read_flashesptool dump_memMemory type Flash Memory (SPI Flash): The large, non-volatile storage where firmware and data partitions are permanently stored. RAM (SRAM): The small, volatile memory that holds program instructions and data while the chip is powered on. Purpose To back up firmware or data. Use it to create a full or partial image of the chip’s flash contents for storage or later flashing. To debug a running program. Use it to inspect the state of a program by dumping a specific region of RAM. Memory address Addresses are physical flash offsets, starting from 0x0. For example,read_flash 0x0 0x400000reads the first 4MB of the flash chip.Addresses are CPU memory addresses, such as those in instruction or data RAM. For example, dump_mem 0x40000000 64kdumps the ROM on an ESP8266.Memory mapping Does not use the flash cache’s memory-mapped addresses. It directly reads the physical memory of the SPI flash chip via the bootloader. Dumps memory at the address space provided. For reading cached flash data as if it were RAM, you would first need to translate the virtual memory-mapped address to the physical flash offset. When to use each command
- Use
esptool read_flashwhen you need to create a complete backup of the firmware on your ESP board. It is the command to use for disaster recovery or to duplicate a device’s current configuration.
- Example:
esptool.py --port COM3 read_flash 0 0x400000 my_firmware.binreads the first 4MB of flash and saves it to a file.- Use
esptool dump_memwhen you are debugging a program and need to see the value of a variable or check the contents of a specific data structure. You need to know the exact RAM address of the data you want to inspect.
- Example:
esptool.py --port COM3 dump_mem 0x3FFB0000 1024 my_data.binreads 1024 bytes from a specific RAM location.
Make a backup of the original firmware:
esptool --port /dev/cu.SLAB_USBtoUART read-flash 0x0 0x400000 orig-esp32-fw-backup.bin esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Configuring flash size... Read 4194304 bytes from 0x00000000 in 387.2 seconds (86.7 kbit/s) to 'orig-esp32-fw-backup.bin'. Hard resetting via RTS pin... ~/work/myESP32/esp32-devkit-v1-type-c/ [master*] ls -la orig-esp32-fw-backup.bin -rw-r--r-- 1 boomer staff 4194304 Aug 29 11:01 orig-esp32-fw-backup.bin
Get WLED
Download wled binary: * <strong>Look for the latest</strong>: currently: <a href="https://github.com/wled/WLED/releases/tag/v0.15.1">https://github.com/wled/WLED/releases/tag/v0.15.1</a> * <strong>Find matching chip</strong>: <a href="https://github.com/wled/WLED/releases/download/v0.15.1/WLED_0.15.1_ESP32.bin -o WLED_0.15.1_ESP32.bin">https://github.com/wled/WLED/releases/download/v0.15.1/WLED_0.15.1_ESP32.bin -o WLED_0.15.1_ESP32.bin</a> ------------------------------------------------------------------------------------------- use <strong>curl:</strong> curl -L https://github.com/wled/WLED/releases/download/v0.15.1/WLED_0.15.1_ESP32.bin -o WLED_0.15.1_ESP32.bin <strong>verfiy:</strong> ls -l WLED_0.15.1_ESP32.bin -rw-r--r-- 1 boomer staff 1354976 Aug 29 11:18 WLED_0.15.1_ESP32.bin wget -dc https://github.com/wled/WLED/releases/download/v0.15.1/WLED_0.15.1_ESP32.bin -connect-timeout=10 shasum -a 256 WLED_0.15.1_ESP32-curl.bin af5d7ed5ac1497e71299df94170b79691b8758d9532784e001b78ac28314551d WLED_0.15.1_ESP32-curl.bin ------------------------------------------------------------------------------------------- <strong>use wget:</strong> wget -dc https://github.com/wled/WLED/releases/download/v0.15.1/WLED_0.15.1_ESP32.bin <strong>verify:</strong> <strong>shasum -a 256 WLED_0.15.1_ESP32-wget.bin</strong> af5d7ed5ac1497e71299df94170b79691b8758d9532784e001b78ac28314551d WLED_0.15.1_ESP32-wget.bin
Get WLED boot loader:
wget -dc https://github.com/Aircoookie/WLED/releases/download/v0.13.1/esp32_bootloader_v4.bin ls -l esp32_bootloader_v4.bin -rw-r--r-- 1 boomer staff 65535 Mar 14 2022 esp32_bootloader_v4.binLoad boot-loader to device:
esptool --port /dev/cu.SLAB_USBtoUART write-flash 0x0 ./esp32_bootloader_v4.bin esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Configuring flash size... Flash will be erased from 0x00000000 to 0x0000ffff... Wrote 65536 bytes (15901 compressed) at 0x00000000 in 1.6 seconds (318.3 kbit/s). Hash of data verified.Load WLED to device:
esptool --port /dev/cu.SLAB_USBtoUART write-flash 0x10000 ./WLED_0.15.1_ESP32-wget.bin esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Configuring flash size... Flash will be erased from 0x00010000 to 0x0015afff... Wrote 1354976 bytes (900724 compressed) at 0x00010000 in 81.5 seconds (132.9 kbit/s). Hash of data verified. Hard resetting via RTS pin...Make a backup of working WLED hardware:
( to include boot loader and WLED firmware)esptool --port /dev/cu.SLAB_USBtoUART read-flash 0x0 ALL full-backup.bin esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Detected flash size: 4MB Configuring flash size... Read 4194304 bytes from 0x00000000 in 387.2 seconds (86.7 kbit/s) to 'full-backup.bin'. Hard resetting via RTS pin...<strong><em>esptool --port /dev/cu.SLAB_USBtoUART read-flash 0x0 0x400000 wled-esp32-fw-backup-6cc8404e16a4.bin</em></strong> esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Configuring flash size... Reading from 0x001c2000 [============> ] 43.9% 1843200/4194304 bytes... Hard resetting via RTS pin... <mark style="background-color:#ffffff" class="has-inline-color has-vivid-red-color">A fatal error occurred: Corrupt data, expected 0x1000 bytes but received 0x10 bytes.</mark> ** I tried reducing the speed: esptool --port /dev/cu.SLAB_USBtoUART <mark style="background-color:#ffffff" class="has-inline-color has-vivid-cyan-blue-color">--baud 115200</mark> read-flash 0x0 0x400000 wled-esp32-fw-backup-6cc8404e16a4.bin esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Configuring flash size... Reading from 0x000a2000 [===> ] 15.8% 663552/4194304 bytes... Hard resetting via RTS pin... <mark style="background-color:#ffffff" class="has-inline-color has-vivid-red-color">A fatal error occurred: Corrupt data, expected 0x1000 bytes but received 0x10 bytes.</mark> ** I then tried to match the address space from the firmware write: <code><kbd><em><strong>Flash will be erased from 0x00010000 to 0x0015afff...</strong></em></kbd>esptool --port /dev/cu.SLAB_USBtoUART --baud 115200 read-flash 0x0 0x0015afff wled-esp32-fw-backup-6cc8404e16a4.bin esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Configuring flash size... Read 1421311 bytes from 0x00000000 in 132.3 seconds (85.9 kbit/s) to 'wled-esp32-fw-backup-6cc8404e16a4.bin'. Hard resetting via RTS pin...Test Erase/Reload of full backup
esptool --port /dev/cu.SLAB_USBtoUART erase-flash esptool --port /dev/cu.SLAB_USBtoUART --baud 921600 write-flash 0x0 full-backup.bin ------------------------------------------------------------------------------------- <strong><em>esptool --port /dev/cu.SLAB_USBtoUART erase_flash</em></strong> Warning: Deprecated: Command 'erase_flash' is deprecated. Use 'erase-flash' instead. esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Flash memory erased successfully in 3.0 seconds. Hard resetting via RTS pin... <strong>** LOAD "boot loader" & "WLED firmware" **</strong> <strong><em>esptool --port /dev/cu.SLAB_USBtoUART --baud 921600 write-flash 0x0 full-backup.bin</em></strong> esptool v5.0.2 Connected to ESP32 on /dev/cu.SLAB_USBtoUART: Chip type: ESP32-D0WD-V3 (revision v3.1) Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None Crystal frequency: 40MHz MAC: 6c:c8:40:4e:16:a4 Stub flasher running. Changing baud rate to 921600... Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x003fffff... Wrote 4194304 bytes (1413855 compressed) at 0x00000000 in 25.3 seconds (1327.8 kbit/s). Hash of data verified. Hard resetting via RTS pin...
