mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 13:17:35 +08:00
boards: px4_fmu-v2 strip out v2m and v3 detection/support
This commit is contained in:
@@ -5,4 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
|
||||
@@ -4,84 +4,28 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
rgbled start -I
|
||||
rgbled_ncp5623c start -I
|
||||
|
||||
board_adc start
|
||||
|
||||
# Internal I2C bus
|
||||
hmc5883 -T -I -R 4 start
|
||||
|
||||
# V2
|
||||
if ver hwtypecmp V2
|
||||
# SPI1
|
||||
if ! mpu6000 -s -b 1 -R 14 start
|
||||
then
|
||||
# SPI1
|
||||
mpu6000 -s -b 1 -R 14 start
|
||||
|
||||
lsm303d -s -b 1 -R 8 start
|
||||
|
||||
if ! l3gd20 -s -b 1 -R 14 start
|
||||
then
|
||||
l3gd20h -s -b 1 -R 12 start
|
||||
fi
|
||||
|
||||
# SPI1 (auto detect ms5611 or ms5607)
|
||||
if ! ms5611 -T 5607 -s -b 1 start
|
||||
then
|
||||
ms5611 -s -b 1 start
|
||||
fi
|
||||
mpu9250 -s -b 1 -R 14 start
|
||||
fi
|
||||
|
||||
lsm303d -s -b 1 -R 8 start
|
||||
|
||||
# V2M Pixhawk mini
|
||||
if ver hwtypecmp V2M
|
||||
if ! l3gd20 -s -b 1 -R 14 start
|
||||
then
|
||||
# SPI1
|
||||
icm20608g -s -b 1 -R 14 start
|
||||
|
||||
#mpu9250 -s -b 1 -R 14 start # unused mpu9250
|
||||
l3gd20h -s -b 1 -R 12 start
|
||||
fi
|
||||
|
||||
# SPI1 (auto detect ms5611 or ms5607)
|
||||
if ! ms5611 -T 5607 -s -b 1 start
|
||||
then
|
||||
ms5611 -s -b 1 start
|
||||
fi
|
||||
|
||||
|
||||
# V3 build hwtypecmp supports V2|V2M|V30
|
||||
if ver hwtypecmp V30
|
||||
then
|
||||
# sensor heating is available, but we disable it for now
|
||||
param set-default SENS_EN_THERMAL 0
|
||||
|
||||
# SPI 4 (external/isolated)
|
||||
if mpu9250 -s -b 4 -R 10 start
|
||||
then
|
||||
mpu6000 -s -b 4 -R 10 start
|
||||
fi
|
||||
|
||||
ms5611 -s -b 4 start
|
||||
|
||||
# l3gd20 (external/isolated SPI4)
|
||||
if ! l3gd20 -s -b 4 -R 14 start
|
||||
then
|
||||
l3gd20h -s -b 4 -R 14 start
|
||||
fi
|
||||
|
||||
# lsm303d (external/isolated SPI4)
|
||||
lsm303d -s -b 4 -R 14 start
|
||||
|
||||
|
||||
# SPI1 internal mpu9250 (v2.1) or mpu6000 (v2.0)
|
||||
if ! mpu9250 -s -b 1 start
|
||||
then
|
||||
# v2.0 internal mpu6000
|
||||
mpu6000 -s -b 1 start
|
||||
|
||||
# v2.0 Has internal hmc5883 on SPI1
|
||||
hmc5883 -T -s -b 1 -R 8 start
|
||||
fi
|
||||
|
||||
# SPI1 Internal SPI (auto detect ms5611 or ms5607)
|
||||
if ! ms5611 -T 5607 -s -b 1 start
|
||||
then
|
||||
ms5611 -s -b 1 start
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ add_library(drivers_board
|
||||
spi.cpp
|
||||
timer_config.cpp
|
||||
usb.c
|
||||
manifest.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
|
||||
@@ -47,21 +47,6 @@
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Run time Hardware detection */
|
||||
#define BOARD_HAS_SIMPLE_HW_VERSIONING 1
|
||||
#define HW_VER_PA8 (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTA|GPIO_PIN8)
|
||||
#define HW_VER_PB4 (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN4)
|
||||
#define HW_VER_PB12 (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN12)
|
||||
#define HW_VER_PA8_INIT (GPIO_VDD_5V_PERIPH_EN)
|
||||
#define HW_VER_PB4_INIT (GPIO_SPI1_EXTI_DRDY_PB4)
|
||||
#define HW_VER_PB12_INIT (GPIO_CAN2_RX | GPIO_PULLUP) /* Assume V2 needing pull up */
|
||||
#define HW_VER_FMUV2_STATE 0x8 /* PB12:PU:1 PB12:PD:0 PB4:PU:0 PB4PD:0 */
|
||||
#define HW_VER_FMUV3_STATE 0xE /* PB12:PU:1 PB12:PD:1 PB4:PU:1 PB4PD:0 */
|
||||
#define HW_VER_FMUV2MINI_STATE 0xA /* PB12:PU:1 PB12:PD:0 PB4:PU:1 PB4PD:0 */
|
||||
#define HW_VER_FMUV2X_STATE 0xB /* PB12:PU:1 PB12:PD:0 PB4:PU:1 PB4PD:1 */
|
||||
#define HW_VER_TYPE_INIT {'V','2',0, 0}
|
||||
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 3
|
||||
|
||||
/****************************************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************************************/
|
||||
@@ -92,9 +77,6 @@
|
||||
|
||||
#define BOARD_SPI_BUS_MAX_BUS_ITEMS 3
|
||||
|
||||
/* I2C busses */
|
||||
#define BOARD_OVERRIDE_I2C_BUS_EXTERNAL
|
||||
|
||||
/*
|
||||
* ADC channels
|
||||
*
|
||||
@@ -158,6 +140,7 @@
|
||||
|
||||
#define BOARD_HAS_ON_RESET 1
|
||||
|
||||
#define BOARD_HAS_STATIC_MANIFEST 1
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -45,19 +45,3 @@ constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = {
|
||||
initI2CBusExternal(1),
|
||||
initI2CBusInternal(2),
|
||||
};
|
||||
|
||||
|
||||
bool px4_i2c_bus_external(const px4_i2c_bus_t &bus)
|
||||
{
|
||||
if (HW_VER_FMUV3 == board_get_hw_version()) {
|
||||
/* All FMUV3 2.1 i2c buses are external */
|
||||
return true;
|
||||
|
||||
} else {
|
||||
if (bus.bus != 2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -94,13 +94,6 @@ extern void led_on(int led);
|
||||
extern void led_off(int led);
|
||||
__END_DECLS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
static int hw_version = 0;
|
||||
static int hw_revision = 0;
|
||||
static char hw_type[4] = HW_VER_TYPE_INIT;
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_peripheral_reset
|
||||
*
|
||||
@@ -137,8 +130,6 @@ __EXPORT void board_peripheral_reset(int ms)
|
||||
|
||||
__EXPORT void board_on_reset(int status)
|
||||
{
|
||||
UNUSED(status);
|
||||
|
||||
/* configure the GPIO pins to outputs and keep them low */
|
||||
for (int i = 0; i < DIRECT_PWM_OUTPUT_CHANNELS; ++i) {
|
||||
px4_arch_configgpio(io_timer_channel_get_gpio_output(i));
|
||||
@@ -165,128 +156,12 @@ __EXPORT void board_on_reset(int status)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: determin_hw_version
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This function looks at HW deltas to determine what the
|
||||
* build is running on using the following criteria:
|
||||
*
|
||||
* MSN PB12 FMUv2 Cube MINI
|
||||
* CAN2_RX CONECTOR MX30521 NC
|
||||
* PU.PD 1,0 1,1 1,0
|
||||
*
|
||||
* LSN PB4 FMUv2 Cube MINI
|
||||
* ACCEL_DRDY LSM303D NC NC
|
||||
* PU.PD 0,0 1,0 1,0
|
||||
|
||||
* PB12:PB4
|
||||
* ud ud
|
||||
* 10 00 - 0x8 FMUv2
|
||||
* 11 10 - 0xE Cube AKA V2.0
|
||||
* 10 10 - 0xA PixhawkMini
|
||||
* 10 11 - 0xB FMUv2 questionable hardware (should be treated like regular FMUv2)
|
||||
*
|
||||
* This will return OK on success and -1 on not supported
|
||||
*
|
||||
* hw_type Initial state is {'V','2',0, 0}
|
||||
* V 2 - FMUv2
|
||||
* V 3 0 - FMUv3 2.0
|
||||
* V 3 1 - FMUv3 2.1 - not differentiateable,
|
||||
* V 2 M - FMUv2 Mini
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
static int determin_hw_version(int *version, int *revision)
|
||||
{
|
||||
*revision = 0; /* default revision */
|
||||
int rv = 0;
|
||||
int pos = 0;
|
||||
stm32_configgpio(GPIO_PULLDOWN | (HW_VER_PB4 & ~GPIO_PUPD_MASK));
|
||||
up_udelay(10);
|
||||
rv |= stm32_gpioread(HW_VER_PB4) << pos++;
|
||||
stm32_configgpio(HW_VER_PB4);
|
||||
up_udelay(10);
|
||||
rv |= stm32_gpioread(HW_VER_PB4) << pos++;
|
||||
|
||||
int votes = 16;
|
||||
int ones[2] = {0, 0};
|
||||
int zeros[2] = {0, 0};
|
||||
|
||||
while (votes--) {
|
||||
stm32_configgpio(GPIO_PULLDOWN | (HW_VER_PB12 & ~GPIO_PUPD_MASK));
|
||||
up_udelay(10);
|
||||
stm32_gpioread(HW_VER_PB12) ? ones[0]++ : zeros[0]++;
|
||||
stm32_configgpio(HW_VER_PB12);
|
||||
up_udelay(10);
|
||||
stm32_gpioread(HW_VER_PB12) ? ones[1]++ : zeros[1]++;
|
||||
}
|
||||
|
||||
if (ones[0] > zeros[0]) {
|
||||
rv |= 1 << pos;
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
if (ones[1] > zeros[1]) {
|
||||
rv |= 1 << pos;
|
||||
}
|
||||
|
||||
stm32_configgpio(HW_VER_PB4_INIT);
|
||||
stm32_configgpio(HW_VER_PB12_INIT);
|
||||
*version = rv;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_get_hw_type_name
|
||||
*
|
||||
* Description:
|
||||
* Optional returns a string defining the HW type
|
||||
*
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT const char *board_get_hw_type_name()
|
||||
{
|
||||
return (const char *) hw_type;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_get_hw_version
|
||||
*
|
||||
* Description:
|
||||
* Optional returns a integer HW version
|
||||
*
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT int board_get_hw_version()
|
||||
{
|
||||
return HW_VER_SIMPLE(hw_version);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_get_hw_revision
|
||||
*
|
||||
* Description:
|
||||
* Optional returns a integer HW revision
|
||||
*
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT int board_get_hw_revision()
|
||||
{
|
||||
return hw_revision;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following entry point. This entry point
|
||||
* is called early in the intitialization -- after all memory has been configured
|
||||
* is called early in the initialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
@@ -356,78 +231,17 @@ stm32_boardinitialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static struct spi_dev_s *spi1;
|
||||
static struct spi_dev_s *spi2;
|
||||
static struct spi_dev_s *spi4;
|
||||
static struct sdio_dev_s *sdio;
|
||||
|
||||
__EXPORT int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
/* Ensure the power is on 1 ms before we drive the GPIO pins */
|
||||
usleep(1000);
|
||||
|
||||
if (OK == determin_hw_version(&hw_version, & hw_revision)) {
|
||||
switch (hw_version) {
|
||||
case HW_VER_FMUV2_STATE:
|
||||
break;
|
||||
|
||||
case HW_VER_FMUV3_STATE:
|
||||
hw_type[1]++;
|
||||
hw_type[2] = '0';
|
||||
|
||||
/* Has CAN2 transceiver Remove pull up */
|
||||
|
||||
stm32_configgpio(GPIO_CAN2_RX);
|
||||
|
||||
break;
|
||||
|
||||
case HW_VER_FMUV2MINI_STATE:
|
||||
|
||||
/* Detection for a Pixhack3 */
|
||||
|
||||
stm32_configgpio(HW_VER_PA8);
|
||||
up_udelay(10);
|
||||
bool isph3 = stm32_gpioread(HW_VER_PA8);
|
||||
stm32_configgpio(HW_VER_PA8_INIT);
|
||||
|
||||
|
||||
if (isph3) {
|
||||
|
||||
/* Pixhack3 looks like a FMuV3 Cube */
|
||||
|
||||
hw_version = HW_VER_FMUV3_STATE;
|
||||
hw_type[1]++;
|
||||
hw_type[2] = '0';
|
||||
syslog(LOG_INFO, "\nPixhack V3 detected, forcing to fmu-v3");
|
||||
|
||||
} else {
|
||||
|
||||
/* It is a mini */
|
||||
|
||||
hw_type[2] = 'M';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* questionable px4_fmu-v2 hardware, try forcing regular FMUv2 (not much else we can do) */
|
||||
|
||||
syslog(LOG_ERR, "\nbad version detected, forcing to fmu-v2");
|
||||
hw_version = HW_VER_FMUV2_STATE;
|
||||
break;
|
||||
}
|
||||
|
||||
syslog(LOG_DEBUG, "\nFMUv2 ver 0x%1X : Rev %x %s\n", hw_version, hw_revision, hw_type);
|
||||
}
|
||||
|
||||
/* configure SPI interfaces (after the hw is determined) */
|
||||
stm32_spiinitialize();
|
||||
|
||||
px4_platform_init();
|
||||
|
||||
/* configure the DMA allocator */
|
||||
/* configure SPI interfaces */
|
||||
stm32_spiinitialize();
|
||||
|
||||
// Configure the DMA allocator.
|
||||
if (board_dma_alloc_init() < 0) {
|
||||
syslog(LOG_ERR, "DMA alloc FAILED\n");
|
||||
}
|
||||
@@ -446,54 +260,10 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
led_on(LED_AMBER);
|
||||
}
|
||||
|
||||
/* Configure SPI-based devices */
|
||||
|
||||
spi1 = stm32_spibus_initialize(1);
|
||||
|
||||
if (!spi1) {
|
||||
syslog(LOG_ERR, "[boot] FAILED to initialize SPI port %d\n", 1);
|
||||
led_on(LED_AMBER);
|
||||
}
|
||||
|
||||
/* Default SPI1 to 1MHz and de-assert the known chip selects. */
|
||||
SPI_SETFREQUENCY(spi1, 10000000);
|
||||
SPI_SETBITS(spi1, 8);
|
||||
SPI_SETMODE(spi1, SPIDEV_MODE3);
|
||||
up_udelay(20);
|
||||
|
||||
/* Get the SPI port for the FRAM */
|
||||
|
||||
spi2 = stm32_spibus_initialize(2);
|
||||
|
||||
if (!spi2) {
|
||||
syslog(LOG_ERR, "[boot] FAILED to initialize SPI port %d\n", 2);
|
||||
led_on(LED_AMBER);
|
||||
}
|
||||
|
||||
/* Default SPI2 to 37.5 MHz (40 MHz rounded to nearest valid divider, F4 max)
|
||||
* and de-assert the known chip selects. */
|
||||
|
||||
// XXX start with 10.4 MHz in FRAM usage and go up to 37.5 once validated
|
||||
SPI_SETFREQUENCY(spi2, 12 * 1000 * 1000);
|
||||
SPI_SETBITS(spi2, 8);
|
||||
SPI_SETMODE(spi2, SPIDEV_MODE3);
|
||||
|
||||
spi4 = stm32_spibus_initialize(4);
|
||||
|
||||
if (!spi4) {
|
||||
syslog(LOG_ERR, "[boot] FAILED to initialize SPI port %d\n", 4);
|
||||
led_on(LED_AMBER);
|
||||
}
|
||||
|
||||
/* Default SPI4 to 1MHz and de-assert the known chip selects. */
|
||||
SPI_SETFREQUENCY(spi4, 10000000);
|
||||
SPI_SETBITS(spi4, 8);
|
||||
SPI_SETMODE(spi4, SPIDEV_MODE3);
|
||||
|
||||
#ifdef CONFIG_MMCSD
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
|
||||
// First, get an instance of the SDIO interface.
|
||||
struct sdio_dev_s *sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
|
||||
|
||||
if (!sdio) {
|
||||
led_on(LED_AMBER);
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018, 2021 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file manifest.c
|
||||
*
|
||||
* This module supplies the interface to the manifest of hardware that is
|
||||
* optional and dependent on the simple Hardware versioning
|
||||
* BOARD_HAS_SIMPLE_HW_VERSIONING
|
||||
*
|
||||
* The manifest allows the system to know whether a hardware option
|
||||
* say for example the PX4IO is an no-pop option vs it is broken.
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <board_config.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "systemlib/px4_macros.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
uint32_t hw_ver_rev; /* the version and revision */
|
||||
const px4_hw_mft_item_t *mft; /* The first entry */
|
||||
uint32_t entries; /* the lenght of the list */
|
||||
} px4_hw_mft_list_entry_t;
|
||||
|
||||
typedef px4_hw_mft_list_entry_t *px4_hw_mft_list_entry;
|
||||
#define px4_hw_mft_list_uninitialized (px4_hw_mft_list_entry) -1
|
||||
|
||||
static const px4_hw_mft_item_t device_unsupported = {0, 0, 0};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_FMUv2[] = {
|
||||
{
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_FMUv2Mini[] = {
|
||||
{
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
static const px4_hw_mft_item_t hw_mft_list_FMUv2X[] = {
|
||||
{
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
static const px4_hw_mft_item_t hw_mft_list_FMUv3[] = {
|
||||
{
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static px4_hw_mft_list_entry_t mft_lists[] = {
|
||||
{HW_VER_FMUV2, hw_mft_list_FMUv2, arraySize(hw_mft_list_FMUv2)},
|
||||
{HW_VER_FMUV2MINI, hw_mft_list_FMUv2Mini, arraySize(hw_mft_list_FMUv2Mini)},
|
||||
{HW_VER_FMUV2X, hw_mft_list_FMUv2X, arraySize(hw_mft_list_FMUv2X)},
|
||||
{HW_VER_FMUV3, hw_mft_list_FMUv3, arraySize(hw_mft_list_FMUv3)},
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_query_manifest
|
||||
*
|
||||
* Description:
|
||||
* Optional returns manifest item.
|
||||
*
|
||||
* Input Parameters:
|
||||
* manifest_id - the ID for the manifest item to retrieve
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 - item is not in manifest => assume legacy operations
|
||||
* pointer to a manifest item
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT px4_hw_mft_item board_query_manifest(px4_hw_mft_item_id_t id)
|
||||
{
|
||||
static px4_hw_mft_list_entry boards_manifest = px4_hw_mft_list_uninitialized;
|
||||
|
||||
if (boards_manifest == px4_hw_mft_list_uninitialized) {
|
||||
uint32_t ver_rev = board_get_hw_version();
|
||||
|
||||
for (unsigned i = 0; i < arraySize(mft_lists); i++) {
|
||||
if (mft_lists[i].hw_ver_rev == ver_rev) {
|
||||
boards_manifest = &mft_lists[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (boards_manifest == px4_hw_mft_list_uninitialized) {
|
||||
syslog(LOG_ERR, "[boot] Board %4" PRIx32 " is not supported!\n", ver_rev);
|
||||
}
|
||||
}
|
||||
|
||||
px4_hw_mft_item rv = &device_unsupported;
|
||||
|
||||
if (boards_manifest != px4_hw_mft_list_uninitialized &&
|
||||
id < boards_manifest->entries) {
|
||||
rv = &boards_manifest->mft[id];
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
+17
-163
@@ -31,172 +31,26 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <px4_arch/spi_hw_description.h>
|
||||
#include <drivers/drv_sensor.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
/* Due to inconsistent use of chip select and data ready signal on
|
||||
* different board that use this build, we are using different
|
||||
* versions.
|
||||
*
|
||||
* --------------- SPI1 -------------------- SPI4 -------------- Incompatibilities ---------
|
||||
* FMUv2: FmuV3 Cube PixhawkMini
|
||||
* Power Domain: VDD_3V3_SENSORS_EN nVDD_5V_PERIPH_EN V3V:SPI1&SPI4 V3V:SPI1 No SPI4
|
||||
* PA5 SPI_INT_SCK
|
||||
* PA6 SPI_INT_MISO
|
||||
* PA7 SPI_INT_MOSI
|
||||
* PB0 GYRO_DRDY SPI4:EXTERN_DRDY NC
|
||||
* PB1 MAG_DRDY +SPI4:nEXTERN_CS NC
|
||||
* PB4 ACCEL_DRDY NC NC
|
||||
* PC1 Spare ADC ( NC ) +SPI1:SPI_INT_MAG_!CS
|
||||
* PC2 nMPU_CS @MPU6000|MPU9250 @MPU9250
|
||||
* PC13 nGYRO_CS SPI4:nGYRO_EXT_CS NC
|
||||
* PC14 GPIO_EXT_1 nBARO_EXT_CS -20608_DRDY
|
||||
* PC15 nACCEL_MAG_CS SPI4:nACCEL_MAG_EXT_CS 20608_CS
|
||||
* PD7 nBARO_CS
|
||||
* PD15 nMPU_DRDY @MPU6000|MPU9250 @MPU9250
|
||||
* PE2 SPI_EXT_SCK NC
|
||||
* PE4 nSPI_EXT_NSS SPI4:nMPU_EXT_CS NC
|
||||
* PE5 SPI_EXT_MISO NC
|
||||
* PE6 SPI_EXT_MOSI NC
|
||||
*
|
||||
* Notes: Prefixed with @ Does not effect board control
|
||||
* Prefixed with + Input used as Output
|
||||
* Prefixed with - Output used as Input
|
||||
* Prefixed with SPIn: Bus changed
|
||||
*
|
||||
* The board API provides for mechanism to perform a SPI bus reset.
|
||||
* To facilitate a SPI bus reset
|
||||
*
|
||||
* 1) All the pins: SPIn, CD, DRDY associated with the SPI bus are turned to inputs
|
||||
* with outputs driven low. (OFFIng)
|
||||
* 2) The power domain of that bus is turned off.
|
||||
* 3) A usleep it done for ms.
|
||||
* 4) The power domain of that bus is turned back on.
|
||||
* 5) The SPIn pins are re-initialized.
|
||||
* 6) The SPI CS, DRDY pins are re-initialized.
|
||||
*
|
||||
* To insure the complete net is de-energized and is not bing back fed, it is important to
|
||||
* note the all signals in the net list of the parts/bus.
|
||||
*
|
||||
* I.E. Not OFFIng PC1 on V3 would leave that pin back feeding the HMC part. As would not
|
||||
* OFFIng PE4, not associated with SPI1 on V2, but would back feed an MPUxxxx on V3
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* --------------- SPI1 -------------------- SPI4 -------------- Incompatibilities ---------
|
||||
* FMUv3 Cube: FmuV2 PixhawkMini
|
||||
* Power Domain: VDD_3V3_SENSORS_EN NA V3V:SPI V5:SPI4 V3V:SPI1 No SPI4
|
||||
* PA5 SPI_INT_SCK
|
||||
* PA6 SPI_INT_MISO
|
||||
* PA7 SPI_INT_MOSI
|
||||
* PB0 EXTERN_DRDY SPI1:GYRO_DRDY NC
|
||||
* PB1 MAG_DRDY nEXTERN_CS -SPI1:MAG_DRDY NC
|
||||
* PB4 NC SPI1:ACCEL_DRDY NC
|
||||
* PC1 SPI_INT_MAG_!CS -ADC1_IN11 NC
|
||||
* PC2 nMPU_CS @MPU6000 @MPU9250
|
||||
* PC13 nGYRO_EXT_CS SPI1:nGYRO_CS NC
|
||||
* PC14 nBARO_EXT_CS GPIO_EXT_1 -20608_DRDY
|
||||
* PC15 nACCEL_MAG_EXT_CS SPI1:nACCEL_MAG_CS 20608_CS
|
||||
* PD7 nBARO_CS
|
||||
* PD15 nMPU_DRDY @MPU6000 @MPU9250
|
||||
* PE2 SPI_EXT_SCK NC
|
||||
* PE4 MPU_EXT_CS SPI4:nSPI_EXT_NSS NC
|
||||
* PE5 SPI_EXT_MISO NC
|
||||
* PE6 SPI_EXT_MOSI NC
|
||||
*
|
||||
*
|
||||
* Notes: Prefixed with @ Does not effect board control
|
||||
* Prefixed with + Input used as Output
|
||||
* Prefixed with - Output used as Input
|
||||
* Prefixed with SPIn: Bus changed
|
||||
*
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------*/
|
||||
/*
|
||||
* --------------- SPI1 -------------------- SPI4 -------------- Incompatibilities ---------
|
||||
* FMUv2 Pixhawk Mini FmuV2 FmuV3 Cube
|
||||
* Power Domain: VDD_3V3_SENSORS_EN NA V3V:SPI V5:SPI4 V3V:SPI1&SPI4
|
||||
* PA5 SPI_INT_SCK
|
||||
* PA6 SPI_INT_MISO
|
||||
* PA7 SPI_INT_MOSI
|
||||
* PB0 NC SPI1:GYRO_DRDY SPI4:EXTERN_DRDY
|
||||
* PB1 NC -SPI1:MAG_DRDY +SPI4:nEXTERN_CS
|
||||
* PB4 NC SPI1:ACCEL_DRDY NC
|
||||
* PC1 Spare ADC ( NC ) +SPI1:SPI_INT_MAG_!CS
|
||||
* PC2 nMPU_CS @MPU6000 @MPU6000|MPU9250
|
||||
* PC13 NC SPI1:nGYRO_CS SPI4:nGYRO_EXT_CS
|
||||
* PC14 20608_DRDY +GPIO_EXT_1 nBARO_EXT_CS
|
||||
* PC15 20608_CS nACCEL_MAG_CS SPI4:nACCEL_MAG_EXT_CS
|
||||
* PD7 nBARO_CS
|
||||
* PD15 nMPU_DRDY @MPU6000 @MPU6000|MPU9250
|
||||
* PE2 NC SPI_EXT_SCK SPI_EXT_SCK
|
||||
* PE4 NC SPI4:nSPI_EXT_NSS SPI4:nMPU_EXT_CS
|
||||
* PE5 NC SPI_EXT_MISO SPI_EXT_MISO
|
||||
* PE6 NC SPI_EXT_MOSI SPI_EXT_MOSI
|
||||
*
|
||||
* Notes: Prefixed with @ Does not effect board control
|
||||
* Prefixed with + Input used as Output
|
||||
* Prefixed with - Output used as Input
|
||||
* Prefixed with SPIn: Bus changed
|
||||
*
|
||||
*/
|
||||
|
||||
constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSIONS] = {
|
||||
initSPIHWVersion(HW_VER_FMUV2, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU6000, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU9250, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_GYR_DEVTYPE_L3GD20, SPI::CS{GPIO::PortC, GPIO::Pin13}, SPI::DRDY{GPIO::PortB, GPIO::Pin0}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_LSM303D, SPI::CS{GPIO::PortC, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5607, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
}, {GPIO::PortE, GPIO::Pin3}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin10})
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI4, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortE, GPIO::Pin4}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortC, GPIO::Pin14}),
|
||||
}),
|
||||
constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU6000, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU9250, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_GYR_DEVTYPE_L3GD20, SPI::CS{GPIO::PortC, GPIO::Pin13}, SPI::DRDY{GPIO::PortB, GPIO::Pin0}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_LSM303D, SPI::CS{GPIO::PortC, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5607, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
}, {GPIO::PortE, GPIO::Pin3}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin10})
|
||||
}),
|
||||
|
||||
initSPIHWVersion(HW_VER_FMUV3, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU6000, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU9250, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_MAG_DEVTYPE_HMC5883, SPI::CS{GPIO::PortC, GPIO::Pin1}), // HMC5983
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5607, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
}, {GPIO::PortE, GPIO::Pin3}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin10})
|
||||
}),
|
||||
initSPIBus(SPI::Bus::SPI4, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU6000, SPI::CS{GPIO::PortE, GPIO::Pin4}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU9250, SPI::CS{GPIO::PortE, GPIO::Pin4}),
|
||||
initSPIDevice(DRV_GYR_DEVTYPE_L3GD20, SPI::CS{GPIO::PortC, GPIO::Pin13}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortC, GPIO::Pin14}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_LSM303D, SPI::CS{GPIO::PortC, GPIO::Pin15}),
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI4, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortE, GPIO::Pin4}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortC, GPIO::Pin14}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(HW_VER_FMUV2MINI, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20608G, SPI::CS{GPIO::PortC, GPIO::Pin15}, SPI::DRDY{GPIO::PortC, GPIO::Pin14}),
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortD, GPIO::Pin7}),
|
||||
initSPIDevice(DRV_DEVTYPE_UNUSED, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}), // unused MPU9250
|
||||
}, {GPIO::PortE, GPIO::Pin3}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin10})
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI4, { // unused, but we must at least define it here
|
||||
}),
|
||||
}),
|
||||
|
||||
// HW_VER_FMUV2X: treat as HW_VER_FMUV2
|
||||
};
|
||||
static constexpr bool unused = validateSPIConfig(px4_spi_buses_all_hw);
|
||||
|
||||
static constexpr bool unused = validateSPIConfig(px4_spi_buses);
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
#define HW_VER_TYPE_INIT {'V','2',0, 0}
|
||||
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 3
|
||||
|
||||
#define HW_VER_FMUV2 HW_VER_SIMPLE(HW_VER_FMUV2_STATE)
|
||||
#define HW_VER_FMUV3 HW_VER_SIMPLE(HW_VER_FMUV3_STATE)
|
||||
#define HW_VER_FMUV2MINI HW_VER_SIMPLE(HW_VER_FMUV2MINI_STATE)
|
||||
#define HW_VER_FMUV2X HW_VER_SIMPLE(HW_VER_FMUV2X_STATE)
|
||||
|
||||
/****************************************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************************************/
|
||||
|
||||
@@ -224,6 +224,7 @@
|
||||
# define BOARD_USES_PX4IO 1
|
||||
# if defined(BOARD_HAS_STATIC_MANIFEST) && BOARD_HAS_STATIC_MANIFEST == 1
|
||||
# define PX4_MFT_HW_SUPPORTED_PX4_MFT_PX4IO 1
|
||||
# define PX4_MFT_HW_IS_CONNECTION_KNOWN_PX4_MFT_PX4IO 1
|
||||
# endif
|
||||
/* Allow a board_config to override the PX4IO FW search paths */
|
||||
# if defined(BOARD_PX4IO_FW_SEARCH_PATHS)
|
||||
@@ -249,11 +250,6 @@
|
||||
#if defined(BOARD_HAS_SIMPLE_HW_VERSIONING)
|
||||
# define BOARD_HAS_VERSIONING 1
|
||||
# define HW_VER_SIMPLE(s) 0x90000+(s)
|
||||
|
||||
# define HW_VER_FMUV2 HW_VER_SIMPLE(HW_VER_FMUV2_STATE)
|
||||
# define HW_VER_FMUV3 HW_VER_SIMPLE(HW_VER_FMUV3_STATE)
|
||||
# define HW_VER_FMUV2MINI HW_VER_SIMPLE(HW_VER_FMUV2MINI_STATE)
|
||||
# define HW_VER_FMUV2X HW_VER_SIMPLE(HW_VER_FMUV2X_STATE)
|
||||
#endif
|
||||
|
||||
#if defined(BOARD_HAS_HW_VERSIONING)
|
||||
|
||||
Reference in New Issue
Block a user