NabuCasa / esp-web-flasher

A web serial package for updating your ESP bootloader via the browser.
https://nabucasa.github.io/esp-web-flasher/
MIT License
43 stars 16 forks source link

ESP32-C3 bootloop when using ESP Web Tools #136

Closed brentru closed 2 years ago

brentru commented 2 years ago

Flashing an ESP32-C3 (Adafruit QT Py ESP32-C3) with the web flasher results in a bootloop:

...
17:44:04.903 -> ESP-ROM:esp32c3-api1-20210207
17:44:04.903 -> Build:Feb  7 2021
17:44:04.903 -> rst:0x3 (RTC_SW_SYS_RST),boot:0xf (SPI_FAST_FLASH_BOOT)
17:44:04.903 -> Saved PC:0x403d0f62
17:44:04.903 -> SPIWP:0xee
17:44:04.903 -> mode:DIO, clock div:1
17:44:04.941 -> load:0x3fcd6100,len:0x438
17:44:04.941 -> load:0x403ce000,len:0x90c
17:44:04.941 -> load:0x403d0000,len:0x2358
17:44:04.941 -> entry 0x403ce000
...

The offsets used by the Web Uploader are the following (and correspond to https://github.com/adafruit/Adafruit_Wippersnapper_Arduino/releases/download/1.0.0-beta.39/wippersnapper.qtpy_esp32c3.littlefs.1.0.0-beta.39.zip):

          "0xe000": "wippersnapper.qtpy_esp32c3.littlefs.VERSION.boot_app0.bin",
          "0x0": "wippersnapper.qtpy_esp32c3.littlefs.VERSION.bootloader.bin",
          "0x10000": "wippersnapper.qtpy_esp32c3.littlefs.VERSION.bin",
          "0x8000": "wippersnapper.qtpy_esp32c3.littlefs.VERSION.partitions.bin"

The same bootloop appears when using the Wippersnapper firmware uploader tool (https://adafruit.github.io/WipperSnapper_Firmware_Uploader/) and also by manually uploading each file to the Esp-Web-Flasher and using the offsets (below).

What Works:

Similar to https://github.com/esphome/esp-web-tools/issues/260 cc @balloob and @makermelissa

makermelissa commented 2 years ago

It looks like #23 had added functionality, which was removed again in #86. This patching functionality appears to be necessary for the just C3 and only when using multiple files. I think a good initial fix is to not patch it by default (like it is now) unless certain parameters are specified such as dio mode and 40m for the speed. We could have drop downs on the web interface to specify that we want these. I think giving the option but not requiring it would be best for flexibility. I'm working on this locally and if it seems to fix it, I'll submit a PR.