I2C write register stuck at i2c_Wait() K60N512

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

I2C write register stuck at i2c_Wait() K60N512

Jump to solution
988 Views
neagoeiulia
Contributor I

Hello!

I try to use the I2C module to configure a CMOS sensor from a Kinetis K60N512  in an application but it gets stuck after the instruction I2C0_D = u8RegisterAddress; at i2c_Wait();.

It worked a  few times, but now it's stopped. Here is my code:

void OV7675WriteRegister(unsigned char u8RegisterAddress, unsigned char u8Data)

{

  // send data to slave

  IIC_StartTransmission(SlaveID,MWSR);

  i2c_Wait();

  I2C0_D = u8RegisterAddress;

  i2c_Wait(); // here is the problem i don't understand

  I2C0_D = u8Data;

  i2c_Wait();

  i2c_Stop();

  Pause();

}

Can anyone tell me what is wrong?

Thanks

Iulia

0 Kudos
1 Solution
673 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I would recommend customer to refer Kinetis 100MHz Rev 2 Example Projects, which provides I2C demo (get data from accelerator sensor MMA8451).

I could not find customer in code to check the I2C slave ACK signal, the problem could be the CMOS sensor doesn't ACK the slave address.

Wish it helps.


Have a great day,
Ma Hui

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

View solution in original post

0 Kudos
2 Replies
673 Views
neagoeiulia
Contributor I

Hello Hui_Ma,

You were right about the fact that the sensor didn't reply with the ACK signal because it was burned. My problem was the energy supply.

Thanks!

Iulia

0 Kudos
674 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I would recommend customer to refer Kinetis 100MHz Rev 2 Example Projects, which provides I2C demo (get data from accelerator sensor MMA8451).

I could not find customer in code to check the I2C slave ACK signal, the problem could be the CMOS sensor doesn't ACK the slave address.

Wish it helps.


Have a great day,
Ma Hui

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

0 Kudos