Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 6 months ago.
Should i2c_slave_receive return ACK?
I'm trying to port mbed to a new target platform. I'd like to clarify whether the i2c API i2c_slave_receive() is expected to return ACK or not? If not, when is the device expected to return ACK for an address match? Before the next read/write?
1 Answer
9 years, 6 months ago.
I suspect you mistyped i2c_slave_receive? As this function has this declaration:
/** Check to see if the I2C slave has been addressed. * @param obj The I2C object * @return The status - 1 - read addresses, 2 - write to all slaves, * 3 write addressed, 0 - the slave has not been addressed */ int i2c_slave_receive(i2c_t *obj);
No, sorry for the misunderstanding! I asked whether we should return ACK (to the actual master device) in the implementation of i2c_slave_receive, not about the return value of function.
posted by 13 Aug 2015
Yes the slave will send ACK or NACK. There is a number of sources of information referring to the specification of I2C do a web search. i2c.info, i2c-bus.org and NXP to name a few.
posted by David Fletcher 13 Aug 2015