I2C write register stuck at i2c_Wait() K60N512

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

I2C write register stuck at i2c_Wait() K60N512

跳至解决方案
1,696 次查看
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 项奖励
回复
1 解答
1,381 次查看
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 项奖励
回复
2 回复数
1,381 次查看
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 项奖励
回复
1,382 次查看
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 项奖励
回复