I have two ESP32-C3 Super Mini, that are connected to their respective pins for I2C, which is Pin 8 for SDA and Pin 9 for SCL. There is a pullup resistor of 4.7K Ohms on each respective line. Both of the 5V and GND of both of the MCUs are connected.
On the Master's side I have a simple script to search for I2C-devices:
byte error, address;
byte n_devices = 0;
uint8_t devices[127];
for (int i = 0; i < 127; i++) {
available_devices[i] = false;
}
for (address=1; address<=127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0){
devices[n_devices] = address;
available_devices[address-1] = true;
n_devices++;
}
}
if (n_devices > 0){
ws.textAll("THERE ARE DEVICES CONNECTED");
} else {
ws.textAll("Haven't discovered any devices...");
}
(I am also running a websocket-server asynchronously)
Now, when I connect the slave ESP32 with the following setup()-code
#define I2C_SLV_ADDR 0x55
void setup() {
Wire.begin(I2C_SLV_ADDR);
Wire.onReceive(onReceive);
Wire.onRequest(onRequest);
}
the master doesn't recognize the ESP32. But as soon as I connect a device that supports I2C (servo controller) it recognizes the servo-controller without problems.
Where could the problem lay in?
What voltage are your pullup resistors connected to? If 3.3V, 4.7K is probably too high a value.
I put them at the 3.3V line. Though, as mentioned, it did work with the servo-controller. Should it be a different resistor-value? (I tried 10k as well, no luck)
For 3.3V, I would try 3.3K. And I'm glad to hear that you didn't pull up to 5V.
No, sadly it still didn't work.
I think it's best to send a picture of the setup
both didn't work
but as mentioned before, using 4k7 on a servo-controller did work
First figur-out the correct header pins for SDA/SCL signals:
I have tested initiating I2C over GPIO 4 SDI and 5 SCL, but to no avail, instead it led to worse results, making the MCU unresponsive (I am not getting any response per websocket). But in theory, shouldn't any pin-setup for the I2C work?
I am currently just applying:
#define I2C_SDA 4 // 8 prior
#define I2C_SCL 5 // 9 prior
...
Wire.begin(I2C_SDA, I2C_SCL);
on the slave
#define I2C_SLV_ADDR 0x55
#define I2C_SDA 4 // 8 prior
#define I2C_SCL 5 // 9 prior
...
Wire.begin(I2C_SDA, I2C_SCL, I2C_SLV_ADDR);
I sadly don't have an oscillograph, so I cannot analyze the proper signal transmission.
Small update edit
I looked up the declaration of the begin()-method.
I haven't tried it properly, but I assume that I should change the slave-setup() to
Wire.begin(I2C_SLV_ADDR, I2C_SDA, I2C_SCL, 1e5);
I'll check up on it, as soon as I get my hands on it.
Hi! Welcome to the Forum.
If you don’t mind me asking: why do you need I2C to connect these two boards if you can exchange data between them wirelessly (e.g. ESP-NOW)?
I I’m planning to build a modular network-system, which would consist of several ESP modules. Yes, ESP-NOW would be a valid alternative. Though I was asking myself, how much it would interfere with the use of WiFi AP and ESP-NOW simultaneously.
Either way, there are alternatives, but figuring this problem out is still important to me.
Your I2C scanner on the master detects another slave, you said. So your master seems to be working.
So let's see your complete slave sketch.
That were the most complicated hours of trial and error since A LONG TIME... 
Since the master works, I didn't really change anything there. BUT the Wire.begin() is weird, especially if you want to set up different Pins and a specific address.
So, there is a specific method called Wire.setPins() which specifically awaits the Pins for SDA and SCL.
So instead of writing everything into Wire.begin() you write
Wire.setPins(SDA_PIN, SCL_PIN);
Wire.begin(SLAVE_ADDRESS);
A GRAND oversight, but whatever, we all learn something new. It works now!!!
Also, using GPIO 4 and 5 didn't work for some reason, but that's a different topic.
Finally, which pins are working for SDA and SCL in your board which I think is the following one:
The same as in the graphic: 8 SDA, 9 SCL