I am working on the 24LC256 EEPROM, wired as such, except 3.3v to the EEPROM, with 'scope clamped on SDA and SCL. I'm using an address scanner script with a few tweaks, 57600 baud, 10kOhm pullups, 100000 I2C clock, and some serial prints for snooping:

for(address = 1; address < 127; address++ ) {
    Serial.printf("\n%02x", address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.printf("I2C device found at address 0x%02x", address);
      Serial.println("  !");

When the loop hits the address corresponding to the jumpers (pins 1, 2, 3 correspond to address 0b01010abc, aka 0x5?, where ? = binary encoding of those pins), it just sorta hangs:


(here I have 1, 2, 3 all low, so the chip responds to addr 0x50). Since it's hitting , but not ., I know it's hanging at Wire.endTransmission(). It always hangs at endTransmission at the address encoded by the jumpers. SCL is low and SDA is high.

Scope trace looks fine counting through the addresses.

Trace of address not found.

Trace of hanging at address.

gif of cycling through last few addresses.

I'm on an Adafruit Feather nrf52 BLE, if that matters.

migrated from electronics.stackexchange.com Mar 28 '18 at 3:13

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Can you check, which circuit is holding SCL low? (The feather or the EEPROM) SCL can be hold low by the slave for slowing down the master, if the slave is not ready or needs some time to process previous data. – chrisl Apr 2 '18 at 11:58
  • @chrisl how can I check that? I tried sticking my scope on a shunt resistor on SCL, that just pulled everything low (probably b/c of the scope ground). I think I need an inamp or something. – DeusXMachina Apr 5 '18 at 0:42
  • Then you most likely connected it wrong. The scope has a high impedance, it should not pull anything down. Measure the voltage with the scope between the SCL pin of the feather and ground of feather – chrisl Apr 5 '18 at 11:07
  • How does that tell me whether master or slave is pulling it low though? – DeusXMachina Apr 5 '18 at 19:46
  • Sorry, should have described it. Attach the scope to feather SCL. When SCL is low, unconnect your slave and check the voltage again. If it goes up the slave was holding it low – chrisl Apr 5 '18 at 21:15

Because of the way that the I2C library works, the only place it can hang is on the endTransmission. The other calls just buffer stuff up in memory.

There is probably some electrical issue. For example, the pull-up resistors might be better as 4.7k.

There is another library which handles transmission a bit differently which might resolve the hanging.

However if it is hanging there are probably other issues (cable lengths, pull-up resistors, noise) that are the underlying issue.

The standard library waits in a tight loop for certain interrupts to arrive, and if they don't arrive it hangs indefinitely.

except 3.3v to the EEPROM

You may well need a level-shifter. It's all very well only sending out 3.3V to the EEPROM, but the rest of the circuit is dealing in 5V not 3.3V. You can get suitable level shifters quite cheaply.

Why are you using 3.3V anyway? That chip can handle 5V. I have a post about that exact chip which works fine there.

  • Hi Nick, I'm using 3.3 because the NRF52's logic pins are all 3.3. I should have made that more obvious. The Feather nRF52 is 3.3, so the whole layout is on 3.3. The source image I used shows an UNO. The EEPROM should handle 1.8-5.5V. But I think you are right about the pull up resistors. I've been reading that I2C is very touchy when it comes to capacitance of the system and the rate of those pull ups. – DeusXMachina Mar 29 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.