Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: [ESP-12F] XinaBox CW01
- Core Version: [2.5.0] Latest board file in Arduino
- Development Env: [Arduino IDE 1.8.8]
- Operating System: [MacOS ver 12.0.3]
Settings in IDE
- Module: [Generic ESP8266 Module]
- Flash Mode: [DOUT]
- Flash Size: [4MB]
- lwip Variant: [v2 Lower Memory]
- Reset Method: [ck]
- Flash Frequency: [26Mhz]
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [115200] (serial upload only)
Problem Description
While ESP8266(I2C Master) to ESP8266(I2C Slave) works, with a pinch†, I cannot get ESP8266 to work as an I2C Slave towards Raspberry Pi, Micro:Bit and others.
The sketch below works perfectly as an ESP8266 I2C slave used with a ESP8266 I2C Master, but not otherwise.
I can detect‡, the slave on a RPi using i2cdetect -y 1
, but can't communicate with the slave. I have tried frequency change, clock stretching in Arduino, 3 different libraries on the RPi, and I have tried in MicroPython on a Micro:Bit to no avail.
† In order to have the ESP8266 Master to work, I have to call the Wire.begin()
with an address, like a Master address, that is not standard, but otherwise it won't work for me.
‡ i2cdetect -y 1
only works 80% of the time, and while seemingly high, it is not 100% of the time like with all other I2C slaves.
MCVE Sketch
#include <Wire.h>
void requestEvent() {
Wire.write("At your service!");
}
void setup() {
Wire.begin(2,14,0x08);
Wire.onRequest(requestEvent);
}
void loop() {
}
Debug Messages
Debug messages go here
More attempts: Just to make sure I haven't lost it, I tried with another WiFi board, the Arduino MKR1000, and the above code (except for the pin allocations), and it worked perfectly.
Here is the RPi code, btw:
import pigpio
pi = pigpio.pi()
handle = pi.i2c_open(1,8,0)
(count, data) = pi.i2c_read_device(handle, 16)
print(data)
pi.i2c_close(handle)
pi.stop()