Loss of data during communication over I2C protocol

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Loss of data during communication over I2C protocol

ソリューションへジャンプ
2,076件の閲覧回数
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,851件の閲覧回数
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,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!
-----------------------------------------------------------------------------------------------------------------------

1,851件の閲覧回数
pavangidaveer
Contributor II

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

Thanks,

Pavan

0 件の賞賛
返信
1,851件の閲覧回数
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,851件の閲覧回数
pavangidaveer
Contributor II

Pavel

Please guide us for above query as soon as possible.

0 件の賞賛
返信
1,851件の閲覧回数
pavangidaveer
Contributor II

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

0 件の賞賛
返信