-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adds baudrate detection to S3 and C3 using LL API for all SoC #9261
Merged
Conversation
This file contains 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
…AL as Clock Source
lucasssvaz
reviewed
Feb 19, 2024
lucasssvaz
reviewed
Feb 19, 2024
P-R-O-C-H-Y
approved these changes
Feb 19, 2024
lucasssvaz
approved these changes
Feb 19, 2024
🎊 Thanks |
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.
Description of Change
Adds Baud Rate detection into V2.0.15 for the ESP32-C3 and ESP32-S3.
Those 2 SoC have a maximum resolution of 12 bits, while ESP32 and ESP32-S2 have a resolution of 20 bits.
The implication is that ESP32-S3 and ESP32-C3 can not detect any baud rate under 9600 baud.
This is because the calculation of the minimum baud = 40MHz / 4096 =~ 9600
After testing all the 3 possible Clock Source for UART, it is clear that the most precise is when using XTAL as CLK SOURCE.
Using APB or RTC do not produce good results for the C3 or S3.
In case that the calculate baud rate uses the maximum 12 bits resolution (4095), the code will issue a warning message (log_w).
This is because it may be wrong as it can be in the range of 300 to 9600 baud, but the calculation will always be 9600.
This PR shall replace #7782
This PR also fixes
void uartSetBaudRate(uart_t* uart, uint32_t baud_rate)
anduint32_t uartGetBaudRate(uart_t* uart)
for the ESP32 and ESP32-S2 when the APB Frequency is lower than 80MHz.Tests scenarios
Using the Serial example in https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/Serial/BaudRateDetect_Demo/BaudRateDetect_Demo.ino
Related links
Closes #7782