Is there a way to detect if an I2C_slave component received a read/write operation from it's master?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello

I'm trying to debug my project and I would just like to know if there is anyway I can detect the interrupt service that creates a response on the I2C_slave component when a master sends a read/write. According to the API in the datasheet I can't seem to find any function that would give me that kind of information.

Thank you!

0 Likes
1 Solution

The slave can be observed using I2CSlaveStatus(void) API. Bits need to be cleared using I2CSlaveClearReadStatus(void). See datasheet.

Bob

View solution in original post

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The slave will acknoledge every master action. This is reflected in the status byte returned by all the basic I2C APIs.

Use sendStart(), Write(), SendRestart(),ReadByte() and SendStop(). Check all returned status for zero meaning success.

Bob

0 Likes
Anonymous
Not applicable

Thank you Bob

Those are I2C_master functions though and I'm trying to do that with I2C_slave functions. Is it possible?

0 Likes

The slave can be observed using I2CSlaveStatus(void) API. Bits need to be cleared using I2CSlaveClearReadStatus(void). See datasheet.

Bob

0 Likes
Anonymous
Not applicable

Other than that, which I can see from the datasheet, is there anything I can get from the slave to tell me how many bytes have been requested by the master or when were those bytes requested? Or do I have to rely on just 3 slave status constants to try and debug my program?

Thanks

0 Likes

I2CSlaveGetReadBufSize(void) API returns the number of bytes read by the master from read buffer. See datasheet

Bob

0 Likes