Comments (12)
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.
from esp-idf-hal.
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 [patch.crates-io]
as most folks do?
from esp-idf-hal.
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
from esp-idf-hal.
commenting out drop
still allows it to compile, but it quite thoroughly breaks gpio it seems.
from esp-idf-hal.
Alright, seems I've run this down, summary below:
I am using esp-idf v5.1.1
It looks like the PinDriver, as part of setting up an output, calls drop() which itself calls gpio_reset_pin() from esp-idf.
This function in esp-idf (located here) cause the pin to be pulled up as part of the reset, causing an undesirable output which can cause some severe damage depending on what the gpio is connected to.
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 drop(self);
in the PinDriver with a gpio configuration which either doesn't pull the pin or allows users to specify which direction to pull the pin.
from esp-idf-hal.
Alright, seems I've run this down, summary below:
I am using esp-idf v5.1.1 It looks like the PinDriver, as part of setting up an output, calls drop() which itself calls gpio_reset_pin() from esp-idf. This function in esp-idf (located here) cause the pin to be pulled up as part of the reset, causing an undesirable output which can cause some severe damage depending on what the gpio is connected to.
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
drop(self);
in the PinDriver with a gpio configuration which either doesn't pull the pin or allows users to specify which direction to pull the pin.
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.
So I wonder, maybe we need a different reset
routine altogether?
from esp-idf-hal.
well @ivmarkov i already addressed that in the linked PR?
from esp-idf-hal.
So I wonder, maybe we need a different reset routine altogether?
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 Pull
argument in the input
and output
methods, or by giving PinDriver a generic argument (with no default value) to the same effect.
The current API enforces at compile time that .set_pull()
can only be called on pins that do actually have internal pull resistors available, which is good. I'm not sure whether it'd currently be possible to use the type system so that the user
a) must choose a pull mode for those pins that support one, and
b) must not choose one for the pins that don't, or alternatively, must explicitly "choose" Pull::Floating
.
from esp-idf-hal.
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?
from esp-idf-hal.
Of course?
from esp-idf-hal.
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?
from esp-idf-hal.
Cool, thanks for the insight!
from esp-idf-hal.
Related Issues (20)
- Async Uart Write hangs forever HOT 3
- Extra component HOT 6
- esp_idf_hal::delay::Delay missing some methods for embedded_hal::blocking::delay HOT 2
- `AsyncCanDriver` is not `Send` HOT 5
- Hardware acceleration for crypto?
- Conflict between esp-idf-hal and display-interface-spi on embedded-hal version HOT 1
- Documentation/API regarding default input pin pull up/down state HOT 6
- Ubuntu 22.04.3 LTS Cross-Compilation for the target = "riscv32imac-esp-espidf" (IDFGH-11878) HOT 4
- Remove 4096 limit for SPI dma transfer size HOT 2
- Can't enable the `edge-executor` feature HOT 2
- i2c broken on esp32-c6 HOT 1
- Never return type for `reset::restart`
- Simple blink example for RGB Led on Esp32 C6
- Shared I2C bus example HOT 1
- Support async in i2c Driver by using new ESP-IDF V5.2 driver impl
- rmt_neopixel no longer works (on esp32c6) HOT 3
- Mutating struct in ISR HOT 1
- Error: dangerous relocation: call8: call target out of range:(xtensa-esp32s3-espidf) HOT 3
- Transport(Failed to load system certs: No valid certificate found) (xtensa-esp32s3-espidf/STD) HOT 4
- need uart dtr, for rs485 control HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-idf-hal.