Flash the Nano over WiFi through the ESP32

- ESP32: NanoFlashBridge on TCP port 2323. A connection power cycles the
  Nano into its bootloader and bridges TCP <-> Serial2 at 57600 baud; the
  clock pauses during the session, 10 s idle timeout
- tools/nano_net_upload.py: STK500v1 uploader over TCP (standard library
  only), with sync retries, write and read-back verification. avrdude 6.3
  net: ports are broken on Windows, so avrdude is not used
- New nano_ota environment: pio run -e nano_ota -t upload
- README: usage, requirements, troubleshooting; TODO for hardware test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-13 00:35:28 +02:00
1 parent 8415dee347
commit bea5b9daa1
10 files changed
+438 -7

No files matched your search

+8
View File
@@ -16,6 +16,14 @@ See README.md for the overview.
or `$env:USERPROFILE\.platformio\penv\Scripts\pio.exe run` (PowerShell).
- If an ESP32 build fails with `No module named 'intelhex'`, run
`~/.platformio/penv/Scripts/python.exe -m pip install intelhex`.
- `nano_ota` flashes the Nano over WiFi: `tools/nano_net_upload.py` (STK500v1 over TCP)
talks to `NanoFlashBridge` on the ESP32 (port 2323), which power cycles the Nano into
its old bootloader (57600 baud) and passes the bytes through. avrdude 6.3's `net:` port is
broken on Windows (`ser_drain()` fails), which is why the uploader is a Python script.
The uploader only uses the Python standard library. Test it against a simulated
bootloader before changing it.
- `src/esp32/libs.h` defines globals in the header, so it can only be included from
`main.cpp`. New ESP32 modules must be self-contained (see `nano_flash_bridge.*`).
- After any change, build both targets (`pio run`). After Nano changes, also run
`pio test -e native`.