diff --git a/libraries/AP_HAL_ChibiOS/HAL_ChibiOS_Class.cpp b/libraries/AP_HAL_ChibiOS/HAL_ChibiOS_Class.cpp index fc2239f823..e384357d60 100644 --- a/libraries/AP_HAL_ChibiOS/HAL_ChibiOS_Class.cpp +++ b/libraries/AP_HAL_ChibiOS/HAL_ChibiOS_Class.cpp @@ -109,8 +109,11 @@ static THD_FUNCTION(main_loop,arg) { daemon_task = chThdGetSelfX(); - //Clear all I2C Buses +#ifdef HAL_I2C_CLEAR_BUS + // Clear all I2C Buses. This can be needed on some boards which + // can get a stuck I2C peripheral on boot ChibiOS::I2CBus::clear_all(); +#endif ChibiOS::Shared_DMA::init(); diff --git a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat index 38bde5aba4..ea0bad5354 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat @@ -133,3 +133,6 @@ define HAL_BARO_DEFAULT HAL_BARO_20789_I2C_I2C define HAL_BARO_20789_I2C_BUS 1 define HAL_BARO_20789_I2C_ADDR_PRESS 0x63 define HAL_BARO_20789_I2C_ADDR_ICM 0x68 + +# unstick 20789 on I2C on boot +define HAL_I2C_CLEAR_BUS