I2C not working between LPC824 and MMA8453Q?

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

I2C not working between LPC824 and MMA8453Q?

462 Views
joren_joly
Contributor II

For a project I am using an LPC824 MCU from NXP and I want to read out data from the accelerometer over I2C. This accelerometer is the MMA8453Q. Looking into the datasheet of the accelerometer I see the following:

Annotation 2019-10-16 082741.png

From my understanding this means that you give a start signal, you write the device address and put write behind it, you get an acknowledgement and so on.

The address I have to write is the following: 

Annotation 2019-10-16 083059.png

the register I chose for now was 0x0D which is the "Who am I" register, this should always be read as 0x3A.

For people familiar with NXP examples I based myself on one of them. This is the code I have atm:

*txData = 0x0D; SetupXferRecAndExecute(0x1C, txData, 1, rxData, 0); SetupXferRecAndExecute(0x1C, txData, 0, rxData, 1);

and this is what it looks like on the scope 

73504874_455677998383164_942080091167391744_n.jpg

So as i can see I send the Device adress twice, first I write the register address and than i want to read it, but it gives 0x00 back. Can someone pls help me? Thanks in advance!

0 Kudos
1 Reply

401 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Joren,

I went ahead to check the datasheet for the accelerometer you are using. I'd like to check first some hardware considerations, to rule out any issue there. 

Can you please confirm the following:

1. If you are using 0x1C as your device address, that pin 7 is pulled to ground.

2. VDDIO is pulled high

3. SDA and SCL have pull up resistors.

If the above is correct, then we can confirm that the sequence is correct. Can you please clarify what your function SetupXferRecAndExecute(0x1C, txData, 1, rxData, 0); is doing? I am not exactly following this and was not able to find a similar function in the SDK for the LPC824.

Essentially we need to make sure here that you send the following sequence:

1. Start Condition

2. 0x1C

3.Write(Bit is 0)

4. Receives ACK

5. 0x0D (Who Am I)

6. Receives ACK

7.Start Repeated Condition

8. Read(Bit is 1)

9.Receives ACK

10.Receives Data

11. NAK

12. Stop Condition

I'm seeing that the blue line looks like the SDA is this correct? If so in order to be sure that the above is being sent through properly, you need to mesure the data fram showing so we can confirm if the information is being sent properly.

Also if you can please confirm the mcuxpresso version you re using as well as the SDK so I can check the examples provided.

Best Regards,

Sabina

0 Kudos