feat(uart): [IDF5.1] fixes HardwareSerial::updateBaudRate() using a baud rate higher 230400 - checks UART Clock Source #10642
+6
−1
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.
EXCLUSIVE FOR IDF 5.1 - Arduino Core 3.0.x
Description of Change
ESP32 and ESP32S2 use REF_TICK as UART clock source whenever the baud rate is lower then 250,000.
This is done within
HardwareSerial::begin(uint32_t baud)
This prevents issues with chaning the APB clock to lower than 40MHz, specially when achieving lower power consumpition.
This PR also fixes it for the
HardwareSerial::updateBaudRate(uint32_t baud)
by checking the target baud rate and adjusting the UART Clock Source that will make it work correctly.Tests scenarios
Using this sketch (from the issue report) using ESP32 and ESP32S2
Related links
Closes #10641