fix: chunk SLIP frame writes for USB CDC compatibility#16
Open
jgangemi wants to merge 1 commit intotinygo-org:mainfrom
Open
fix: chunk SLIP frame writes for USB CDC compatibility#16jgangemi wants to merge 1 commit intotinygo-org:mainfrom
jgangemi wants to merge 1 commit intotinygo-org:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()inpkg/espflasher/protocol.goto 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):
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