Fix esp-lp-hal gpio reading for the esp32s3 and esp32s2 #3191
+19
−2
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.
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
This PR fixes GPIO reading for the esp32-s3.
In the current release, the input register (and similarly when reading the output register) is accessed using the raw value. However, on the esp32-s3, there is a 10bit offset.
The lead to a bug where, in order to access a GPIO n from the ULP, you had to use the GPIO n+10.
This PR fixes this by using the higher-level field from the PAC.
For reference:
Testing
Testing was only performed on an esp32-s3, as I don't own other chips.
To test
input_state()
, I built a ULP firmware that wakes-up the esp when the pin (gpio6 in my case) goes high, then waited a few seconds before triggering the GPIO.Using the previous release, it only worked if I used GPIO16 in the code.
Using this PR, it works correctly, using GPIO6.
To test
output_state()
, I built a ULP firmware that sets the GPIO value, then read it, and sends the value to the esp, which prints it.I got similar results than for
input_state()
.