-
Notifications
You must be signed in to change notification settings - Fork 7.6k
feat(uart): fixes pin attach for any IDF 5.x #11499
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
base: master
Are you sure you want to change the base?
Conversation
👋 Hello SuGlider, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
@Jason2866 @me-no-dev - Definitive FIX for the IDF 5.4 commit. |
Test Results 76 files 76 suites 12m 52s ⏱️ Results for commit 2e7bae9. ♻️ This comment has been updated with latest results. |
This PR works with IDF 5.3, 5.4 and 5.5. It shall also work with IDF 6.x in a future release. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@SuGlider Tested with actual IDF 5.4 and IDF 5.5. Serial is working again. Good work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restores UART functionality after the IDF 5.4 change by centralizing pin setup logic and replacing uart_set_pin
calls with a new internal configuration path.
- Introduces
_uartTrySetIomuxPin
and_uartInternalSetPin
for unified IOMUX/GPIO-matrix handling. - Updates
_uartAttachPins
to call_uartInternalSetPin
instead ofuart_set_pin
. - Preserves legacy loopback code under
#if 0
for future reference.
Comments suppressed due to low confidence (3)
cores/esp32/esp32-hal-uart.c:298
- [nitpick] Consider adding a function-level comment or docstring explaining the purpose, parameters, and return value of
_uartTrySetIomuxPin
to improve readability and maintainability.
static bool _uartTrySetIomuxPin(uart_port_t uart_num, int io_num, uint32_t idx) {
cores/esp32/esp32-hal-uart.c:330
- [nitpick] Add a descriptive comment above
_uartInternalSetPin
summarizing its behavior, parameter roles, and error conditions to aid future contributors.
static esp_err_t _uartInternalSetPin(uart_port_t uart_num, int tx_io_num, int rx_io_num, int rts_io_num, int cts_io_num) {
cores/esp32/esp32-hal-uart.c:303
- Add unit or integration tests to cover the new fallback logic in
_uartTrySetIomuxPin
, particularly branches wheredefault_gpio
matches versus does not match the providedio_num
.
if (upin->iomux_func == -1 || upin->default_gpio == -1 || upin->default_gpio != io_num) {
Description of Change
This PR fixes the effect of the IDF 5.4 commit espressif/esp-idf@60f5828 that breaks any Arduino sketch that fails reading UART
Nothing is printed into Serial Monitor, event when data is sent.
Sketch
Tests scenarios
Tested using CI and UART test Cases.
Related links
Closes #11498