Skip to content

esptool fails to write to ESP8266 with PUYA flash chip - The chip stopped responding (ESPTOOL-699) #890

Open
@wibbit

Description

@wibbit

Operating System

Fedora38

Esptool Version

esptool-4.5.1-2.fc38.noarch

Python Version

https://packages.icinga.com/epel/8/release

Chip Description

ESP8266

Device Description

Wemos D1 Mini v4

Hardware Configuration

No response

How is Esptool Run

CLI

Full Esptool Command Line that Was Run

esptool write_flash 0x0 OTGW-firmware-0.10.2+50c3ed2.ino.bin 0x200000 OTGW-firmware-0.10.2+50c3ed2.littlefs.bin

Esptool Output

otgw]$ esptool write_flash 0x0 OTGW-firmware-0.10.2+50c3ed2.ino.bin 0x200000 OTGW-firmware-0.10.2+50c3ed2.littlefs.bin
esptool.py v4.5.1
Found 2 serial ports
Serial port /dev/ttyUSB1
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 7c:87:ce:be:25:e0
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00091fff...
Flash will be erased from 0x00200000 to 0x002f9fff...
Compressed 597664 bytes to 398357...
Wrote 597664 bytes (398357 compressed) at 0x00000000 in 48.1 seconds (effective 99.4 kbit/s)...
Hash of data verified.
Compressed 1024000 bytes to 75348...
Writing at 0x0025e8e9... (40 %)Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/esptool/__init__.py", line 1032, in _main
    main()
  File "/usr/lib/python3.11/site-packages/esptool/__init__.py", line 832, in main
    operation_func(esp, args)
  File "/usr/lib/python3.11/site-packages/esptool/cmds.py", line 586, in write_flash
    esp.flash_defl_block(block, seq, timeout=timeout)
  File "/usr/lib/python3.11/site-packages/esptool/loader.py", line 131, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/esptool/loader.py", line 1030, in flash_defl_block
    self.check_command(
  File "/usr/lib/python3.11/site-packages/esptool/loader.py", line 435, in check_command
    val, data = self.command(op, data, chk, timeout=timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/esptool/loader.py", line 404, in command
    p = self.read()
        ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/esptool/loader.py", line 337, in read
    return next(self._slip_reader)
           ^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

A fatal error occurred: The chip stopped responding.

More Information

I am able to always successfully flash the ino file, however, flashing the littlefs always failed.

I tried pretty much all baud rates from 9600 up to 115200, the errors would sometimes vary, including stating an "A serial exception error occurred: Write timeout".

This was tested with 2 v4 cards, multiple USB cables, multiple ports, and multiple machines.

I eventually got this to work (100% of the time), when including the --no-compress flag to the write_flash subcommand.

I've spoken to someone who's not had an issue writing to this hardware, however, they are using esptool v2.8

Though I've got this working, there was no apparent output to suggest --no-compress could resolve the issue, and as a new user this was a very painful experience.

Posting here so that.
a) the tooling can some how be updated to address this failure scenario.
b) some one searching for the same issue, may find this bug report, and the solution that worked for me.

Other Steps to Reproduce

No response

I Have Read the Troubleshooting Guide

  • I confirm I have read the troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions