Add high-speed UART baud rate switching#13
Merged
Conversation
New CMD_SET_BAUD command lets host negotiate higher baud rates after agent boot. Agent ACKs at current baud, both sides switch, host verifies with INFO at new baud. Falls back on failure. Tested on real hi3516ev300 with FTDI FT232R: - 230400: 22.6 KB/s (98.3% efficiency) - 460800: 44.9 KB/s (97.4% efficiency) - 921600: 83.2 KB/s (90.3% efficiency) 16MB flash dump: ~3.4 min at 921600 vs 24.5 min at 115200 (7.3x faster). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After switching baud, agent waits 3s for a valid command at the new rate. If nothing arrives (host failed to switch, or link doesn't support the rate), agent reverts to 115200 automatically. Tested: send SET_BAUD 460800 but keep host at 115200 — agent reverts after 3s timeout, host communicates normally at 115200. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Client auto-switches to 921600 baud for transfers >4KB, stays there for subsequent operations (no switching between read/write bauds). Agent reverts to 115200 after ~10s of no valid commands at high baud, so disconnected hosts can always reconnect at the default rate. Tested on hi3516ev300: auto-baud read 72 KB/s, idle fallback after 12s disconnect, reconnect at 115200 confirmed. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
Dynamic baud rate switching for the flash agent. Start at 115200 (bootrom default), negotiate up to 921600 after agent boot.
CMD_SET_BAUD(0x08): host sends desired baud rate, agent ACKs at current baud, both switchuart_set_baud(): reconfigures PL011 IBRD/FBRD with proper TX drain and latch sequenceFlashAgentClient.set_baud(): switches with automatic fallback on verification failureBenchmark (real hi3516ev300, FTDI FT232R, 64KB READ)
Test plan
🤖 Generated with Claude Code