In an existing project I am emulating an I2C EEPROM using a microcontroller acting as an I2C slave device. I'm thinking about whether there's a way for the master I2C device (a Raspberry Pi) to be able to read certain other data (some kind of status info, etc.) in a kind of 'out-of-band' manner - that is, such that a request to read that data is distinct from reading the emulated EEPROM data.
The first thing I thought of is to simply use some memory addresses outside the normal range of the emulated EEPROM. For example, if I'm emulating a 24C32 EEPROM, it has a capacity of 4096 bytes and only 12-bits (out of 16) of the read/write address are significant. This means the top 4 bits are normally unused, so I could possibly use for example 0xF000 and upwards for reading 'out-of-band' data.
I was thinking of making it so that there is a defined range of 'registers' in this out-of-range address space, so if the master device wants to read one it simply does a selective single-byte read at that address. That is, it issues an I2C write with the relevant address, then reads a single byte. I suppose in the case of a sequential read by the master (it writes an address, then reads multiple bytes), I could do one of two things: a) repeat the same register's data byte over and over again; or, b) increment to the next register, return its data byte, and so on, wrapping the address within the range of registers if the end is reached. Not sure which would be best.
Does anyone have any other ideas? Any gotchas with my proposed approach?