Loss of data during communication over I2C protocol

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Loss of data during communication over I2C protocol

Jump to solution
1,583 Views
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

Labels (1)
Tags (2)
0 Kudos
1 Solution
1,358 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

5 Replies
1,359 Views
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,358 Views
pavangidaveer
Contributor II

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

Thanks,

Pavan

0 Kudos
1,358 Views
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 Kudos
1,358 Views
pavangidaveer
Contributor II

Pavel

Please guide us for above query as soon as possible.

0 Kudos
1,358 Views
pavangidaveer
Contributor II

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

0 Kudos