Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > I2C write delay problem

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



I2C write delay problem
Moderator:
RSKV

Post Reply
Follow this topic



I2C write delay problem

Kudoh posted on 19 Feb 2012 4:43 AM PST
Senior Member
16 Forum Posts

In  FX3 Release note, for I2C, 5 ms delay is required after write operation,

but it cause the fatal problem in performance, I think.

 

I guess this is because the I2C hardware runs in background, and

I2C API (CyU3PI2cTransmitBytes, etc) returns without waiting for the 'done' of hardware.

Is this idea right? and if it is right, can I get the done status of the I2C hardware?

 

Experimentally, I tried to shorten this delay as equal as the transmit time

(that is calculated with transmit bytes and clock rate) and it succeeded.

And when this delay is more shorter, I2C waveform is broken.

So, this delay-time calculation may be useful for workaround,

but I think it shall fail if the slave device use clock-stretching.




Re: I2C write delay problem

aasi posted on 20 Feb 2012 10:33 PM PST
Cypress Employee
1073 Forum Posts

That is due to the write cycle that most EEPROMs have.

We can keep retrying the transfer till it succeeds, the EEPROM datasheets don't have anything preventing this approach but we haven't done extensive testing of this approach yet. We'll most probably take a deeper look at it in future release.

Regards,

Anand



Re: I2C write delay problem

Kudoh posted on 20 Feb 2012 05:27 AM PST
Senior Member
16 Forum Posts

I apologize, I was misunderstanding.

I have used CyU3PI2cDeInit() and CyU3PI2cInit() immediately after CyU3PTransmitBytes(), and

it caused I2C bus violation.

In calling only CyU3PTransmitBytes() continuously, it works right.

 

For 5 ms wait described in release note, I understood it's required for EEPROM write busy cycle.



Re: I2C write delay problem

Kudoh posted on 21 Feb 2012 06:17 AM PST
Senior Member
16 Forum Posts

I found that I2C bus violation case when continuously calling of CyU3PI2cTransmitBytes()

with small interval.

I attached a waveform in fatal case.

But  the phenomenon is not stable (sometimes another waveform appears),

I think it depends on access pattern, timing, etc.

Inserting a large delay after transmit prevents this problem, but I don't know the best number of duration.

 

Attached waveform appeared in these sequence:

(1) call CyU3PTransmitBytes() with two data bytes.

     Slave address and first data byte are stored in the preamble.

     (length of preamble is 2, byteCount argument is 1)

     This calling returns success (but, at last byte, slave device sends NAK).

 

(2) wait 16 us with CyU3PBusyWait().

 

(3) transmit two dara bytes, such as (1).

 



Re: I2C write delay problem

RobK posted on 21 Feb 2012 06:41 AM PST
Top Contributor
56 Forum Posts

Hi Kudoh,

does your I2C-slave use clock-stretching to signal that it's not yet ready for another byte to receive? The waveform looks like that since at the second transmission the clock keeps low after acknowledge of 2nd byte...

 

Regards,

Robert



Re: I2C write delay problem

Kudoh posted on 21 Feb 2012 06:46 PM PST
Senior Member
16 Forum Posts

Hi.

In this case, the slave device does not use clock-stretching.

I guess FX3 I2C hardware is confusing.

I attached another waveform. In this case, I transmit same sequence with no wait.

(slaveAddress + 1 byte data for preamble,  1 byte for additional data, API call 2 times).

 

 

By the way, I guess  CyU3PTransmitBytes() transmits the preamble data synchronously, but

for the additional data transmitting, this API runs asynchronously and

at the time of API returns, I2C transmitting is running in background.

This means that  this API can not check ACK/NAK after preamble, and

returns success even if the slave device send NAK.

Is this true?



Re: I2C write delay problem

RobK posted on 22 Feb 2012 11:52 PM PST
Top Contributor
56 Forum Posts

Hi,

I found out that I2C-transmit API returns success even if slave sent a NAK if you transmit just 1 databyte (so 3rd parameter is 1). If you send 2 or more bytes the API seems to work properly. The support team told me it's a bug and it will be fixed with next patch/release.

Regards!



Re: I2C write delay problem

Kudoh posted on 22 Feb 2012 01:08 AM PST
Senior Member
16 Forum Posts

Hi.

I tested CyU3PTransmitBytes() with setting 3rd parameter to 2 or larger,

and I confirmed it works correctly with no wait.

Thanks.

 






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.