Esp32-s2 I2C problems

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 : 0x40027031

Backtrace: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.

Hi @who_took_my_nick
More details of your project.
Sketch, libraries, schematic, etc...

RV mineirin

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 : 0x40027031

Backtrace: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.

1 Like

You are THE savior.

There are some additional glitches, but I will try to work it on.