ESP32-C5 as I2C slave (onRequest) — master reads nothing. Known issue?

Hellz0wnzJ00
Posts: 1
Joined: Fri Jul 03, 2026 7:33 pm

ESP32-C5 as I2C slave (onRequest) — master reads nothing. Known issue?

Postby Hellz0wnzJ00 » Fri Jul 03, 2026 7:42 pm

Short version: I have two XIAO ESP32-C5 boards wired for I2C — one as master (controller), one as slave (peripheral, addr 0x11). The master polls, but the slave never responds — the master reads zero bytes. I've eliminated wiring, pins, pull-ups, power, swap, and clock speed across two breadboards. I'm trying to find out: does ESP32-C5 I2C slave mode actually work in the current Arduino core, or is this a known bug?

Environment
  • Board: Seeed Studio XIAO ESP32-C5 (x2)
  • arduino-esp32 core: 3.3.10
  • Arduino IDE: 2.3.10
  • I2C pins: D4 (SDA), D5 (SCL) — set explicitly
  • Pull-ups: 4.7k to 3V3 on both lines (rail confirmed at 3.3V)
  • Shared GND, both boards powered by USB
  • Bus speed: tried both 400 kHz and 100 kHz
Slave (peripheral) — minimal version

Code: Select all

#include <Wire.h>
#define I2C_ADDR 0x11

uint8_t buf[46];               // the record the master reads

void onRequest() {
  Wire.write(buf, sizeof(buf));
}
void onReceive(int) {
  while (Wire.available()) Wire.read();
}

void setup() {
  Serial.begin(115200);
  for (int i = 0; i < 46; i++) buf[i] = i;          // dummy payload
  Wire.begin((uint8_t)I2C_ADDR, D4, D5, 100000);    // slave at 0x11 on D4/D5
  Wire.onRequest(onRequest);
  Wire.onReceive(onReceive);
  Wire.slaveWrite(buf, sizeof(buf));                // pre-load response buffer
  Serial.println("slave ready");
}
void loop() { delay(500); }
Master (controller) — minimal version

Code: Select all

#include <Wire.h>
#define I2C_ADDR 0x11

void setup() {
  Serial.begin(115200);
  Wire.begin(D4, D5);          // controller on D4/D5
  Wire.setClock(100000);
  Serial.println("master ready");
}
void loop() {
  int got = Wire.requestFrom((int)I2C_ADDR, 46);
  Serial.printf("requestFrom got %d bytes\n", got);   // <-- always 0
  while (Wire.available()) Serial.printf("%02X ", Wire.read());
  Serial.println();
  delay(1000);
}
Result: on the master, [font=Courier]requestFrom[/font] returns 0 every time — no bytes come back from the slave.

Already ruled out
  • Wiring — verified pin-by-pin against the silkscreen on two breadboards (D4=SDA, D5=SCL, GND shared, 3V3 feeding the pull-up rail).
  • Pin mapping — pins set explicitly to D4/D5, not relying on defaults.
  • SDA/SCL swap — tested reversed, no change.
  • Pull-ups — 4.7k to 3V3, rail confirmed at 3.3V.
  • Clock — tried 400 kHz and 100 kHz.
  • slaveWrite pre-load — tried per the Espressif docs, no change.
  • Slave is alive — it runs Wi-Fi scans and prints normally; it just never answers an I2C read.
Questions
  1. Has anyone run an ESP32-C5 as an I2C slave successfully? Which core version?
  2. Is C5 I2C-slave a known open issue in arduino-esp32 / ESP-IDF right now?
  3. Any workaround — different begin() signature, specific IDF version, HP_I2C vs LP_I2C peripheral, or a lower-level approach?
Happy to run any test that helps. Trying to determine if this is "wait for a core fix" or "C5 slave mode isn't supported yet." Thanks!

Who is online

Users browsing this forum: PerplexityBot and 1 guest