1

I have an ESP-WROOM-32 (I2C master) and an ATmega328p (I2C slave, address 0x03) assembled on a prototype pcb using external 6k8 pullups. I'm using the ESP's default I2C pins 21 (SDA) and 22 (SCL) as I always did, but when running the I2C scanner below, I do not observe any communication on the bus. SDA remains on high, SCL on low. The same sketch works as expected when I flashed it to another individual ESP32 (there I see communication on the bus and the slave is recognized at address 0x03). I'm very confused by that! I'm pretty sure there is no hardware issue on the pcb, because I verified it on a breadboard before giving it to the manufacturer and I have also tested the circuitry with a multimeter after the assembly. Also toggling pins 21 and 22 in software with high frequency works as intended. When I connect the other ESP32 to the same hardware, the signal has sufficient quality and is (at least) there.

As I don't think it has anything to do with my circuitry in general I wonder if there is a chance, that my ESP has been persistently misconfigured or if there are different firmware versions flashed by the manufacturer… Before debugging with my oscilloscope I flashed sketches that use the Wire.h, drivers/i2c.h and /peripherals/i2c.h, where I2C was set up on different pins (right now I dont’t have access to those pins due to a shielding, so I can't check if there is a signal output). Does one of those libraries store any I2C configuration to SPIFFS or something like that?! Has anybody ever made the experience that gpios 21 and 22 show no activity with well known software, it seems like the interface was not even initialized? I can’t imagine I have a faulty chip... Any ideas?

The used I2C scanner (but I reproduced the problem with anythinhg I did with Wire.h, drivers/i2c or peripherals/i2c.h):

#include <Wire.h>

#define SDA_PIN 21
#define SCL_PIN 22

void setup () {
  Wire.begin(SDA_PIN, SCL_PIN);
  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.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(1000);
}

closed as off-topic by Chris Stratton, MatsK, Bence Kaulics, hardillb, Helmar Aug 30 '18 at 8:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Internet of Things, within the scope defined in the help center." – Chris Stratton, MatsK, Bence Kaulics, hardillb, Helmar
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    No, there is no persistent storage. One thing that stands out is that your pullup resistors are several times larger than recommended. More generally, this is really an Electrical Engineering question about the details of a local peripheral bus, rather than an IoT question, so you will receive the most assistance by deleting the question here and then posting it (with as much supporting information as possible - ideally a schematic) on Electronics Stack Exchange. – Chris Stratton Aug 29 '18 at 2:55
  • 1
    As communication works with a different ESP (the faulty one still assembled) and there is nothing special about the circuitry I believe it must be a problem on the software side. I mean, there is no change in voltage level on both involved pins (when using i2c, setting gpios with high frequency works), which makes me think that they aren't even toggled... – Sim Son Aug 29 '18 at 3:19
  • 1
    Unless you are loading different software, a difference between results with different instances of hardware is quite unlikely to be a software issue. Regardless, your resistors are above specification (which is a suspect for any inconsistency), and this is not the proper SE site on which to ask a question about I2C. Naturally, to accurately monitor voltage of an I2C (or any time-domain communication) bus requires an oscilloscope, not a voltmeter. – Chris Stratton Aug 29 '18 at 3:33
  • 1
    yes, i've been using an oscilloscope. I just used the multimeter to check if all connections are correct and if I don't have any short-circuits.. My hardware and even communication works (!) when I use a different device. The only difference I can imagine is, that I flashed the faulty ESP with different sketches and pin configuration before. I'll leave this on this site for a while but will move it to electronics section by the day... thx, Chris – Sim Son Aug 29 '18 at 4:03
  • 1
    SCL stuck low typically indicates either an electrical fault, oversize pullup resistor (as previously mentioned) or a peripheral stuck in an improper state and stalling/jamming the bus as a result. But the issue remains that you are asking this question on the wrong site. If you want to solve it, you'll need to move this question to EESE where it is actually on topic. – Chris Stratton Aug 29 '18 at 4:07

Browse other questions tagged or ask your own question.