vybrid MMA8451q

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

vybrid MMA8451q

Jump to solution
1,557 Views
lizhenq
Contributor II

Hi,I am using the TWRVF65GS10 with MQX 4.1.But I finded no demo for MMA8451q.I try some times with Re: I2C Vybrid Code?.Vybrid can't get the ACK of MMA8451.I mant to get some surport ,documnet or code demo.

Labels (3)
1 Solution
1,116 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Li Zhenq,

I just implemented an MQX I2C demo for MMA8451Q, it is for TWR-K60D100M, but should be easily ported to TWRVF65GS10, please kindly refer to [MQX 4.1]I2C demo for MMA8451Q for more details.

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

6 Replies
1,117 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Li Zhenq,

I just implemented an MQX I2C demo for MMA8451Q, it is for TWR-K60D100M, but should be easily ported to TWRVF65GS10, please kindly refer to [MQX 4.1]I2C demo for MMA8451Q for more details.

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,116 Views
lizhenq
Contributor II

Thank you!!!

0 Kudos
1,116 Views
lizhenq
Contributor II

Hi Kan_Li,

   The VF6XX can send the IIC addr,but can't receive the ACK .I try addr 0X1C and 0X1D of MMA8451.The SCL is 8.4KHz.

0 Kudos
1,116 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Li Zhenq,

The I2C address for MMA8451Q on TWR-VF65GS10 should be 0x1C since SA0 is pulled down by R130 by default. Have you ported the demo to TWR-VF65GS10? Maybe you can share the printf messages for a review.

Thanks for your patience!!


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,116 Views
juangutierrez
NXP Employee
NXP Employee

Hi

Here is some pseudocode for the initialization and sampling for the MMA8451Q

After initializing you should be able to read.

For the i2c_read and i2c_write, you can follow the implementation done for the mma7760 at <mqx_installation>/demo/accelerometer/accel_i2c.c

#define ADDR = 0x1C

typedef struct data {

     char reg

     char value

} data

Initialize_MMA8451Q {

     data.reg = 0x11 //PL_CFG

     data.val = 0xc0

     i2c_write(12c0, ADDR, data, sizeof(data))

     data_reg = 0x2a //CTRL_REG1

     data.val = 0x01

     i2c_write(12c0, ADDR, data, sizeof(data))

}

#define READ_DATA 0x01

#define READ_STATUS 0x10

sample_MMA8451Q {

  char x,y,z, status;

  char rcv_buf[6];

  i2c_read(12c0, ADDR, READ_DATA, rcv_buf, sizeof(rcv_buf));

  x = rcv_buf[0];

  y = rcv_buf[2];

  z = rcv_buf[4];

  i2c_read(12c0, ADDR, READ_STATUS, rcv_buf, 3);

  status = rcv_buf[0];

}

I will try to have get a sample version, probably by the end of next week.

0 Kudos
1,116 Views
naoumgitnik
Senior Contributor V

Just clarification for those to reply to Li Zheng - MMA8451Q is Freescale Digital Accelerometer IC with an I2C interface (http://cache.freescale.com/files/sensors/doc/data_sheet/MMA8451Q.pdf).

0 Kudos