i2c not communicating to all sensors

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
DaRe_2236336
Level 3
Level 3
First like given

I'm using this 10 DOF IMU board from dfRobot (https://www.dfrobot.com/wiki/index.php/10_DOF_Mems_IMU_Sensor_V2.0_SKU:_SEN0140) for a project I'm working on. I have set up i2c communication with two of the four sensors successfully, but for some reason I cant get the communication to the gyroscope and compass to work. Both just NACK when written to (I'm using a logic analyzer to check the communications). I have checked and rechecked the code, and cant see any mistakes, or issues. I have also tried powering the IMU with 5 V instead of the 3.3 from cy8kit, the situation did not improve. I'm beginning to think the senors are bad. Can anyone suggest any further trouble shooting and/or look over my code for a sanity check?

I have also attached the datasheets for both no communicating sensors.

Thanks in advance

0 Likes
1 Solution

I did not change the code. Only contacts for my convenience.

Just pressed the reset and got the waveform from analyzer.

View solution in original post

9 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

It says you have some issues with your variables. Also one of the devices has a max Vcc of 3.6 Volts.  Also I would check the address and selection signals.   2018-04-01.png

0 Likes

The issues with the variables, shouldnt make a difference. Those warnings are being set because i am passing values to them and then never using the variables for anything. I simply put them in the code so that I can see the values returned during debugging in the locals tab. The IMU has a linear regulator to keep the voltage at 3.3V

pastedImage_1.png

The compass has only one address, and the gyro has two addresses, both of which i have tried to use, though by looking at the schematic it should be address 0x68 because the ADO ( alternate address pin) is GNDd.

0 Likes

Typical errors with I2C devices:

  • missing pull-up resistors, or wrong values (I see none in your schematic)
  • other parts at the I2C lines (might happen with the PSoC dev boards, they e.g. have capacitors and LEDs on some pins)
  • wrong I2C address format (the PSoC API want 7bit addresses), or wrong address
  • long data lines, together with a high slew rate at the ports, might cause ringing on the lines

Best way to debug: either have a sharp look at your schematic and your code (with a 'I know there is a bug hiding' mindset), or using a scope (or a logic analyzer)

0 Likes

Yes I saw the voltage regulator but the Vcc of the PSOC chip has an effect on the signal amplitude.  Also I don't have your board so I can't troubleshoot your program.

0 Likes

I only have a HMC5883L.

I checked your project with this sensor on the CY8CKIT-PSoC 5LP 059

My contacts P1.6(SDA) P1.7(scl) is set to Resistive pull up (with no external resistors)

I see ACK:

5883_.png

0 Likes

So i have the gyro working now, simple case not changing the write buf vsariable names after copying and pasting parts of the function, thats what i get for not taking the time to type out things. still not getting anything from the compass though. Is my code the exact code you used to get it to ACK? i get nothing from the slave on setup to write (besides NAK).

pastedImage_0.png

Stellar..

pastedImage_1.png

0 Likes

I did not change the code. Only contacts for my convenience.

Just pressed the reset and got the waveform from analyzer.

I found the issue. Apparently the sensor is not actually an HMC5883L, it is a QMC5883L, its stamped like the Honeywell one though. The IMU is advertised as having the Honeywell part. This is, of course, not documented anywhere i just found something about the knockoff online and thought i would try it out changing the address to see.

In case anyone else stumbles across this thread with similar issues with a supposed HMC5883 or the 10DOF IMU from dfrobot, the datasheet for the QMC5883L: http://img.filipeflop.com/files/download/Datasheet-QMC5883L-1.0%20.pdf

Thanks to everyones help and input.

0 Likes

hi,i am using QMC5883 but i cant get data from module?

can u give me your config and slave ddress for i2c communication?

can you give me your project sample?

thanks

0 Likes