-
Notifications
You must be signed in to change notification settings - Fork 214
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
Run time errors with i2c temperature/humidity sensors #828
Comments
I'm not an expert in I2C. Maybe someone else can help. There is also #547
If this an old error how can this help?
F1 and F4 I2C peripherals does not have config for timings (except FMPI2c). G4 I2Cs should have. |
I tried commits I am trying to get a better fix on the location of the problem with gdb. Stepping through the
(For the last two lines my gdb src window reports
If I use ^C to break to gdb then backtrace gives
Let me know if there is something else I should check. (I'm a novice with gdb and not familiar with the hal or sensor crate code.) |
just a thought. But could it be related to device addresses? |
I don't think so. The device address is hard coded in some of the crates because it cannot be change. Were it is not hard coded it is set in the generic part of my code, so it works with |
It looks like it halts on reading SR1 register.
This could be https://doc.rust-lang.org/src/core/convert/mod.rs.html#759 Lines 568 to 575 in 585dd0f
|
Thanks @burrbull , this seems to be the problem. (I'm a novice with gdb, so tips and explanations appreciated.) I was using default profiles. Thus no debug info for I have been exiting and restarting gdb sessions as I test different code, but I have been leaving my openocd session running with my st-link probe connected to the test board. I have now discovered that if I run a gdb session that fails (eg. |
I have done more testing and some fixing of examples at the above repository (https://github.com/pdgilbert/i2c-test). All the semihost examples now work with Many of the |
(Possibly related to #749)
I have examples with some
embedded-hal v1
temperature/humidity sensor crates that compile but then fail running. The general symptom is that they do not return from an initial call to thehal
.There are three AHT20 sensor crates and also crates for sensors SHT30 and SHTC3. I have checked the sensor crates with a git version and a release version if it exists. The crates are:
aht20-driver v2.0.0
and git https://github.com/anglerud/aht20-driver#fd81e034)aht20
https://github.com/blueluna/aht20#07a72ca9)embedded-aht20 v0.1.3
https://github.com/ghismary/embedded-aht20#fbeaaee0)shtcx-rs
https://github.com/dbrgn/shtcx-rs#0cfcb5d3)embedded-sht3x
https://gitlab.com/ghislainmary/embedded-sht3x#d22db3e8)I have tested these with
stm32f4xx-hal
releasev0.22.1
and also with a recent git commit#ed88ea13
. For comparison I have also tested with @techmccat 'sstm32g4xx-hal
from https://github.com/techmccat/stm32g4xx-hal#9462f4cd branchhal-1
.All examples compile with both hals (and also with
stm32f1xx-hal
).The three AHT20 crates work with
stm32g4xx-hal
but fail withstm32f4xx-hal
. The SHT30 and SHTC3 crates work withstm32f4xx-hal
but fail withstm32g4xx-hal
.I have put the examples in a repository https://github.com/pdgilbert/i2c-test. The action tab shows the compiling results. The README has a few more details from GDB.
The repository also includes some examples with @eldruin 's
xca9548a-rs
multiplexer crate. These also compile but have run time errors (even in the cases where the sensor crates alone work).Of course, the most likely problem is that I have something wrong in the setup (
src/setup_all_stm32f4xx.rs
) but I think it is correct (encouraged by the fact that some examples work). Another possibility is that sensor delays are not sufficiently long, but that would likely affect all examples.Of course, my hope is that the cross-device abstraction can be made to work, so the device crates will work with different HALs. Suggestions would be appreciated.
The text was updated successfully, but these errors were encountered: