How do you implement an I2C Slave to look like a memory?
Here is what I am trying to Implement. To make the I2C Slave look like a memory to the master.
Syntax is one of two cases.
For a Write:
<Dev Add W><MemAdd MSB><MemAdd LSB><Data0><Data1>...<Data N><Stop>
For a Read:
<Dev Add W><MemAdd MSB><MemAdd LSB><Restart Dev Add R><Data0><Data1>...<Data N><Stop>
I am on the first step. I want to use DMA because I do not want interrupts firing on every byte. My processor has to do other things like data collection, and not just mind the I2C.
I think I have to use the HAL_I2C_Slave_Seq_Receive_DMA() and HAL_I2C_Slave_Seq_Transmit_DMA() routines.
There is a XferOptions parameter, and I can not figure out what to use for the initial read (from the slave point of view.) .
It does not matter which one I use, I get an error.
I am looking for one that gracefully ends with a stop or a restart. Because in the write case, they could write 2 bytes at the address, or could write 2 more bytes at the next address. I am limiting them to a total of 8 words or 16 bytes.
In the case of a read they just write the 2 address bytes then do a restart.
Is the answer to just ignore the errors and continue? I really do not like having a product with functions throwing error interrupts.
Thanks in advance.
Kip
