esptool read_flash fails with too-short read

banjoluck
Posts: 25
Joined: Fri Jul 29, 2022 5:11 pm

esptool read_flash fails with too-short read

Postby banjoluck » Tue Apr 25, 2023 1:48 am

Using esptool 4.5.1 on MacOS, I get something like the following message from three different modules when I attempt to read flash:

( /opt/homebrew/bin/esptool.py --chip auto --port /dev/tty.usbserial-DU0CLKHM --baud 460800 \
read_flash 0x9000 0x6000 nvs.bin )
esptool.py v4.5.1
Serial port /dev/tty.usbserial-DU0CLKHM
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: c0:49:ef:eb:9c:28
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.

A fatal error occurred: Corrupt data, expected 0x1000 bytes but received 0xf6c bytes
gmake: *** [Makefile:153: nvs] Error 2

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: esptool read_flash fails with too-short read

Postby ESP_Sprite » Tue Apr 25, 2023 3:28 am

Your baud rate may be too fast. Try a slower baud rate.

banjoluck
Posts: 25
Joined: Fri Jul 29, 2022 5:11 pm

Re: esptool read_flash fails with too-short read

Postby banjoluck » Tue Apr 25, 2023 4:54 pm

That was the issue. Setting the baudrate to 230400 works.

The espressif documentation has this as an explicit example:

Code: Select all

esptool.py -p PORT -b 460800 read_flash 0 0x200000 flash_contents.bin
See https://docs.espressif.com/projects/esp ... read-flash.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: esptool read_flash fails with too-short read

Postby ESP_Sprite » Wed Apr 26, 2023 1:41 am

Yeah, the max baud rate you can use depends on the setup (usb-serial chip, connection wires etc). On a devboard, that baudrate probably works fine, but on unknown hardware, all bets are off.

Who is online

Users browsing this forum: No registered users and 5 guests