diff --git a/boards/ark/fpv/default.px4board b/boards/ark/fpv/default.px4board index af69fd3691c7..6206a797565b 100644 --- a/boards/ark/fpv/default.px4board +++ b/boards/ark/fpv/default.px4board @@ -16,6 +16,7 @@ CONFIG_DRIVERS_DSHOT=y CONFIG_DRIVERS_GPS=y CONFIG_DRIVERS_HEATER=y CONFIG_DRIVERS_IMU_INVENSENSE_IIM42653=y +CONFIG_DRIVERS_IMU_MURATA_SCH16T=y CONFIG_COMMON_LIGHT=y CONFIG_COMMON_MAGNETOMETER=y CONFIG_DRIVERS_PWM_OUT=y diff --git a/boards/ark/fpv/src/board_config.h b/boards/ark/fpv/src/board_config.h index 26bf670ac83d..487769ce4f84 100644 --- a/boards/ark/fpv/src/board_config.h +++ b/boards/ark/fpv/src/board_config.h @@ -105,6 +105,11 @@ # define GPIO_nARMED_INIT GPIO_TRACED3 #endif +/* SPI */ + +#define SPI6_nRESET_EXTERNAL1 /* PF10 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN10) +#define SPI6_RESET(on_true) px4_arch_gpiowrite(SPI6_nRESET_EXTERNAL1, !(on_true)) + /* I2C busses */ /* Devices on the onboard buses. @@ -327,6 +332,7 @@ GPIO_5V_ON_BATTERY, \ GPIO_VDD_3V3_SD_CARD_EN, \ GPIO_nARMED_INIT, \ + SPI6_nRESET_EXTERNAL1, \ GPIO_FMU_CH1, \ GPIO_FMU_CH2, \ GPIO_FMU_CH3, \ diff --git a/boards/ark/fpv/src/init.c b/boards/ark/fpv/src/init.c index f97fb7d8aa70..5e321b3b52a8 100644 --- a/boards/ark/fpv/src/init.c +++ b/boards/ark/fpv/src/init.c @@ -112,6 +112,7 @@ __EXPORT void board_peripheral_reset(int ms) PAYLOAD_POWER_EN(false); board_control_spi_sensors_power(false, 0xffff); + SPI6_RESET(true); /* wait for the peripheral rail to reach GND */ usleep(ms * 1000); @@ -122,6 +123,9 @@ __EXPORT void board_peripheral_reset(int ms) /* switch the peripheral rail back on */ board_control_spi_sensors_power(true, 0xffff); PAYLOAD_POWER_EN(true); + + /* Release SPI6 Reset */ + SPI6_RESET(false); } /************************************************************************************ @@ -206,6 +210,8 @@ __EXPORT int board_app_initialize(uintptr_t arg) /* Power on Interfaces */ PAYLOAD_POWER_EN(true); + SPI6_RESET(false); + /* Need hrt running before using the ADC */ px4_platform_init(); diff --git a/boards/ark/fpv/src/spi.cpp b/boards/ark/fpv/src/spi.cpp index 424eafedd627..fb922fc95d69 100644 --- a/boards/ark/fpv/src/spi.cpp +++ b/boards/ark/fpv/src/spi.cpp @@ -40,16 +40,16 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION initSPIBus(SPI::Bus::SPI1, { initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}), }, {GPIO::PortI, GPIO::Pin11}), - initSPIBus(SPI::Bus::SPI6, { - initSPIDevice(DRV_DEVTYPE_UNUSED, SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}) + initSPIBusExternal(SPI::Bus::SPI6, { + initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}) }), }), initSPIFmumID(ARKFPV_1, { // Placeholder initSPIBus(SPI::Bus::SPI1, { initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}), }, {GPIO::PortI, GPIO::Pin11}), - initSPIBus(SPI::Bus::SPI6, { - initSPIDevice(DRV_DEVTYPE_UNUSED, SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}) + initSPIBusExternal(SPI::Bus::SPI6, { + initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}) }), }), };