MMA8452Q - I2C interface

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

MMA8452Q - I2C interface

1,998 Views
tvsg
Contributor I

HI,

i am currently using MMA8452Q and  i am facing problems with I2C interface. i am having two doubts

1. what is the I2C speed (default) of the MMA8452Q and how to change its speed ?

2. I had connected this accelerometer (using breakout board) to Raspberry Pi B+ model and while accessing data (using I2C) i am unable to acquire the acceleration data based on the set sampling rate.

Example, if the sampling rate is fixed at 100Hz instead of obtaining 100 samples per second i am getting more than 100 with values getting repeated.

I had tried polling and interrupt based methods as given in AN4076 but i couldn't solve the issue. I am using WiringPi library to write and read data using I2C. 

Thank you in advance

Labels (2)
0 Kudos
Reply
3 Replies

1,443 Views
david_diaz
NXP Employee
NXP Employee

Hello,

1. The MMA8452Q device is compatible with the I2C fast-mode interface: 0 to 400kHz.

So, please make sure your MASTER is configured to use I2C module within the baud rate mentioned above.

2. In this case, I recommend reviewing the MMA8451Q - Bare metal example project and use it as a reference for your design. Please review the device initialization function and compare it with your configuration.

 

Please let me know if you have any further question.

Regards,

David

0 Kudos
Reply

1,443 Views
tvsg
Contributor I

Thank you David.

1. i think i am using an I2C speed of 100KHz. I will change it to 400KHz.

2. I will go through the device initialization declared in the bare metal example project and will let you know.

Regards,

Sainath gupta t

0 Kudos
Reply

1,443 Views
tvsg
Contributor I

Hi david_diaz‌,

I had modified the I2C speed and also reviewed the device initialization as given in  MMA8451Q - Bare metal example project  . Even after that the problem is not rectified.

To check whether number of samples are generated as per sampling rate, i had performed an experiment where i am acquiring acceleration samples of all the 3-axis for a period of 10 milliseconds. When i kept in 800Hz, instead of 8 samples (per axis) i was getting around 10 to 11 samples and this type of extra samples is followed for all other sampling rates also. As i said previously, i had tried using both polling and interrupt methods.

can you please help me where can i go wrong

Regards,

sainath gupta t

0 Kudos
Reply