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. Feb 7 '20 at 9:06

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
    Feb 9 '20 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
    Feb 10 '20 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.