betaflight icon indicating copy to clipboard operation
betaflight copied to clipboard

Conflict on internal and external I2C devices using same I2C address

Open haslinghuis opened this issue 10 months ago • 5 comments

Describe the bug

As per title. Internal baro is a BMP280. Magnetometer is detected.

Using GEP-M1025-MI barometer MS5611 and magnetometer IST8310 are detected.

To Reproduce

Flash master and include magnetometers define.

Expected behavior

Detect baro on external module

Support ID

2dd928b4-b734-4a6a-bcf8-b48c5687b56b

Flight controller

SPEEDYBEEF7V3

Other components

Only SpeedyBee F7 V3 BL32 50A 30x30 Stack on lab power with mentioned module.

How are the different components wired up (including port information)

Using connectors - as magnetometer is working there is no wiring issue.

Add any other context about the problem that you think might be relevant here

  • Tried with and without battery power.
  • Setting baro_hardware or other settings does not solve the issue.

haslinghuis avatar Apr 23 '24 19:04 haslinghuis

there is one USE_DSP310 typo in configs, maybe this one?

ledvinap avatar Apr 23 '24 19:04 ledvinap

  • Seems to be correct https://github.com/betaflight/config/blob/1063d83e68f01b8f69303b7de41be4f872a685bf/configs/SPEEDYBEEF7V3/config.h#L34

But MAMBAF405_2022A needs to be fixed :)

haslinghuis avatar Apr 23 '24 19:04 haslinghuis

Maybe an I2C address conflict between the on-board and external baro? A quick search suggests both use 0x77, and the internal and external I2C connections are both I2C1. Not sure if this can be resolved without changing one of the device IDs or physically disconnecting the on-board baro.

Perhaps part of the design guidelines should include using separate I2C devices for on-board and external connections?

ot0tot avatar Apr 29 '24 12:04 ot0tot

@haslinghuis : as @ot0tot said ... and don't expect either baro to work when both are connected

ledvinap avatar Apr 29 '24 13:04 ledvinap

Perhaps part of the design guidelines should include using separate I2C devices for on-board and external connections?

Agree introducing external I2C settings would address this issue.

haslinghuis avatar Apr 29 '24 14:04 haslinghuis

Perhaps part of the design guidelines should include using separate I2C devices for on-board and external connections?

Agree introducing external I2C settings would address this issue.

HI @haslinghuis i have the same issue with my GPS unit with baro GEP-M1025-DQ and KakutteH7 FC. Magnetometer is detected but both internal FC and external baro build in GPS unit is not recognised due to described above conflict. So you are saying that after implementation external I2C settings in BF would address this issue ? any development for this is scheduled ?

Martivip avatar Jun 14 '24 17:06 Martivip

Won't be a software solution.

Using I2C port 1 for internal and port 2 for external devices would already make this possible. Board would need to expose pads for second port. In this way it would not conflict with duplicate devices on I2C port 1 as it would allow to choose active port for the device to be used.

haslinghuis avatar Jun 14 '24 18:06 haslinghuis

Won't be a software solution.

Using I2C port 1 for internal and port 2 for external devices would already make this possible. Board would need to expose pads for second port. In this way it would not conflict with duplicate devices on I2C port 1 as it would allow to choose active port for the device to be used.

ok thanks for the information. Honestly there is no such a FC with second I2C port :( ok so to use this external baro build in GPS I need to use FC without the baro or physicaly disconnect it on the FC, right ?

Martivip avatar Jun 14 '24 18:06 Martivip

ok thanks for the information. Honestly there is no such a FC with second I2C port :( ok so to use this external baro build in GPS I need to use FC without the baro or physicaly disconnect it on the FC, right ?

There are many FCs that already use separate I2C busses for on-board and external sensors.

Yes, you will need to disconnect one of the baros.

ot0tot avatar Jun 14 '24 18:06 ot0tot

ok thanks for the information. Honestly there is no such a FC with second I2C port :( ok so to use this external baro build in GPS I need to use FC without the baro or physicaly disconnect it on the FC, right ?

There are many FCs that already use separate I2C busses for on-board and external sensors.

Yes, you will need to disconnect one of the baros.

could you give me a hint how to recognise such a FC with separate busses ? should I search in FC config.h files ?

Martivip avatar Jun 14 '24 18:06 Martivip

could you give me a hint how to recognise such a FC with separate busses ? should I search in FC config.h files ?

Yes, they will have multiple I2C resources defined. Example: https://github.com/betaflight/config/blob/b98adf6f5e1acfaf4c3f9364579928cdf75a0df9/configs/JHEH743_HD/config.h#L74-L77

You will need to confirm the target resource assignments are accurate and present on the FC.

A decent manufacturer will also cover it in the manual and include it in the specs.

ot0tot avatar Jun 14 '24 22:06 ot0tot