- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the CCG3PA as a slave device. I am using the callback example provided and seem to only send one byte when the master polls. In this particular case, when the master polls, the slave should respond with 4 bytes. I am getting the first one with 0xFFs after that. The clocks are being sent by the master so it isn't the master. I am looking at the signals with a scope. It seems that the slave is not sending the whole buffer. I initialize the buffer with I2C_1_I2CSlaveInitReadBuf(). The callback simply sets a flag and my loop is per the example, i.e. checks flag and master write complete. A small snippet of code which is almost identlcal to the example is below. The ISR is a stock generated ISR which looks like it will send until the buffer size has been sent.
Any help will be appreciated.
// Master has finished writing to the slave
if (I2CFlag)
{
I2CFlag = false;
/* Check if master write is complete */
if (0u != (I2C_1_I2C_SSTAT_WR_CMPLT & I2C_1_I2CSlaveStatus()))
{
/* Validate the packet frame */
//uint8_t packet_size = I2C_1_I2CSlaveGetWriteBufSize();
/* Check start and end of transmission characters */
pd_control_parse_message(); /* fills buffer with response */
/* Clear the slave write buffer for next write */
I2C_1_I2CSlaveClearWriteBuf();
(void) I2C_1_I2CSlaveClearWriteStatus();
}
/* Read Complete: Expose buffer to master */
if(0u != (I2C_1_I2C_SSTAT_RD_CMPLT & I2C_1_I2CSlaveStatus()))
{
/* Clear the slave read buffer for next read */
I2C_1_I2CSlaveClearReadBuf();
(void) I2C_1_I2CSlaveClearReadStatus();
}
}
if(error_detected == true)
{
//HandleError();
}
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
How did you set the read buffer? Is it possible to debug with uart print?
Regards,
Eddie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Turns out that the issue was with the master.