Hi,
I'm working on a drone project in which I have to read out the acc/gyro data from an MPU6050 IC. I'm using I2C protocol and the device is connected to the I2C2 modul. I'm able to read/write the registers in MPU6050, but after a random amount of time after the start-up I'm not able to communicate with the IC anymore.
I tried to investigate what is the problem, but the pulls up are okay, the soldering as well. The software I think fine, since I can read/write of the registers of the MPU6050. The loss of communication happens randomly after the power-up. Originally the read operation from the MPU6050 were in a ISR routine called every 1ms (bus speed 400khz), but in order to exclude the memory corruption or any other kind of problem cause by another ISR, I've moved the code in to the begining of my program. Even in that case I had problems with communication with the IC, again after random amount of seconds after start-up.
During the investigation I've found tthe following stange things.
1.
Any case the error occures on the I2C, the stellarisware lib functions are not able to transmit any more on the I2C. Not even the slave address. It seem that the I2C modul stucks in the error state. The error bits are set. The BUSBSY and DATACK.
2.
The stellarisware lib functions are not able to clear the BUSBSY and DATAACK bits after the reinitlaization of the I2C even after I restared the uc with the debugger. I've tired to force turn off and on the I2C module, since after the restart of the debugger the previous settings and errors were present in the I2C registers. So I've added the I2CPeripheralEnable(..)+I2CPeripheralDisable(...)+I2CMasterDisble(..)+I2CMasterEnable(...), to force turn off and on, but it didn't help. The errors still were present in the I2C2MCS register :(
3.
I've analysed the signals on the I2C. See the attached picture below.
In the green circle the written data has been acked by the MPU6050. With the signals below (in paint) there is two problems! The first, that wrong data has been transmitted, one bit is missing (ok, let's say my fault in the code), but the second, that the I2C modul transmitted only 8 CLK cycle, not 9! The last cycle's falling edge is missing! This is very odd. I would say, that there is some problem with the uc's I2C modul. Also the MPU6050 doesn't ACK the write, but is okay, since the uC didn't trasmit the last falling edge.
So after this point, the I2C modul becomes "silent", the stellarisware lib functions are called properly, still no data transmitted. Some case the code stucks in the I2C master busy wait.
+1
I've replaced the LM4F120H5QR (I'm using the starter kit) with a new one, the problem is the same.
I'm really lost. What do you think, what could be the problem? Any suggestion to try?