MMA8452Q I2C Read Single Byte problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MMA8452Q I2C Read Single Byte problem

跳至解决方案
1,331 次查看
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

标签 (2)
1 解答
729 次查看
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.

在原帖中查看解决方案

2 回复数
730 次查看
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.

729 次查看
bdp42
Contributor IV

Thanks Tomas,

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

Bruno

0 项奖励
回复