I2c communication debug

Hi all,

I’m pretty new to Ardupilot, I’m trying to communicate with a pixhawk board with i2c, so I have a some questions.

I’m on a very early stage, actually I can see messages on the irlock address (0x54), at the moment I’d simply like to send a message back and read it on the console, doesn’t matter if infos are incorrect. Is there a better way to test the i2c messages?
After that, I how could I build the last version of ArduCopter with HIL?

Any advice will be very appreciated.

Thank you

Dario

When you say communicate with i2c, do you mean you would like to use the I2c like you would a serial port?

Hi skyscraper, thank you for your reply.

Actually I need to read value on the i2c bus, pratically in the same way irlock do that (don’t know if there are other examples, I think yes, but I found the irlock implementation useful to me).
For testing purpose I’m using an i2c host adapter to read an write values like on a serial port, the next step would be to use an arduino as i2c slave.
What I’m trying to do is to write on address 0x54 and see a log (with hal.console) of reading on the pixhawk side.

I hope I’ve explained it well.

Thank you

I think you will have to explain a bit more :slight_smile:
As far as I know the Pixhawk software only works as an I2C master, (though the hardware is there for it to be a slave, but the software is not implemented)

So you want to attach a slave device to the Pixhawk that answers on I2c address 0x54 and I am guessing looks like an IR_lock sensor?

I’m sorry that I was not clear, I will try to do my best :slight_smile:
Anyway, you’re right: Pixhawk acts as master, and the slave device should answers on I2c address 0x54 like an irlock!

It sounds like a cool project. Maybe it would be easier to test it out on 2 Arduino first. It appears that the Arduino code supports slave mode.

Note that the Pixhawk I2C bus uses pullups to 3 volts, whereas some of the more common Arduino’s use 5V for the pullups ( and the supply voltage). You really need an Arduino that uses a 3 volt supply, ( There are 3v Arduino Pro Mini I believe that run at 8 MHz clock , not 16 MHz)
If you try to mix 3 and 5 volt I2C you will have a lot of problems in getting it to work reliably.