Hi everyone, I ask for your help with a rather strange problem.
I connected a 20x4 LCD to the ESP32 module with the VIN, GND, SCL (D22) and SDA (D21) connections, and scanned with the code below.
byte error, address;
Serial.println("Scanning...");
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++;
}
}
Result: NO DEVICE FOUND.
if instead I connect it to GPIO 2 and 4, and add the code:
Wire.begin(2,4);
It works fine, although in this case the sketch must be uploaded with the connections disconnected. If you don't, you get this error:
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, Coding Scheme None
Crystal is 40MHz
MAC: 30:ae:a4:1b:70:38
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Warning: Could not auto-detect Flash size (FlashID=0xffffff, SizeID=0xff), defaulting to 4MB
Compressed 8192 bytes to 47...
A fatal error occurred: Timed out waiting for packet content
A fatal error occurred: Timed out waiting for packet content
What am I missing?