Hello,
We have configured MPC5200B as a slave for I2C communication, where master is Cypress's EZ-USB.
When in slave transmit mode, multiple data bytes (14 bytes) are written in I2C Data I/O Register (MBAR + 0x3D10/0x3D50) back to back for transmitting to Master.
But on Master side some of these data bytes does not get received and this loss of data doesn't follow any proper sequence.
Could you please suggest us possible reasons which will be causing this loss of data?
Regards,
Pavan
已解决! 转到解答。
Do you write the next data byte to the I2C Data I/O Register if IF bit is set and AL bit is not set in the I2C Status Register (MSR)?
See the Section 18.5.2 of the MPC5200B User's Manual.
See also simple I2C slave code in the attachment.
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Do you write the next data byte to the I2C Data I/O Register if IF bit is set and AL bit is not set in the I2C Status Register (MSR)?
See the Section 18.5.2 of the MPC5200B User's Manual.
See also simple I2C slave code in the attachment.
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
We are trying to transmit bulk of data (i.e. 2981 bytes) over I2C bus.
We have implemented the bulk data transmission logic based on IF bit(assertion/ deassertion ).
As per our observation during transmission at some point IF bit doesn't asserts due to which our approach is failing.
Also we have tried this approach for short data (i.e. 10 bytes) and it works fine.
Below is the code snippet for bulk data transmission :
unsigned short I2C_ByteCNT=0; // source data buffer index
while (I2C_ByteCNT < 2981)
{
*(I2C_DIO(1)) = ((LocalFlashBuf[I2C_ByteCNT]) << 24); // LocalFlashBuf is a source data buffer
I2C_ByteCNT++;
//wait till Tx is in progress
while ((*(I2C_SR(1)) & 0x02000000) == 0x00000000); //wait for IF bit assertion
//clear IF flag in status register
*(I2C_SR(1)) &= ~(0x02000000);
}
Please guide us the for bulk data transmission.@