Skip to content
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 communication problems #369

Open
parmiani opened this issue Oct 30, 2017 · 4 comments
Open

I2C communication problems #369

parmiani opened this issue Oct 30, 2017 · 4 comments

Comments

@parmiani
Copy link

Hello,
i have a chipkit wifire with PIC32MZ2048EFG100 mounted. I'm doig some communication tests with an IMU 10DOF with an MPU6050, an HMC5883 magnetometer and an MS5611 barometer. I'm using library written by Jeff Rowberg and I2C communication is managed by DTWI library. HMC5883 is connected to the aux bus of MPU. MPU6050 responds correctly while magnetometer does not respond. I have debugged the program checking with an oscilloscope on the aux bus and the I2C request is present also with the acknoledge of HMC5883, but seems the microcontroller ingnores this and does not take the data. The address of MPU is 0x68 and that of HMC5883 is 0x1E.
Does anyone have some suggestion for me?

Thanks a lot

Alessandro

@EmbeddedMan
Copy link
Member

EmbeddedMan commented Oct 30, 2017 via email

@parmiani
Copy link
Author

Ok, thank you for the suggestion.
I will post an I2C transaction

Alessandro

@parmiani
Copy link
Author

parmiani commented Nov 1, 2017

Hello,
these are the failing I2C transaction
i2c1
i2c2
i2c3

@parmiani
Copy link
Author

parmiani commented Nov 1, 2017

Here there are the right I2C transaction done with another board:

i2c_1
i2c_2
i2c_3
i2c_4

These are the test of reading the 3 identification register of the chip (0x1E) with a burst read (0x0A the first, followed by the content of 0x0B and 0x0C).
At the end I was able to understand the problem.
There is a problem when i read the data from the sensor. When the master send for the second time the address of the slave for reading data, there is an error.
This address has to be sent with a 'read' bit (and not a write bit as in the picture); moreover, after that, the master resends for the third time the right address of the slave with
the 'read' bit. In any case this causes an error and the magnetometer doesn't respond.
I solved going in the I2Cdev.cpp in function 'readBytes' and commenting the second Wire.beginTransmission(devAddr). Probably in the previous version of chipkit core
that uses twi library instead of the new one DTWI doesn't cause this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants