I am struggling to get I2C working on my ESP32-s2 saola board, has anybody had any success with this. If I try scanning for I2C ports, the code works on my Uno board, however when I try the same code on the ESP32-S2 the board throws an exception at the point where it runs the Wire.endTransmission(); and continuously resets.
I am new to this so would appreciate any help/ example setups etc.
Hi,
see if this sketch works on your ESP32S.
RV mineirin
What pins are you using for SDA/SCL? Do you have external pullups to 3.3v on them?
What i2c device are you trying to find? Is is a 3.3 or 5v device? Does it have built in pullups?
ESP32S is not the same as ESP32-S2.
Btw, I have the same problem
According to pins_arduino.h file, I2C pins are 8 and 9. But, no matter if I connect anything on it, I get the same.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40081256 PS : 0x00060830 A0 : 0x80081074 A1 : 0x3ffc8610
A2 : 0x00000000 A3 : 0x00000001 A4 : 0x3ffc2616 A5 : 0x00000000
A6 : 0x3ffc8864 A7 : 0x00000032 A8 : 0x80081253 A9 : 0x3ffc85d0
A10 : 0x00000000 A11 : 0x3ffc2616 A12 : 0x00000000 A13 : 0x00000001
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000016 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000001 LCOUNT : 0x40027031Backtrace:0x40081253:0x3ffc8610 0x40081071:0x3ffc8630 0x400810e5:0x3ffc8650 0x40080eb3:0x3ffc8670 0x40081ab9:0x3ffc8690
ELF file SHA256: 0000000000000000
This is output of I2C scanner. And as I can see, we are not the only ones.
No libraries, sketch is an I2C scanner from Arduino. There is nothing on the I2C lines. It should return No I2C Devices found, or so
I am using a UM FeatherS2 with Arduino15\packages\esp32\hardware\esp32\2.0.0-alpha1 installed through the board manager. This version supports the S2 and S3. With pullups on SDA(IO8) and SCL (IO9) the scanner program compiles and runs, with this output as expected
I2C scanner. Scanning ...
Done.
Found 0 device(s).
// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
#include <Wire.h>
void setup() {
Serial.begin (115200);
// Leonardo: wait for serial port to connect
while (!Serial)
{
}
delay(5000);
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
for (byte i = 8; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
} // end of setup
void loop() {}
Using library Wire library version 1.0.1 in folder: C:\Users\me\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-alpha1\libraries\Wire
I2C scanner. Scanning ...
E (10156) i2c: i2c_param_config(644): i2c clock choice is invalid, please check flag and frequency
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.Core 0 register dump:
PC : 0x40081236 PS : 0x00060d30 A0 : 0x80081054 A1 : 0x3ffc8600
A2 : 0x00000000 A3 : 0x00000008 A4 : 0x3ffc2616 A5 : 0x00000000
A6 : 0x3ffc8864 A7 : 0x00000032 A8 : 0x80081233 A9 : 0x3ffc85c0
A10 : 0x00000000 A11 : 0x3ffc2616 A12 : 0x00000000 A13 : 0x00000001
A14 : 0x00000000 A15 : 0x3f002504 SAR : 0x00000016 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000001 LCOUNT : 0x40027031Backtrace:0x40081233:0x3ffc8600 0x40081051:0x3ffc8620 0x400810c5:0x3ffc8640 0x40080ea9:0x3ffc8660 0x40081a72:0x3ffc8690
ELF file SHA256: 0000000000000000
Rebooting...
It says to add:
i2c_config.clk_flags = 0;
to config section. But where?
What core are you using?
Why not use 2.0.0 alpha1 core through the board manager? Just add the development link to the additional board mangager urls's in preferences.
ESP32-S2 and ESP32-C3 Support
If you want to test ESP32-S2 and/or ESP32-C3 through the board manager, please use the development release link:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
and install the latest 2.0.0 version.
You are THE savior.
There are some additional glitches, but I will try to work it on.
I am having the same issue. I tried the solutions above but they don't work.
I am using an ESP32-S2 Saola 1M, I am using the esp32 2.0.0-rc1 library in the board manager. It's using Wire 2.
Any ideas?
This is the i2c scanner code I am using:
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
*********/
#ifdef CORE_DEBUG_LEVEL
#undef CORE_DEBUG_LEVEL
#endif
#define CORE_DEBUG_LEVEL 3
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <Wire.h>
#define I2C_SDA 39
#define I2C_SCL 40
TwoWire I2CBME = TwoWire(0);
void setup() {
//I2CBME.begin(I2C_SDA, I2C_SCL, 100000);
Wire.setPins(I2C_SDA, I2C_SCL);
Wire.begin();
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("Unknow 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);
}
Might be a little late, but I had the same problem on a number of different S2 boards, with 2.0.0-rc1. I just noticed 2.0.0-rc2 was available and it fixed I2C for me, with defaults SCL on GPIO9 and SDA on GPIO8 on both a ESP32-S2-DevKitM-1 and a UM Tiny S2
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.