Skip to content
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

fix(HardwareSerial): fix pin remapping in begin() for 2.x #10380

Merged

Conversation

pillo79
Copy link
Contributor

@pillo79 pillo79 commented Sep 26, 2024

Description of Change

The pin remapping functions have to be called as early as possible in the begin() function, to immediately convert the input parameters from the user to the GPIO numbers used everywhere in the core. However, there is code that assigns GPIO numbers to txPin/rxPin before the call to digitalPinToGPIONumber.

This issue has always been dormant since the introduction of pin remapping in 9b4622d, but was exposed by the recent UART pin detach support in 2.x, which actually disabled the default Serial0 pins.

Move the pin remapping function calls earlier in the begin() function to fix this issue.

Tests scenarios

Tested on the Nano ESP32 - Serial0.begin(115200) was selecting "random" pins instead of the expected defaults.

Related links

See also #10379 for the same fix on master.

The pin remapping functions have to be called as early as possible in
the begin() function, to immediately convert the input parameters to the
GPIO numbers used everywhere in the core.

This issue has always been dormant since the introduction of pin
remapping in 9b4622d, but was exposed by the recent UART pin detach
support, which actually disabled the original Serial0 pins.

Move the pin remapping function calls earlier in the begin() function to
fix this issue.
@me-no-dev me-no-dev merged commit 8ff2da7 into espressif:release/v2.x Oct 1, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants