I want to make an I2C bus where after a master requests information from a slave, the response from the slave is listened by all the other slaves. I tried to take the arduino Wire library and tweak it to achieve this; but soon learned that most of the Wire interface is implemented in the AVR hardware (AtMega2560, and I think Atmega 328). What would be the best strategy to achieve this? My sense tells me that there should be no conflicts with the current I2C protocol, because there is no additional writings to the bus than how it currently is.
I have been reading the data-sheets and protocol specifications, but it remains obscure to me because of ignorance around the subject.
- can it be done using the TWAMR register? In that case, I think that I would need to recognize by software the read requests, so not all the nodes in the bus answer to read calls. The question is whether a 0xFF TWAMR mask would make all slaves to listen to the other slave's response
- If a slave answers a read request with a general call (0x00), would all the other slaves recognize the slave general call? My intuition says that they wouldn't
- Should I think instead about switching the roles of the slaves into master writers during runtime, to enable them to generate general calls? How bad of an overhead could result from this?
In parallel I developed a token ring based protocol, that is built upon RS232, which works well; but I expect that TWI will allow a higher bitrate than RS232; and also take less processing power. (I can poll 14 times a second a network of three nodes that answer with 6 byte payload each) Are these assumptions right? or I should stay with the made-up protocol?