esp32: don't cap flash baud rate once the stub loader is running - #63
Open
flrossetto wants to merge 1 commit into
Open
esp32: don't cap flash baud rate once the stub loader is running#63flrossetto wants to merge 1 commit into
flrossetto wants to merge 1 commit into
Conversation
MaxUARTFlashBaud (230400 on classic ESP32) exists because the ROM bootloader disables interrupts during flash page writes, which can overrun a USB-UART bridge's small RX FIFO. Once the stub loader is running it buffers incoming data itself and doesn't have this problem — confirmed against real esptool.py on the same board/bridge, which raises the baud rate freely once its stub is up (921600 ran clean). The cap was being applied unconditionally, silently overriding any higher FlashBaudRate even in stub mode. Also fix detectChip's ESP32-S2 fallback: it treated any readReg failure (timeout, garbled response, checksum error) as proof the chip doesn't support register reads and is therefore ESP32-S2 in secure download mode. Real esptool.py only draws that conclusion from a genuine UnsupportedCommandError NAK. On flaky UART-bridge hardware, a plain communication hiccup was enough to misdetect a real ESP32 as ESP32-S2, load the wrong stub, and fail with a confusing "erase requires stub" error instead of a clear connection error. Now only a CommandError with status 0xFF (command not implemented) triggers the ESP32-S2 fallback; anything else surfaces as a real, retryable error.
Member
|
Hello @flrossetto please see test failures. Also please see the newly added |
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.
MaxUARTFlashBaud (230400 on classic ESP32) exists because the ROM bootloader disables interrupts during flash page writes, which can overrun a USB-UART bridge's small RX FIFO. Once the stub loader is running it buffers incoming data itself and doesn't have this problem — confirmed against real esptool.py on the same board/bridge, which raises the baud rate freely once its stub is up (921600 ran clean). The cap was being applied unconditionally, silently overriding any higher FlashBaudRate even in stub mode.
Also fix detectChip's ESP32-S2 fallback: it treated any readReg failure (timeout, garbled response, checksum error) as proof the chip doesn't support register reads and is therefore ESP32-S2 in secure download mode. Real esptool.py only draws that conclusion from a genuine UnsupportedCommandError NAK. On flaky UART-bridge hardware, a plain communication hiccup was enough to misdetect a real ESP32 as ESP32-S2, load the wrong stub, and fail with a confusing "erase requires stub" error instead of a clear connection error. Now only a CommandError with status 0xFF (command not implemented) triggers the ESP32-S2 fallback; anything else surfaces as a real, retryable error.