adafruit / nina-fw

Firmware for u-blox NINA W102 WiFi/BT module
85 stars 43 forks source link

1.7.5 gets stuck while loading #53

Closed dhalbert closed 1 year ago

dhalbert commented 1 year ago

On MatrixPortal M4, loading 1.7.5 from release artifacts fails at 41% with esptool.py, and also fails with https://adafruit.github.io/Adafruit_WebSerial_ESPTool/. In both cases I erased the ESP32 flash beforehand.

Re-uploading 1.7.4 after erasing again works fine.

Tested with webtool at both 115200 and 921600 baud.

Other users reported similar problems here: https://forums.adafruit.com/viewtopic.php?p=980409#p980409 and in discord.

ESP Web Flasher loaded.
Connecting...
Connected successfully.
Try hard reset.
Chip type ESP32
Connected to ESP32
MAC Address: 7C:9E:BD:DC:C9:24
Uploading stub...
Running stub...
Stub is now running...
Detecting Flash Size
FlashId: 0x164020
Flash Manufacturer: 20
Flash Device: 4016
Auto-detected Flash size: 4MB
Erasing flash memory. Please wait...
Finished. Took 16515ms to erase.
Image header, Magic=0xFF, FlashMode=0xFF, FlashSizeFreq=0xFF
Writing data with filesize: 1160192
Erase size 1160192, blocks 71, block size 0x4000, offset 0x0000, encrypted no
Error: SlipReadError: Timed out waiting for packet header
To run the new firmware, please reset your device.
[Object.debug:191] Finished read loop
$ esptool.py --port /dev/ttyACM1 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.7.5.bin 
esptool.py v4.4
Serial port /dev/ttyACM1
WARNING: Pre-connection option "no_reset" was selected. Connection may fail if the chip is not in bootloader or flasher stub mode.
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: 7c:9e:bd:dc:c9:24
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x0011bfff...
Compressed 1160192 bytes to 634996...
Writing at 0x00092eea... (41 %)Traceback (most recent call last):
  File "/home/halbert/.local/bin/esptool.py", line 34, in <module>
    esptool._main()
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/__init__.py", line 1026, in _main
    main()
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/__init__.py", line 826, in main
    operation_func(esp, args)
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/cmds.py", line 556, in write_flash
    esp.flash_defl_block(block, seq, timeout=timeout)
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/loader.py", line 109, in inner
    return func(*args, **kwargs)
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/loader.py", line 991, in flash_defl_block
    self.check_command(
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/loader.py", line 407, in check_command
    val, data = self.command(op, data, chk, timeout=timeout)
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/loader.py", line 376, in command
    p = self.read()
  File "/home/halbert/.local/lib/python3.10/site-packages/esptool/loader.py", line 308, in read
    return next(self._slip_reader)
StopIteration
dhalbert commented 1 year ago

NINA-FW 1.7.5 failed to upload completely on MatrixPortal M4, PyPortal M4, etc. After experimentation, I narrowed down the problem to something involving the Adafruit SAMD Arduino USB stack. Using TinyUSB instead fixes the problem. See https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/2582. New versions of the passthrough were uploaded to https://learn.adafruit.com/upgrading-esp32-firmware/upgrade-all-in-one-esp32-airlift-firmware#upload-passthrough-code-3124109.

With the change above, 1.7.5 uploads properly with esptool.py and the Web ESPTool.