-
Notifications
You must be signed in to change notification settings - Fork 7.6k
I2C Issues with MPU9250 Breakout Boards. #937
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
Comments
I started to do some debugging to determine where and when the issue with failing to correctly read the mpu9250 occurred. The approach I took was to download the latest git (12/22 0400hrs) and replace the esp32-hal-i2c.h, esp32-hal-i2c.cpp, wire.h and wire.cpp with the versions I had from about march 2017 (it already had the i2c stability fix in by @me-no-dev). After incorporating the dport i2c changes it compiled and recognized the 9250 no problem. When I incorporated Add initial handling for long I2C reads dated 10/21 it failed to recognize the 9250 whoiam register. It did still recognize that there was a valid device on the bus. Maybe this will help in identifying where the issue lies. |
Ok. Did some more debugging over the last couple of days as time permitted and finally just figured out that it is the same issue that resolved by @me-no-dev in issue 90.. Once I put the two byte solution in place it worked. Here is the code snippet that I used instead of what was originally posted:
What changed in i2c long read functions that would have caused I can not tell you. But this is now special case for the MPU9250. Again, not an issue with any other board that I have tried. Think that's about all I can do. |
I just tried stickbreakers fork with changes to i2c/wire files and it worked without the 2 byte read trick. The only issue seems to be speed. I did a test of a 7state Kalman filter with the MPU9250 and did a timing test with the old working version of i2c and the updates occurred every 836us. With stickbreakers changes it is about 915us. This compares to a Teensy 35 (120Mhz) which performs the update at 736us. Once stickbreakers i2c changes occur I guess this issue can be closed - once it is tested of course. Thanks |
The I2C core was changed to @stickbreaker code officially after 13dcfe5 (thanks @stickbreaker), Let's close issues with old code and if have problems with the new code, open new issues =) |
Hardware:
Board: ?Onehorse ESP32 Dev Board?
Core Installation/update date: ?12/18/14?
IDE name: ?Arduino IDE 1.8.5?
Flash Frequency: ?80Mhz?
Upload Speed: ?921600?
Description:
I2C reads of MPU9250 are failing. Issue was identified when running a full up sketch for the 9250 and was failing on reading the whoiam register. Even if this is removed it is failing to successfully read any data. It was however identifying the correct addresses when doing a i2scan. This was tested on two different MPU9250 breakout boards. A test sketch was then implemented to do a i2c bus scan and read the who am I register for the correct value.
For the MS5637 pressure sensor, BME280 pressure sensor and the BNO055 it worked no issue. However it failed for the MPU9250.
I installed a early version of the ESP32 Core from about 02/20/17 and it successfully ran the test sketch, i.e., it read the MPU9250 fine - no issues. The 9250 should not be a special case for the ESP32 as it is not for any other boards that I have tested it on - uno, mega, due, teensy 3.2 and 3.5. Especially since it was working before. The new implementation of I2C seems to have broken something.
Sketch:
Debug Messages:
The text was updated successfully, but these errors were encountered: