MMA8452Q I2C Read Single Byte problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMA8452Q I2C Read Single Byte problem

Jump to solution
1,022 Views
bdp42
Contributor IV

Hi,

I'm having a problem with the MMA8452Q when attempting to read the WHO_AM_I register over I2C. We are using an iMX28 based platform running Linux 2.6.35. The device driver reads a value of 0 instead of the expected value of 0x2A. I've seen that on the I2C bus the controller sends a Stop Condition after writing the register it wants to read before starting to read the actual value. It does not use a repeated start.

The MMA8452Q data sheet states "....The MM8452Q expects repeated starts to be used to randomly read from specific registers". It also states (under Single Byte Read) "The Master (or MCU) transmits a repeated start condition (SR) and the addresses the MMA8452Q ($1D) with the R/W bit set to "1" for a read from the previously selected register.

Does this mean we MUST use a repeated start when reading random register values and that the MMA8452 does NOT support using a Stop condition after writing the register address before another Start/Stop to read the actual value?

Thanks,

Bruno

Labels (2)
1 Solution
420 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Bruno,

Yes, the MMA8452Q uses a combined I2C data transfer format and requires a repeated start condition after the second byte (register address).

A single byte read from the WHO_AM_I register 0x0D looks like this (note that it is for the MMA8652FC I have on my desk):

Who_Am_I+register+read.JPG.jpg

Please let me know if you have any other questions.

Regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.

View solution in original post

2 Replies
421 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Bruno,

Yes, the MMA8452Q uses a combined I2C data transfer format and requires a repeated start condition after the second byte (register address).

A single byte read from the WHO_AM_I register 0x0D looks like this (note that it is for the MMA8652FC I have on my desk):

Who_Am_I+register+read.JPG.jpg

Please let me know if you have any other questions.

Regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.

420 Views
bdp42
Contributor IV

Thanks Tomas,

It's what I thought but I just wanted it confirmed.

Bruno

0 Kudos