In a previous post (https://ez.analog.com/dsp/sharc-processors/adsp-sc5xxadsp-215xx/f/q-a/63812/twi-slave-example-who-gots?ReplySortBy=CreatedDate&ReplySortOrder=Ascending) a partial example of some TWI Slave code was posted in response to misterdsp posting a query. I have the same issue of finding a working example of TWI Slave mode.
The example which was posted didn't provide all of the code. It was missing TWI_fillTransmitBuffer() & TWI_receive() from the code. I've tried creating the equivalent routines myself, but I can't seem to make the TWI work correctly when using a RaspberryPi 3B and the i2c utils as the master. I can get some very simple interactions to work (single byte write, word read), but anything more complex (reading 5 bytes) fails. I'm suspecting there is some special handling that is going on in the receive and transmit code that I'm missing.
If anyone has a complete example of a TWI Slave that can handle read/write with multiple bytes (basically act like an i2c EEPROM) I would love to see that example!