-
Notifications
You must be signed in to change notification settings - Fork 170
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
I2C NoAcknowledge on ESP32c3 #73
Comments
Shouldn't you be using |
I've tried all of those options, I was trying to reduce the code to the bare minimum to show the error. I get the same error on all of those options because at the base level they all use the write function at some point. |
What does the working Arduino code look like? |
This is the Arduino code that works. It is the example from Bolder Flight Systems:
|
According to this article, the default sda and scl are pins 8 & 9. So the first question is, does it work if you use pins 8 & 9? Secondly, if it still doesn't work, and you are convinced it really is on pins 4 & 5, what happens if you set |
I've verified via multimeter that the pins are 4=sda and 5=scl. I also checked the power input to the imu. Unfortunately I don't currently have a multimeter to watch the hardware signals but I may be able to borrow a cheap one. I forgot to modify the example again as I copied and pasted the generic example included with the library. In order to get the pasted example to work, I had to modify Things I've tried:
Things I'd like to confirm:
|
Command link is necessary for transactions. There's a strict contract that embedded hal requires for i2c, as to when to receive and send ACKs, which is easy to do with command link. I currently use the i2c implementation to drive a touch screen so it definitely works. You should just set clock yourself. Have a look at the embedded hal i2c contract and see if your device cam comply. .i.e. does it respond with ACKs at the write time? |
What versions of esp-idf-hal and esp-idf-sys are you using? According to the docs for the mpu9250 the device does an ack after each write. This is the MPU 9250 Datasheet and I read the details of the i2c communication on page 34. |
Figured it out, you can't do into_output or into_input_output on the pins before passing them into the Master struct. That is confusing and there are no warnings to prevent that. |
Hi All,
I'm trying to get a esp32c3 (m5stack c3u board) to communicate with a mpu9250, its connected with:
But no matter what I keep getting the error:
I've tried using the write_read function and just directly using a mpu9250 crate so I think the issue lays with the esp_idf_hal crate. I was initially using version 0.37.4 and I tried to go back to version 0.35.2 which also did not work. I've confirmed the mpu9250 is functional by downloading a demo arduino program to the esp32c3 and everything reads just fine with the exact same circuit and hardware.
Below is the test code I've been using. Am I doing something wrong?
P.S. the line numbers are off because I eliminated a ton of comments. The line that is failing is:
i2cdev.write(0x68, &[0x75]).unwrap();
The text was updated successfully, but these errors were encountered: