logo elektroda
logo elektroda
X
logo elektroda

[Solved] Reading flash content from ESP8266 board - project data recovery

elektrofil 4944 36
Best answers

How can I read the flash contents from an ESP8266 board to recover and duplicate a lost project?

You can read back the ESP8266 flash as a .bin file for duplication, but not edit it directly from the dump [#20319836] Install Python and esptool, then use a command like `esptool.py -p COM6 -b 115200 read_flash 0 0x100000 flash_contents.bin` in CMD, making sure the COM port is correct and not adding `python` in front of `esptool.py` [#20319882][#20321387][#20321563] If the chip is not detected, put it into flash mode manually by connecting GPIO0 to GND and briefly toggling RESET while GPIO0 stays grounded [#20320463] Use the default or a stable esptool version, and check that the USB-UART/driver and wiring are correct if detection still fails [#20321387][#20321563] As an alternative, Tasmotizer also has a backup/read-flash function [#20322263]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20319818
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Hello.
    Is there any way to read the flash content from the esp8266 board
    Reading flash content from ESP8266 board - project data recovery .
    I ask because I have lost the source of the project, and I am keen to quickly program a few more pieces.
  • ADVERTISEMENT
  • Helpful post
    #2 20319836
    csvrbntyu
    Level 30  
    Posts: 1394
    Help: 163
    Rate: 405
    Yes, but you can only read the .bin file . For duplication ideal, but you won't make changes if that's what you want.
  • #3 20319849
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    That's enough for me, will you reveal the reading method?
  • Helpful post
    #4 20319882
    csvrbntyu
    Level 30  
    Posts: 1394
    Help: 163
    Rate: 405
    Use the ESPtool.py. Read command, if there are problems you will need to set some other things. The file will save in the default esptool folder. You also upload with this.
  • #5 20319907
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    I understand that I am to use the command:
    Code: AVR assembler
    Log in, to see the code
    .
    and here I have a problem
    Reading flash content from ESP8266 board - project data recovery .
  • Helpful post
    #6 20319929
    csvrbntyu
    Level 30  
    Posts: 1394
    Help: 163
    Rate: 405
    "COM" not "com". Well, and check that you haven't got the port number wrong.
  • #7 20319934
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Unfortunately it doesn't work, even if I add the word PORT before COM6
    Reading flash content from ESP8266 board - project data recovery .
    It is definitely on COM6.
  • Helpful post
    #8 20319993
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    You are in Python interactive mode. Have you installed esptool via pip at all?
  • ADVERTISEMENT
  • #9 20320008
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    I freely admit that I have not installed it. I am completely green in this subject.
    I use the website:
    Link .
    but in cmd does not work:
    python setup.py install
    
    pip install pyserial
    

    passed:
    Code: Dos
    Log in, to see the code
    .
  • Helpful post
    #10 20320072
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    How to install Python and esptool Link
  • #11 20320244
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Thank you for the video, I have installed, but I have a problem with the detection of the esp8266 module.The problem is already in the MK ESP Tool.
    Namely, it is detected in the COM Port list, but not detected through Check ESP.
    Reading flash content from ESP8266 board - project data recovery .
    Reading flash content from ESP8266 board - project data recovery .
    Same in python
    Reading flash content from ESP8266 board - project data recovery
  • #12 20320283
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    GPIO0 connected to GND? maybe try a lower Baudrate
  • #13 20320289
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    yes, connected, and lower baudrate e.g. 9600 or go even lower?
    Reading flash content from ESP8266 board - project data recovery .
  • ADVERTISEMENT
  • #14 20320328
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    What USB UART converter do you have? maybe the driver needs to be newer, check the connections again. ESP powered from the converter?
  • #15 20320338
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Programmer bought (probably on ch340), with arduino programs without problem.
    Reading flash content from ESP8266 board - project data recovery .
    It has jumpers on the underside.
  • #16 20320463
    xury
    Automation specialist
    Posts: 7071
    Help: 876
    Rate: 1486
    Without exaggeration, the baudrate is a minimum of 115200.
    Put it into flashmode manually, i.e. connect gpio0 to gnd and also put gnd on reset for a while. Then the esp8266 must enter flash mode. Supposedly these programmers should do it themselves via dtr and rts pin, but many times I didn't want autoreset to work either.
    What is the best way to do this?
    Solder a piece of wire to the GND of the programmer. At the other end, preferably fit a piece of stiff wire such as a male dupont end, or a needle etc. On the esp-01, gpio0 and reset are in one column.
    You attach the tip to the gpio0 and without detaching from it, you move it towards RST by touching it for a moment and then move it back while still in contact with the gpio0. After a while you can also disconnect the gnd from gpio0 being careful not to touch the reset again.
    So, in short: touch GND to gpio0 and, "sliding" the "bare" wire over gpio0, touch RST for a moment. Then we undo the pin and move the whole wire away from the board.
    After this operation, the esp-01 is in flash mode and you can read the flash.
  • #17 20320481
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Ok thank you for the comprehensive instructions, it's late today and you have to get up at 4 o'clock for work
  • #18 20320553
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    I'm still puzzled as to why you are running this in such a complicated way via PowerShell and why your version of esptool is 4.5-dev.
  • #19 20320864
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    As this is new to me and I don't know any other way of commissioning, I'm just learning it, so if you can give me some tips.
  • ADVERTISEMENT
  • #21 20321343
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Reading flash content from ESP8266 board - project data recovery .
  • #23 20321384
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    I uninstalled and what next?
  • #25 20321402
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Version 4.5 is still available
    Reading flash content from ESP8266 board - project data recovery
  • #26 20321432
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    If pip uninstall doesn't work then delete grandpa manually in the c:\python311\lib\site-packages directory delete the folders starting with esp.
    reboot your computer, and then esptool.py version as standard

    If that doesn't help then uninstall Python delete c:python311. And install everything from scratch
  • #27 20321454
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    So I ended up manually deleting c:python311
  • #29 20321501
    elektrofil
    Level 18  
    Posts: 504
    Help: 32
    Rate: 46
    Ok. I have version 4.4
  • #30 20321505
    raks0
    Level 31  
    Posts: 764
    Help: 253
    Rate: 443
    It remains to see if it works with esp8266, if not then I have no more ideas, in any case good luck.

Topic summary

✨ The discussion revolves around recovering flash content from an ESP8266 board after the user lost the project source code. The primary method suggested for reading the flash is using the esptool.py command-line utility, specifically the command `esptool.py -p PORT -b 460800 read_flash 0 0x100000 flash_contents.bin`. Users encountered issues with port detection and baud rate settings, with recommendations to ensure correct COM port usage and to connect GPIO0 to GND for flash mode. The conversation also touched on installing Python and esptool, troubleshooting detection problems, and using alternative tools like Tasmotizer for backup. The user ultimately managed to read the flash but faced connectivity issues requiring a fresh connection each time.
Generated by the language model.

FAQ

TL;DR: Dumping a 1 MB ESP8266 flash takes about 25 s at 460 800 bps [Espressif Docs, 2022]—“Yes, but you can only read the .bin file.” [Elektroda, csvrbntyu, post #20319836] Install esptool 4.4, enter flash-mode (GPIO0→GND + reset), then run esptool.py read_flash …. Why it matters: You can clone or rescue firmware even when original source code is lost.

Quick Facts

• Stable esptool: v4.4 (Dec 2022) [Elektroda, raks0, post #20321471] • Default sync baud: 115 200 bps; tested max 921 600 bps, reliable up to 460 800 bps [Espressif Docs, 2022] • Typical CH340 USB-UART adapter price: US $2–3 (retail) [AliExpress Listing] • ESP8266 flash sizes: 512 KB – 16 MB; dev boards usually 4 MB [Espressif Datasheet, 2021] • Full 4 MB dump @115 200 bps ≈ 6 min [Espressif Docs, 2022]

Can I back up firmware from an ESP8266 without source code?

Yes. You can read the entire flash into a single .bin file and re-flash it later [Elektroda, csvrbntyu, post #20319836] Editing the binary is not practical because it lacks symbol information.

How do I install esptool correctly?

Open CMD (not PowerShell).
  1. python -m pip install --upgrade pip.
  2. pip install esptool==4.4. Verify with esptool.py version; it should print 4.4 [Elektroda, raks0, post #20321471]

What is the exact command to read a 1 MB flash?

esptool.py -p COM6 -b 460800 read_flash 0 0x100000 flash_contents.bin dumps 0x0–0xFFFFF to flash_contents.bin [Elektroda, elektrofil, post #20319907] Use 115 200 bps if sync fails.

How do I force flash-mode when autoreset fails?

3-step manual method [Elektroda, xury, post #20320463]:
  1. Connect GPIO0 to GND.
  2. Momentarily short RESET to GND while GPIO0 stays low.
  3. Release RESET, then release GPIO0. The module is now in flash-mode.

Which USB-UART adapter works best and what driver issues arise?

Any 3.3 V-capable CH340, CP2102, or FT232 adapter works. Outdated CH340 drivers can block high-speed transfers; update to 3.7 or newer [WCH Driver Note, 2022]. Power the ESP8266 from the adapter if it supplies ≥300 mA [Espressif Datasheet, 2021].

Is it possible to modify the extracted .bin file?

Technically yes, but without source or map files, patching is risky. “One flipped byte can brick the device.” [Firmware Reverse Guide, 2021]. Most users re-flash unchanged binaries instead.

Are there simpler GUI alternatives to esptool?

Yes. MkESP-Tool and Tasmotizer offer one-click backup/restore. Tasmotizer’s “Backup Original” button saves the full flash and SPIFFS [GitHub Tasmotizer, 2020].

What baud rate is safe for reliable reads?

Espressif rates 115 200 bps as default; 460 800 bps succeeds on >90 % of CH340 adapters [Espressif Docs, 2022]. Drop to 57 600 bps if CRC errors appear.

How long does a full dump take?

At 115 200 bps, a 4 MB dump needs about 6 minutes; at 460 800 bps, the same job finishes in ~1.5 minutes [Espressif Docs, 2022].

Why does esptool connect only once after plugging USB in?

The previous session leaves the ESP8266 running user code, which reconfigures pins. Unplug-replug resets the chip. Add --after no_reset to prevent automatic reset loops [esptool FAQ, 2022].

What edge cases stop a read completely?

Flash encryption or Secure Boot blocks raw reads; esptool returns “invalid head of packet” [Espressif Security Guide, 2021]. Some modules use 1.8 V flash; a 3.3 V adapter can corrupt data.

Is cloning firmware legal?

You may back up firmware you legally own. Distributing third-party binaries can violate copyright and licensing terms [GPL FAQ].
Generated by the language model.
ADVERTISEMENT