esp32/machine_uart: Change sendbreak()
implementation to simply pull the pin low for the break period
#17698
+22
−31
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
Currently,
UART.sendbreak()
on esp32 will reconfigure the UART to a slower baudrate and send out a null byte, to synthesise a break condition. That's not great because it changes the baudrate of the RX path as well, which could miss incoming bytes while sending the break.This PR changes the sendbreak implementation to just reconfigure the TX pin as GPIO in output mode, and hold the pin low for the required duration.
Testing
Existing test is updated (simplified) and works well on ESP32_GENERIC.
Also tested that RPI_PICO_W still passes this test.
Trade-offs and Alternatives
There's
uart_write_bytes_with_break()
but that requires at least 1 byte to be sent before the break, so we can't use that.There's also the lower level
uart_hal_tx_break()
but I'm not sure how to use that properly in conjunction with the higher level driver.