Damaged I2C bus?

Hi all,

I don't have much experience with I2C so perhaps I'm doing something wrong here.

I'm trying to connect a SD1306 based display to Arduino Mega 2560. When running example from Adafruit_SSD1306 library it hangs on display.begin(...) statement, same happens with I2C temperature sensor.

I tried to run diag sketch I2Cexpdiag from hd44780 and I'm getting 'SDA - STUCK LOW' message (full output is below). It happens regardless of whether I2C display is connected to Arduino or not.

Not sure what else I can try here, hope someone could advise on the next step.

SDA digital pin: 20
SCL digital pin: 21
--------------------------------------------------------------------
Checking for required external I2C pull-up on SDA - STUCK LOW
Checking for required external I2C pull-up on SCL - YES
********************************************************************
ERROR: SDA or SCL stuck pin
********************************************************************
I2C bus not usable

run an I2C scanner which should report I2C addresses found on the bus, e.g.
https://playground.arduino.cc/Main/I2cScanner/

horace:
run an I2C scanner which should report I2C addresses found on the bus, e.g.
Arduino Playground - I2cScanner

Ran I2cScanner on an empty board, it got stuck. I added some println statements and found that it hangs on Wire.endTransmission() statement on the first iteration.

Same result with the i2c display attached to the board.

"STUCK LOW" suggests a wiring problem. One possibility is a solder blob is short circuiting the SDA line to ground.

Redo all connections, check them with a magnifying glass and use your multimeter to check for continuity and/or short circuits.

jremington:
“STUCK LOW” suggests a wiring problem. One possibility is a solder blob is short circuiting the SDA line to ground.

Redo all connections, check them with a magnifying glass and use your multimeter to check for continuity and/or short circuits.

Hi jremington, appreciate the advice. Since I have this problem even without anything connected I focused on Arduino itself, here are my findings (all disconnected, power off):

  • resistance between SDA (p20) and 5V is 2kΩ
  • resistance between SLC (p21) and 5V is 10kΩ
  • resistance between SDA (p20) and GND is 1kΩ
  • resistance between SLC (p21) and GND is 11kΩ

I assume that the numbers above are supposed to be the same for SDA and SLC. Since resistance for SDA is much lower, does it indicate the short on the board?

I don’t see any obvious shorts, but not sure what it’s supposed to look like if there is one. Is there some particular place on Mega board I should be paying attention to?

Since resistance for SDA is much lower, does it indicate the short on the board?

The different resistances of SDA and SCL to GND and Vcc suggest a serious problem. However, I would expect 0 Ohms for a direct short circuit. The schematic of the Mega 2560 shows that both pins have external 10K pullups to Vcc. See https://www.arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdf

If there are no obvious problems on the circuit board, it is possible that the SDA pin has been internally damaged.

When measuring resistances between pins and GND or Vcc using a multimeter, be sure to apply the leads both ways around, and use the "diode check" function as well. The input protection or body diodes on the inputs tend to confuse the readings.

If you see very similar readings for both multimeter lead orientations, that suggests you are measuring a genuine resistance value, and not the effects of diode conduction.

Sorry, I don't have a Mega to check. Perhaps someone else will chime in.

AleksGK:
Ran I2cScanner on an empty board, it got stuck. I added some println statements and found that it hangs on Wire.endTransmission() statement on the first iteration.

Same result with the i2c display attached to the board.

if I run the I2C scanner on a Mega I get

I2C scanner. Scanning ...
 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6A 0x6B 0x6C 0x6D 0x6E 0x6F 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77Done.
Found 0 device(s).

scan using an Arduino Due

I2C scanner. Scanning ...
 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29
Found address: 41 (0x29)
 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6A 0x6B 0x6C 0x6D 0x6E 0x6F 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77Done.
Found 1 device(s).

indicating it found a ST VVL53L1X TOF sensor

AleksGK:

  • resistance between SDA (p20) and 5V is 2kΩ
  • resistance between SLC (p21) and 5V is 10kΩ
  • resistance between SDA (p20) and GND is 1kΩ
  • resistance between SLC (p21) and GND is 11kΩ

testing on a mega I get

  • resistance between SDA (p20) and 5V is 10kΩ
  • resistance between SLC (p21) and 5V is 10kΩ
  • resistance between SDA (p20) and GND is 11kΩ
  • resistance between SLC (p21) and GND is 11kΩ

resitance similar with leads the other way around

jremington:
The different resistances of SDA and SCL to GND and Vcc suggest a serious problem. However, I would expect 0 Ohms for a direct short circuit. The schematic of the Mega 2560 shows that both pins have external 10K pullups to Vcc. See https://www.arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdf

Thank you for the pointer. I check schematics and PCB diagram and found a resistor array of 4x10K resistors, it’s marked as RN1. When checking resistors directly on the boards three out of four show 10K and one connected to SDA shows 2K (both directions).

Is there any way to fix it without damaging Arduino any further?

If the pin is damaged, hardware I2C won't work. It can be repaired only by replacing the processor chip.

You could try using software I2C, which allows you to use any two digital pins as SDA and SCL. You probably need to add pullup resistors to both pins (2.2K to 4.7K to Vcc).

a few more tests

I ran this piece of code to measure output on SDA (PIN20)

  pinMode(20, OUTPUT);


  Serial.println("Setting SDA to HIGH for 5 seconds...");
  digitalWrite(20, HIGH);
  delay(5000); // Wait 5 seconds

  Serial.println("Setting SDA to LOW for 5 seconds...");
  digitalWrite(20, LOW);
  delay(5000); // Wait 5 seconds

  pinMode(20, INPUT);

when I set it to high it outputs 0.5V, when set to low it’s 0.4V

The pin does not appear to be functioning correctly.

jremington:
If the pin is damaged, hardware I2C won't work. It can be repaired only by replacing the processor chip.

You could try using software I2C, which allows you to use any two digital pins as SDA and SCL. You probably need to add pullup resistors to both pins (2.2K to 4.7K to Vcc).

yes, this could be a good alternative for me. I found SoftI2CMaster library and managed to run a successful i2c scan that detects my device.

My next challenge is to find SD1306 display library that is compatible with my software i2c library, no luck so far.

AleksGK:
My next challenge is to find SD1306 display library that is compatible with my software i2c library, no luck so far.

have a look at

to get it working on a PIC24 I edited two functions ssd1306_command() and SSD1306_Display() to call the PIC24 I2C write slave functions.

Thank you for the pointer, I will have a look.

Last night I played with U8g2 library (GitHub - olikraus/u8g2: U8glib library for monochrome displays, version 2). It supports software I2C, lots of display controllers and, in text mode, does't take much of RAM.