AnsweredAssumed Answered

unable to use MMA8451 on KL46Z with I2C_LDD

Question asked by Tingkai Liu on Jul 13, 2015

First post in the forum so hopefully the question description is not too hard to understand.

 

I have been trying to interface with MMA8451 that is built-in to the KL46Z board. I used I2C_LDD as the component to communicate with the accelerometer.

 

There are two functions I've been using to Initialize and read data from the built-in MMA8451. Both functions came from the Sensor Fusion project from Freescale.

 

After fruitlessly working with the code for more than a week, I've come here for help.

 

There have been a few problems that I've encountered but the one I am having right now is that in the MasterSendBlock function, the bus is always busy even when I try to put the accelerometer in standby (which is the first ever communication with the MMA before all other configurations).

 

More specifically: I2C_PDD_GetBusStatus(I2C0_BASE_PTR) == I2C_PDD_BUS_BUSY   always return TRUE.

 

Even more frustrating is that the code works sometimes but not always. The same exact code worked on this board last night (thisAccel structure which contains the raw readings of acclerometer had changing values if I let the program run), but when I tried it this morning, it stopped working.

 

Please help.

Original Attachment has been moved to: SENS-ver1.rar

Outcomes