diff --git a/tools/README.md b/tools/README.md index 643f206c9..231428cb0 100644 --- a/tools/README.md +++ b/tools/README.md @@ -42,7 +42,7 @@ a different board. | `xiao_uf2_flash.sh` | XIAO nRF52840 through its UF2 drive, to a named board, verified by reading the version back | | `xiao_serial_dfu.sh` | XIAO with a text console over USB serial DFU: no drive, no mount, no root | | `ble_flash_node.sh` | BLE OTA of a node out of reach of a cable, with the checks around it (silence, services, version) | -| `ble_dfu.py` | legacy Nordic DFU over BLE for the Adafruit nRF52 bootloader (buttonless, both phases) | +| `ble_dfu.py` | legacy Nordic DFU over BLE for the Adafruit nRF52 bootloader (buttonless, both phases). An `AdaDFU` bootloader (XIAO, SenseCap Solar) gets 20 B packets from the start: the legacy DFU takes no bigger ones, and finding out mid-image is too late (the app is already erased, the XIAO then comes back as USB DFU only). Slow (~10 min for 400 kB): for repeated bench swaps use the `-ota` images and `ota_push.py` | | `build_version.py` | PlatformIO pre-script: real version and build time for `ver` | | `pio_lock.py` | library lock for PlatformIO (`platformio.lock`): `install` the locked versions before a build, `check` that nothing else resolved, `freeze` a resolution, `moved` against git | | `bl_sign_pkg.py` | DFU zip for a board with the signed (`SIGNED_FW`) Adafruit bootloader: `adafruit-nrfutil dfu genpkg --key-file` with its two Python 3 bugs on that path fixed | diff --git a/tools/ble_dfu.py b/tools/ble_dfu.py index a536aaebc..991591020 100644 --- a/tools/ble_dfu.py +++ b/tools/ble_dfu.py @@ -204,6 +204,16 @@ async def phase2_dfu(mac, fw_bin, fw_dat, chunk=None): log(f" bootloader zatím nenalezen (pokus {attempt+1})...") if not dev: raise RuntimeError("bootloader (DFU svc) nenalezen ve scanu") + # AdaDFU (XIAO, SenseCap Solar): 20 B packets from the START, not as a retry. + # The XIAO bootloader takes no mtu-3 (244 B) packets, and a singlebank DFU + # erases the application at START_DFU, so finding that out mid-image is too + # late: the retry needs a RESET, which on a XIAO ends DFU mode, and with the + # app gone the bootloader comes back as USB DFU only -- no BLE, node stuck + # until someone plugs a cable in (x4, 3. 12. 2026). The SenseCap Solar + # keeps MTU 23 anyway, so 20 B is what it always got. + if chunk is None and (dev.name or "") == "AdaDFU": + chunk = 20 + log(" AdaDFU: posílám po 20 B od začátku (velké pakety XIAO nebere)") async with BleakClient(dev, timeout=30) as c: log(" připojen k bootloaderu:", dev.address, "mtu:", getattr(c, "mtu_size", "?")) try: