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
Hi lulia,
Please checked whether the flag of I2C0_S -> IICIF set ?
If no , i think the basic configuration of I2C transmit have some error, please check .
You can refer to some I2C demo code , for example "KINETIS512_V2_SC"
(K60_100 |Kinetis K60 100 MHz MCUs|Freescale ) in the IAR demo , there is a "i2c_demo" .
BR
Alice
Hi Alice,
I am using KDS3.0 and KDSK v1.2.0 with PEX and im having the same issue.
In my case, the code get stuck in the following line.
/* Wait for the transfer to finish.*/
I2C_DRV_MasterWait(instance, timeout_ms);
Inside this function there is the following code:
do
{
syncStatus = OSA_SemaWait(&master->irqSync, timeout_ms);
}while(syncStatus == kStatus_OSA_Idle);
I use the non-blocking function I2C_DRV_MasterSendDat, so it should get out of here because of a time out
Any idea?
I am really concerned. it is pretty urgent issue
Thanks and best regards