Loss of data during communication over I2C protocol

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

Loss of data during communication over I2C protocol

跳至解决方案
2,077 次查看
pavangidaveer
Contributor II

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

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,852 次查看
Pavel
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

5 回复数
1,853 次查看
Pavel
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

1,852 次查看
pavangidaveer
Contributor II

We monitored IF bit of I2C Status Register properly and now we are getting data without loss.

Thanks,

Pavan

0 项奖励
回复
1,852 次查看
pavangidaveer
Contributor II

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.@

0 项奖励
回复
1,852 次查看
pavangidaveer
Contributor II

Pavel

Please guide us for above query as soon as possible.

0 项奖励
回复
1,852 次查看
pavangidaveer
Contributor II

Also please suggest how to use data register in MPC without interrupt generation for bulk data transfer

0 项奖励
回复