can't read valid data from MMA9555L

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

can't read valid data from MMA9555L

1,585 次查看
miladfcb91
Contributor I

Hi everyone,

I'm working with MMA9555L module through an i2c interface, but I'm having a problem with pedometer function in MMA9555L. For a sanity check, I read back the version information which is ok and gets back the desired data but when I want to read the data from pedometer application, the slave returns nonsense data. Here is my code:

void main()

{

   void pedometerConfigRegs();           //sets the configuration registers of the pedometer application

                                                             //send these bytes to the part: 0x15, 0x20, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00,                                                                   0x00, 0x00, 0xE0, 0x00, 0xB6, 0x44, 0x04, 0x83, 0x05, 0x82, 0x00, 0x00, 0x00

   void pedometerReadValue();            //reads back from the slave

                                                             //send these bytes to the part: 0x15, 0x30, 0x00, 0x0C

   while(1)

   {

      read_i2c(16);

   }

}

Any help is highly appreciated.

Regards,

Milad.

标签 (2)
标记 (2)
0 项奖励
回复
2 回复数

1,370 次查看
AldoG
NXP TechSupport
NXP TechSupport

Hello milad,

in order for the information to be updated, the COCO flag should be 1,

so a fix delay between write and read will ensure the data is correct,

the delay must be > 33ms.

Also, did you put the device out of sleep mode, before setting the pedometer function, which is its state out of reset?

For that you'll need to clear the bit 0 of the CFG register.

As for the error code, it is possible that the comand you are sending is incorrect,

could you share the modifications you did?

Thank you!

Regards,

Aldo

0 项奖励
回复

1,370 次查看
miladfcb91
Contributor I

After some modifications, now the slave returns error 0x9C instead of 0x80 which shows "the command interpreter does not recognize a command code."

How can I fix this problem?

0 项奖励
回复