Hello Everyone,
I am using esp32s2 wroom board. I have I2C salves EEPROM and RTC. I run the I2C scanner but no device is coming. Hardware is fine and I also have 4.7k pull up resistor. I found some issue in GitHub but it is not working. (https://github.com/espressif/arduino-esp32/pull/4776)
Wire.begin(I2C_SDA, I2C_SCL,frequency);
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the 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.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
How about editing your post with the code and using those code tag thingies?
#include <Wire.h>
#define I2C_SDA 40
#define I2C_SCL 41
#define frequency 100000
void setup()
{
Wire.begin(I2C_SDA, I2C_SCL,frequency);
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the 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.print(address,HEX);
Serial.println(" !");
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); // wait 5 seconds for next scan
}
@J-M-L I tink there is no issue with board,I have taken I2C wires from this board and connected to my arduino UNO and I2C scanner is working there. Problem is with wsp32s2. it seems some problem in i2c driver library