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
Solved! Go to Solution.
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!
-----------------------------------------------------------------------------------------------------------------------
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
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!
-----------------------------------------------------------------------------------------------------------------------