SDA line is always pulled low in ARDUINO

Hi, I was trying to debug an I2C hang problem in my arduino circuit and I noticed that the board which does not work has the SDA line always pulled low and as a result communications in Wire library seem to hang. This seems to happen to my atmega328 based circuits after I use them couple of times. I tried to debug further and I noticed that even when I upload a blank sketch in Arduino , which has SDA and SCL lines pulled up via 2.2K ohm resistor, the SDA line shows a voltage of 0.3V, while SCL shows 5V. Is my IC damaged? How do I debug the issue? thanks, ravi

It might be damaged, but there might be some kind of shortcut on the pcb board as well. Anyway, you can't use a board that keeps the SDA line low :'( Are you sure you have used the right pins ?

These are my hand created boards and maybe causing the issue. Yes, I am sure the pins that I am looking at are right - A4 and A5 pins on ATMEGA328

ravipr: These are my hand created boards and maybe causing the issue. Yes, I am sure the pins that I am looking at are right - A4 and A5 pins on ATMEGA328

Do you have your 4.7k pullups on both SDA and SCL?

can you upload a simple sketch that just toggles these pins to test them, something Like this:

void blink(uint8_t pin){
pinMode(pin,OUTPUT);
digitalWrite(pin,HIGH);

pinMode(LED_BUILTIN,OUTPUT);
digitalWrite(LED_BUILTIN,HIGH);
delay(1000);
digitalWrite(pin,LOW);

digitalWrite(LED_BUILTIN,LOW);
delay(1000);
pinMode(pin,INPUT); // input mode, pullup off
delay(500);
digitalWrite(LED_BUILTIN,HIGH);
delay(500);
digitalWrite(pin,HIGH); // turn on pullup
delay(200);
digitalWrite(LED_BUILTIN,LOW);
delay(200);
digitalWrite(LED_BUILTIN,HIGH);
delay(100);
digitalWrite(LED_BUILTIN,LOW);
digitalWrite(pin,LOW); // pullup off
}

void setup(){
while(true){
  blink(A4);
  blink(A5);
}

void loop(){}

if you monitor the pins (A4,A5) you should see them toggle up and down.

chuck.

Hi Chuck, I will try this and get back. But I remember that blink worked - and perhaps because it specifically declares pinMode. Having said that, I will try your sketch and get back. thanks, ravi

I do notice a difference between A4 and A5 driven LEDs. A5 goes high, off , dim and off. While A4 goes HIGH, LOW and so on. I believe dim corresponds to the pull up on mode and SDA pin does not DIM the output.

ravipr: I do notice a difference between A4 and A5 driven LEDs. A5 goes high, off , dim and off. While A4 goes HIGH, LOW and so on. I believe dim corresponds to the pull up on mode and SDA pin does not DIM the output.

What is the circuit connected to A4, A5?

Chuck.

When I uploaded the sample sketch you mentioned, it was just two LEDs. The actual circuit has therm connected to other I2C slaves with both lines pulled up by 10k resistor. I have also tried 2.2k

When I uploaded the sample sketch you mentioned, it was just two LEDs. The actual circuit has therm connected to other I2C slaves with both lines pulled up by 10k resistor. I have also tried 2.2k