Skip to content

Commit

Permalink
boards: ark fpv fix spi6
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKlimaj committed Nov 2, 2024
1 parent 108979c commit 0e06e4f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions boards/ark/fpv/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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, \
Expand Down
6 changes: 6 additions & 0 deletions boards/ark/fpv/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

/************************************************************************************
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions boards/ark/fpv/src/spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}),
}),
};
Expand Down

0 comments on commit 0e06e4f

Please sign in to comment.