- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am considering error handling for I2C slave of PSoC4000S.
Please see the return value of SCB_I2CSlaveStatus() API.
[In case of write operation (master -> slave)]
1. Just program the error handling between /* your error handling here */ and /* your error handling end */.
if(0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_WR_CMPLT))
{
if(0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_WR_OVFL))
{
/* your error handling here */
/* your error handling end */
}
else if(0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_WR_ERR))
{
/* your error handling here */
/* your error handling end */
}
/* your write operation handling here */
/* your write operation handling end*/
}
2. Just progarm the timeout handling between /* your timeout handling here */ and /* your timeout handling end */.
for example:
while(0 != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_WR_BUSY))
{
/* your timeout handling here */
/* your timeout handling end */
}
[In case of read operation (master <- slave)]
3. Just program the error handling between /* your error handling here */ and /* your error handling end */.
if (0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_RD_CMPLT))
{
if(0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_RD_OVFL))
{
/* your error handling here */
/* your error handling end */
}
else if(0u != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_RD_ERR))
{
/* your error handling here */
/* your error handling end */
}
/* read operation handling here*/
/* read operation handling end*/
}
4. Just progarm the timeout handling between /* your timeout handling here */ and /* your timeout handling end */.
for example:
while(0 != (I2CS_I2CSlaveStatus() & I2CS_I2C_SSTAT_RD_BUSY))
{
/* your timeout handling here */
/* your timeout handling end */
}
Is there anything else I can prepare?
Best regards,
Yocchi
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is exactly one of methods to check passing data for I2C slave.
You can use these Slave Status Contents.
Also it might be necessary to prepare own status for your project to check whether closed passing data correctly. (such as “length of packet”, “the start and end of packet” and so on)
For reference, here’s a part of example from sample code(CE224599) in PSoC Creator below.
Infineon Technologies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is exactly one of methods to check passing data for I2C slave.
You can use these Slave Status Contents.
Also it might be necessary to prepare own status for your project to check whether closed passing data correctly. (such as “length of packet”, “the start and end of packet” and so on)
For reference, here’s a part of example from sample code(CE224599) in PSoC Creator below.
Infineon Technologies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Your point is to check the data error when there is no hardware error and the data communication is successful.
My question is about error handling when an error is detected in hardware.
Is this enough for hardware error handling?
Best regards,
Yocchi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, SCB_I2CSlaveStatus() is good for checking hardware error.
Also your suggestion would work well.
A source code for firmware operation error will be mostly after checking hardware error with this API in any I2C code example.
So you can make sure of this API in same code example I suggested as well.
Infineon Technologies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have prepared a sample project for handling I2C slave errors.
I2C slave error handling for CY8CKIT-145-40XX
The I2CS_I2C_SSTAT_WR_ERR and I2CS_I2C_SSTAT_RD_ERR are as follows.
Best regards,
Yocchi