Im connecting raspberry pi to arduino through i2c. It worked fine but suddenly it stopped working and I am afraid something have happened to the arduino.
I have connected:
(Pi) SDA -> SDA (Arduino)
(Pi) SCL -> SCL (Arduino)
(Pi) Ground -> Ground (Arduino)
But when I am running
sudo i2cdetect -y 1
suddenly it returns blank:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
When I am connecting another sda device to the pi it however gets detected so there is nothing wrong with the pi.
Is there a possibility I can have fried the arduino?
It however gets detected and I if I upload a simple sketch to it for blinking it works with no problem on both sda 20 and scl 21 pin. It is just the i2c who doesnt get detected anymore
I have also written a simple sketch to display the input value from 20 and 21 on my mega (SDA and SCL).
void setup(){
Serial.begin(9600);
pinMode(,INPUT);
digitalWrite(20,HIGH); // turn on internal pullup resistor
pinMode(21,INPUT);
digitalWrite(21,HIGH); // turn on internal pullup resistor
Serial.println("Booted");
}
void loop(){
static bool pin20=LOW;
static bool pin21=LOW;
if(pin20!=digitalRead(20)){
pin20 = !pin20;
Serial.print("20=");
Serial.println(pin20);
}
if(pin21!=digitalRead(21)){
pin21 = !pin21;
Serial.print("21=");
Serial.println(pin21);
}
}
this returns 0 when when I connect pin to the ground and 1 if not so the input does not seem to be fried or can it be that anyway? Any other way to test arduinos sda and scl?
What else can I check?
- note I accidently posted this in the wrong category so sorry for that. hopefully the moderator can delete that message so Im not doubleposting:
have i fried my arduinos i2c connection? - Networking, Protocols, and Devices - Arduino Forum