Hi everybody!
My I2C project can send and receive successfully (single step mode) , but cannot run by Resume,
it will stuck at "while (I2C_2.IBSR.B.IBB == 1);"
Here's the successful example introduction of the project (single step mode):
I2C_2 is set as a transmit master node, interrupt enabled, transmit data is 0x55
I2C_3 is set as a receive slave node, interrupt disabled.
The program data loop is supposed to be as shown in the following picture:
.
Attachment is my program project for reference.
Thanks a lot!
Original Attachment has been moved to: mpc5748g_Z4_1.zip
Hi,
Use following code for your Slave_Set function. You should check the IBIF flag and also do a dummy read to initiate receive operation.
void I2C_Slave_Set(void)
{
uint8_t dummy;
while (I2C_3.IBSR.B.IBIF == 0);
I2C_3.IBSR.B.IBIF = 1;
if (I2C_3.IBSR.B.IAAS == 1)
{
if (I2C_3.IBSR.B.SRW == 0)
{
I2C_3.IBCR.B.TXRX = 0;
dummy = I2C_3.IBDR.R;
}
else
{
I2C_3.IBCR.B.TXRX = 1;
}
}
}
BR, Petr
Thank you a lot! I will check the code later.
BR