Open pdgilbert opened 4 years ago
The timing error should be solved by compiling in release mode. I tested on stm32f303xc. For more info look into pdgilbert's fork of this repository. Thank you @pdgilbert
Just to be clear for anyone reading this issue, I have not been using or testing this crate (dht11-rs
) for some time now. I use crate dht-sensor
from https://github.com/michaelbeaumont/dht-sensor which supports devices DHT11 and DHT22. (My fork is of that crate, but my fork is not active.) I have done some hardware testing with that crate and CI build testing along with several other examples for device hal crates stm32f0xx-hal
, stm32f1xx-hal
, stm32f3xx-hal
, stm32f4xx-halstm32f7xx-hal
, stm32h7xx-hal
, stm32l0xx-hal
, stm32l1xx-hal
, and stm32l4xx-hal
at https://github.com/pdgilbert/rust-integration-testing/actions. Example code using dht-sensor
is at https://github.com/pdgilbert/rust-integration-testing/blob/main/examples/misc/dht.rs. Compiling in release mode does seem to be important.
I've been playing with your example, and have gotten to compiling and running on both a blue pill using stm32f1xx-hal and on a nucleo-64 (stm32f411) using stm32f4xx-hal, but I only get
Err(Timeout)
and not any readings. Possibly I have the wait time too short? With stm32f3xx-hal I get the error you mention in issue #1 . My code is below. (I'm using git versions of the hals.)I've changed several things relative to your example: pin to pa8, source of core peripherals to the hal rather than cortex_m, and the clock. The last may be most important(?) but I did not know how to do this correctly with stm32f1xx-hal and I hit a panic with stm32f4xx-hal, possibly due to the attempted setting exceeding my hardware capabilities.
Regarding the pull-up resister, I was not sure if the internal resister gets used with just
pa8.into_open_drain_output()
but I get the same result both with and without an external resistor (33K ohm, which also may not be correct).I am a newbie and I've probably messed with something I should not have touched. I'm not even sure how to determine if this is a hardware or software problem. Any suggestions would be appreciated.