Resolving I2C Timeout Error When Updating STM32G4 Firmware with ESP32

Hi guys i'm trying to use an ESP32 to update the firmware on an STM32G4 over I2C, but I'm getting an I2C timeout error when trying to initiate the update. I've connected the SDA and SCL pins, and I'm controlling the BOOT0 and RESET pins on the STM32G4. My ESP32 is running a custom Arduino sketch for I2C communication, and the STM32G4 has a minimal bootloader expecting I2C programming mode. ESP32 I2C Connection Code :
Wire.begin();
if (Wire.beginTransmission(0x58) != 0) { // 0x58 is the STM32G4 I2C address
Serial.println("I2C timeout");
return;
}
Wire.begin();
if (Wire.beginTransmission(0x58) != 0) { // 0x58 is the STM32G4 I2C address
Serial.println("I2C timeout");
return;
}
I expect the ESP32 to connect to the STM32G4, enter programming mode, and update the firmware. Instead, I get the I2C timeout error. Any advice on how to resolve this issue would be greatly appreciated.
3 Replies
Marvee Amasi
Marvee Amasi4mo ago
Check your wiring and your pull up resistors The SDA data line on ESP32 should be connected to SDA on STM32G4 SCL clock Line on ESP32 should be connected to SCL on STM32G4 BOOT0 and RESET should be controlled properly to put the STM32G4 in bootloader mode Even the pull up resistors , I2C needs pull up resistors mainly about like 4.7kohms or 10kohms on both SDA and SCL lines. If these resistors are missing, I2C communication can fail normally
Daniel kalu
Daniel kalu4mo ago
I'll double-check the wiring and add 4.7kΩ pull-up resistors to both the SDA and SCL lines, as I hadn’t included them initially. Then make sure that BOOT0 and RESET are correctly toggled to put the STM32G4 into bootloader mode. I'll update if anything goes wrong Thanks again for pointing that out 🙏
Marvee Amasi
Marvee Amasi4mo ago
Yh lets see if the issue still persists after that
Want results from more Discord servers?
Add your server