Trying to read from a BMI270 accelerometer with a custom PCB I made that uses an ESP32-WROOM-32E. Due to the layout of the board, I did not use the default I2C pins to connect to the BMI270. The rest of the PCB is functioning as intended, but I am not able to detect or read data from the BMI270 over I2C.
I'm using GPIO34 and 35 as SCL and SDA, respectively. I tried modifying the BMI270 examples to specify the I2C pins, which didn't work, and I've tried using the following I2C scanner sketch, but it does not find any devices.
#include <Wire.h>
#define I2C_SDA 35
#define I2C_SCL 34
void setup() {
Wire.begin(I2C_SDA, I2C_SCL);
Serial.begin(115200);
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ ) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
nDevices++;
}
else if (error==4) {
Serial.print("Unknown error at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
}
else {
Serial.println("done\n");
}
delay(5000);
}
I can switch the accelerometer to use the default I2C pins, but that would require cutting traces and hand soldering to the ESP32, so I want to see if the issue is in software before doing so.
Maybe someone can catch what I'm missing here ![]()
Thanks!