I am using an ESP32 to receive data from web. However in an I2C communication, the EPS32 does not work as a Slave and i already have an Atmega as the Master.
i have seen sites saying Master-Master I2C Connection is possible however, how do i do this? or are there other solutions to have the ESP32 communicate to the ATMega?
-
I don't have much experience with I2C, but there are other ways, like UART, or SPI.Michel Keijzers– Michel Keijzers2020年02月07日 09:06:08 +00:00Commented Feb 7, 2020 at 9:06
1 Answer 1
Both your master devices must support Multimaster mode, i.e. Arbitration and Synchronization. See I2C Spec here for a description of the arbitration process.
It's up to you to handle a lost arbitration in your software.
or are there other solutions to have the ESP32 communicate to the ATMega?
Of course. As you considered I2C to be sufficient, UART and SPI are feasible alternatives supported by almost all microcontrollers.
-
what do you recommend i do here? use multiple communication styles? I2C and SPI?since all i need is to have 2 master device communicate, while only the other master communicate with the slaves.Julius– Julius2020年02月09日 13:58:11 +00:00Commented Feb 9, 2020 at 13:58
-
@JuliusNoelBanayo Depends on your requirements. If you only have to transmit some bytes every 100ms, I2C may be the most economic solution (Multimaster mode is supported by ESL32 and Atmega). If there's much more data and/or you need it fast, you should consider SPI.mic– mic2020年02月10日 15:04:11 +00:00Commented Feb 10, 2020 at 15:04