Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By rajdarge
#32961 Up till now I've been using serial comms between an ESP8266 12E and a STM32 and the code has to take in to account that the MC are much faster than the serial comms, and accumulate serial data on successive loops.
Both devices are using their respective I2c buses - EPS8266 is connected to a RTC and Accelerometer (though I haven't tested this code yet).
and the STM32 is connected to an LCD panel and an ambient light IC.

So why not use the I2c bus to communicate between the devices?

Are there any caveats or gotcha's that I have to be aware of before I attempt this. I see Uno to Uno tutorials around the net (and on Arduino.cc) but I haven't seen the above setup. I see some with pullup resistors, some without, do I need to have pullup resistors if I have devices on the bus already?
User avatar
By lethe
#32967 If I got you right, you are already using both the STM32 and the ESP as I2C masters. Since there can only be one master on a bus, you can't join those busses.
Also the ESP does not have I2C hardware, the implementation is bit-banged in software and thus may be susceptible to timing glitches due to interrupts.
User avatar
By rajdarge
#33009 Thanks for the info
Ok, since I'm new - if I set the stm32 as a Slave (is that possible?) does that mean it will lose control of the lcd it is now using? Slaves can't talk to each other? Is there some way of choosing master/slave etc? The stm32 has two i2c buses would it be a better idea using that?
The esp8266 bit banged i2c has been a little unstable, I have discovered
User avatar
By martinayotte
#33022 Yes, you can use two I2C Bus on the STM32, having one been slave to the ESP and the other been master of all peripherals.
About PullUps, whatever how many devices you have on the bus, you need those PullUps, about 4K7, since all devices are actually driving the bus with OUTPUT_OPEN_DRAIN mode.