Examples of using the HAL libraries for using I2C as both master and slave on a single I2C interface, i.e. in a multi-master configuration?
Hi there,
I'm trying to implement a multi-master I2C network, where there are several nodes (around 6), any of which can send a message to any other. In other words, all nodes usually acting as slaves, waiting for incoming I2C messages. When any node decides it wants to send a message, it momentarily becomes a master and sends its message to the slave it wants to. (Sort of like Ethernet: any node can initiate a transmission to any other node.) The sender is always the master, and the receiver is always the slave.
The I2C standard supports such multi-master configurations, and I wrote software for the ATmega several years ago that does this. I've decided to port it to the STM32, and though there are 20+ I2C examples in the HAL driver library, none of them demonstrate what I'm trying to do. All the examples require you to compile the code in either master mode or slave mode; none show both modes in use on the same CPU.
Are there any (simple) examples of how to do this with STM32's HAL library?
Regards,
-Jeremy
