Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software

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



When the I2C_SSTAT_RD_CMPT will be setting[I2C Slave Mode] ?
Moderator:
JFMD

Post Reply
Follow this topic



When the I2C_SSTAT_RD_CMPT will be setting[I2C Slave Mode] ?

webean86 posted on 01 Apr 2010 12:12 AM PST

1 Forum Post

When I read the datasheet of I2C(I2CHW in PSoC Creator), I found when we use Slave mode, the function "uint8 I2C_SlaveStatus(void)" will be used to check the status for I2C Slave, and also, we can see the example code in the datasheet as below:

uint8 wrBuf[10];
uint8 userArray[10];
uint8 byteCnt;
I2C_SlaveInitWriteBuf((uint8 *) wrBuf, 10);
/* Wait for I2C master to complete a write */
for(;1 /* loop forever */
{
/* Wait for I2C master to complete a write */
if(I2C_SlaveStatus( ) & I2C_SSTAT_RD_CMPT )
{
byteCnt = I2C_SlaveGetWriteBufSize( );
I2C_SlaveClearReadStatus( );
For(i=0; I < byteCnt; i++)
{
userArray = wrBuf; /* Transfer data */
}
I2C_SlaveClearWriteBuf( );
}
}



Why we can use the I2C_SSTAT_RD_CMPT to indicate the I2C Master has complete a write?
And I don't know when the I2C_SSTAT_RD_CMPT will be set?(if the I2C_SSTAT_RD_CMPT is set when we finished read the buffer, and when the last byte is transmitted, we will also read the wrBuf[], but then, the content in the buffer is not written by the Master?)







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.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20