Skip to content

fix: chunk SLIP frame writes for USB CDC compatibility#16

Open
jgangemi wants to merge 1 commit intotinygo-org:mainfrom
jgangemi:jae/chunked-cdc-writes
Open

fix: chunk SLIP frame writes for USB CDC compatibility#16
jgangemi wants to merge 1 commit intotinygo-org:mainfrom
jgangemi:jae/chunked-cdc-writes

Conversation

@jgangemi
Copy link
Copy Markdown

@jgangemi jgangemi commented Apr 6, 2026

Problem

The ROM bootloader's USB CDC implementation on chips like the ESP32-S3 drops packets when large SLIP frames (1KB+) are written in a single call. This causes firmware flashes to timeout or fail partway through the upload process.

Solution

Modified sendCommand() in pkg/espflasher/protocol.go to write SLIP frames in 64-byte chunks, matching the USB CDC endpoint max packet size. This ensures the ROM bootloader's CDC driver can handle the data reliably.

Testing

Tested on ESP32-S3 (T-Dongle S3):

  • Two successful 1MB firmware flashes with zero timeouts
  • Previously failed consistently around 45-300KB into the upload

Note

This fix applies only to the ROM bootloader path. The stub loader path is unaffected.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

The ROM bootloader's CDC implementation on chips like ESP32-S3 drops
packets when large SLIP frames (1KB+) are written in a single call.
Write in 64-byte chunks to match the USB CDC endpoint max packet size.

Tested on ESP32-S3 (T-Dongle S3) — two successful 1MB firmware flashes
with zero timeouts (previously failed consistently around 45-300KB).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jgangemi jgangemi mentioned this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant