i2C multimaster arbitration for the cube

Hello

I have a bunch of I2C range finders that I want to use on the cube as a forward facing and downward facing rangefinders. But I also want to feed that range finder output to a logging board so I can separately log the data.

Currently we have a separate board for logging because we have many specialized sensors that we use and we have a specialized logging system that stores all of our data. So the range finder needs to be logged in this system. We also need that data to go to the cube for the auto pilot.

The way I have it configured is that the Cube and the logger (which is an RP2040) are both I2C masters that make requests to the rangefinders to acquire their data. However when I set this up it would work for a couple of seconds before the whole bus would crash. What I think is happening is that the RP2040 and the Cube are making I2C requests at the same time causing a message collision and causing the whole system to crash. In the I2C communication paradigm there is a concept known as multi-master arbitration, basically it allows for multiple masters to talk on the same bus, the RP2040 library I’m using for I2C communication uses this I believe by default from what I’ve read but I don’t think the Cube supports it (I may be wrong). I wanted to know if there was any way to configure ardupilot to operate in an i2c multimaster system?

Hey,
I’m also facing a similar issue, I have a TFMini-S and a airspeed sensor both works on I2C. As I’m using a orange cube plus, which has a single I2C port I have to use a I2C splitter.
When I connect the sensor to splitter and one sensor starts to work if I connect another sensor none work.
Individually anyone works.
I tried powering them externally, still didn’t work.

While I don’t know for sure, I’ll venture a reasonably educated guess that multimaster mode isn’t possible without a firmware change.

If you want a “right now” solution, use a Lua script on the Cube to poll the rangefinder data and dump it to serial (or I2C on a separate address). Then connect your companion hardware to the associated port to gather the data as you please.

@tailor - your issue is separate and does not concern multimaster I2C. Start a new topic and include the hardware details. You may be facing an I2C address conflict.

1 Like