-
Notifications
You must be signed in to change notification settings - Fork 181
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
PinDriver::output causes gpio to unexpectedly go high #343
Comments
if you suspect that the drop call is the culprit, can you test it out what happens if its not called? you can simply use [patch-crates.io] in your Cargo.toml to point to a modified copy of esp-idf-hal |
commenting out |
Alright, seems I've run this down, summary below: I am using esp-idf v5.1.1 As a short-term for my specific use-case, I simply replaced this with a pull-down instead of a pull-up, but think that a better long-term solution would be to replace this |
What you suggest would be a half solution only, as if you decide to drop the driver itself, you'll get the very same glitch. |
well @ivmarkov i already addressed that in the linked PR? |
What about saving the previous pull-up/down state as a private field of PinDriver on initialization, and restoring that state on drop? I think any unexpected behavior on PinDriver creation could be avoided by making the user of the API choose the pull mode explicitly, e.g. by having a required The current API enforces at compile time that |
There might not always be a previous state however. Personally I would be for having a parameter as part of initializing the pin that requires defining the "reset" and "drop" direction. That is, if dropping a pin/resetting a pin forces the pin to go high or low, we should be able to pick which direction it goes. |
So it seems this was merged but we are still waiting for it to be released before updating via crates.io? Would pointing to master right now include the fix? |
Of course? |
I guess I am confused then. If master is treated as a prerelease branch, why is this issue closed? Shouldn't it remain open until the next release since the issue is still present in the latest release of the crate? Just trying to understand dev life cycle here. Is there an ETA on the next release? |
We close the issue as soon as it hits master, or shortly after. That's what a lot of other projects do as well, with GH's simplistic issue tracking system. As for ETA - perhaps by end of this month latest, if not earlier. Is there any reason, if you really need this ASAP, not to use |
Cool, thanks for the insight! |
Just continuing the conversation from element.
When using the
PinDriver::output
against a pin to create the pin driver, the pin state of that pin briefly becomes high. For boards where the esp32 is not the main IC and is sharing resources or interacting with external systems which are input sensitive, this is very dangerous behavior.The following code can be used to demonstrate the behavior: https://gist.github.com/noahbliss/d86fcf8f64b6fa901330656636be31c3
To reproduce:
Modify the gpio pin to one which matches and led on your board.
Flash the board.
Disconnect power or reset the board.
Observe that the led briefly flashes despite never being told to go high.
Tested on the freenove esp32-s3 wroom developer module as well as on esp32-s3 custom hardware.
Unless I am mistaken, it seems that this
drop
is to blame because it subsequently calls a pin reset.gpio.rs line 848
It also seems this might have been mentioned in a past issue, albeit for a different reason: #217
The text was updated successfully, but these errors were encountered: