Hi there, I'm trying to connect a Pixhawk Orange with an Arduino via I2C. I've created a barebones setup where the pins from the pixhawk (5V, GND, SDA_3.3v, SCL_3.3v) are connected to the appropriate pins of my slave arduino uno, with the two 3.3v level pins going through this level shifter first. The pixhawk is running an I2C scanner program to repeatedly scan every I2C address and report if one is found.
I couldn't get the two to connect to each other. While troubleshooting, I used a second arduino uno as a monitor to constantly read and print the SCL line. I found out that when the SCL pin is plugged into the slave arduino, the clock line goes from normal-looking to completely grounded. This turns out to only happen when the slave arduino joins the I2C bus (if I run a hello world blink LED program, this does not happen).
Interestingly enough, holding down the RESET button on the slave arduino does not resolve the issue; the SCL line remains grounded. However, if I upload code to it, the issue is briefly resolved while the slave arduino is being programming. Afterwards, however, the SCL line goes back to being grounded.
Any insight would be greatly appreciated, thank you.
Slave arduino code:
// for I2C communication
#include <Wire.h>
const int airspeed_i2c_address = 40;
const int board_addr = 8;
#define DEBUG_LED 2
int addr = board_addr;
void setup() {
// put your setup code here, to run once:
// configure test LEDs
pinMode(DEBUG_LED, OUTPUT);
digitalWrite(DEBUG_LED, LOW);
Serial.begin(9600);
Wire.begin(addr); // join i2c bus as follower
Serial.println("Joined I2C Bus with address " + String(addr));
}
void loop() {
// put your main code here, to run repeatedly:
}
Monitor arduino code:
#define SDA 3
#define SCL 2
#define SCL_3V3 A1
void setup() {
// put your setup code here, to run once:
pinMode(SDA, INPUT);
pinMode(SCL, INPUT);
pinMode(SCL_3V3, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(digitalRead(SCL));
}