mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 16:46:09 +08:00
px4_fmu-v5:Add Manifest Entries for UAVCAN interfaces
This commit is contained in:
committed by
Daniel Agar
parent
46a09b711f
commit
82ab1413fc
@@ -327,6 +327,8 @@
|
||||
#define GPIO_CAN2_SILENT_S1 /* PH3 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTH|GPIO_PIN3)
|
||||
#define GPIO_CAN3_SILENT_S2 /* PH4 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTH|GPIO_PIN4)
|
||||
|
||||
#define UAVCAN_NUM_IFACES_RUNTIME 1
|
||||
|
||||
/* HEATER
|
||||
* PWM in future
|
||||
*/
|
||||
|
||||
@@ -32,12 +32,35 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file px4fmu_can.c
|
||||
* @file can.c
|
||||
*
|
||||
* Board-specific CAN functions.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
#if !defined(CONFIG_CAN)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
|
||||
__EXPORT
|
||||
uint16_t board_get_can_interfaces(void)
|
||||
{
|
||||
uint16_t enabled_interfaces = 0x7;
|
||||
|
||||
if (!PX4_MFT_HW_SUPPORTED(PX4_MFT_CAN2)) {
|
||||
enabled_interfaces &= ~(1 << 1);
|
||||
}
|
||||
|
||||
if (!PX4_MFT_HW_SUPPORTED(PX4_MFT_CAN3)) {
|
||||
enabled_interfaces &= ~(1 << 2);
|
||||
}
|
||||
|
||||
return enabled_interfaces;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
#define _GPIO_PULL_DOWN_INPUT(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_INPUT|GPIO_PULLDOWN|GPIO_SPEED_2MHz))
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
@@ -231,6 +232,18 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
|
||||
stm32_spiinitialize();
|
||||
|
||||
/* Does this board have CAN 2 or CAN 3 if not decouple the RX
|
||||
* from IP block Leave TX connected
|
||||
*/
|
||||
|
||||
if (!PX4_MFT_HW_SUPPORTED(PX4_MFT_CAN2)) {
|
||||
px4_arch_configgpio(_GPIO_PULL_DOWN_INPUT(GPIO_CAN2_RX));
|
||||
}
|
||||
|
||||
if (!PX4_MFT_HW_SUPPORTED(PX4_MFT_CAN3)) {
|
||||
px4_arch_configgpio(_GPIO_PULL_DOWN_INPUT(GPIO_CAN3_RX));
|
||||
}
|
||||
|
||||
/* configure the DMA allocator */
|
||||
|
||||
if (board_dma_alloc_init() < 0) {
|
||||
|
||||
@@ -71,8 +71,28 @@ static const px4_hw_mft_item_t device_unsupported = {0, 0, 0};
|
||||
// List of components on a specific board configuration
|
||||
// The index of those components is given by the enum (px4_hw_mft_item_id_t)
|
||||
// declared in board_common.h
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0500[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN3
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
@@ -81,21 +101,67 @@ static const px4_hw_mft_item_t hw_mft_list_v0500[] = {
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0540[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN3
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
};
|
||||
|
||||
static px4_hw_mft_list_entry_t mft_lists[] = {
|
||||
{0x0000, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)},
|
||||
{0x0105, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5 R:5 V:1
|
||||
{0x0500, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5+ R:0 V:5
|
||||
{0x0400, hw_mft_list_v0540, arraySize(hw_mft_list_v0540)},
|
||||
{0x0600, hw_mft_list_v0540, arraySize(hw_mft_list_v0540)}, // Alias for CUAV V5nano R:0 V:6
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0600[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN3
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static px4_hw_mft_list_entry_t mft_lists[] = {
|
||||
{0x0000, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)},
|
||||
{0x0105, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5 R:5 V:1
|
||||
{0x0500, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // Alias for CUAV V5+ R:0 V:5
|
||||
{0x0400, hw_mft_list_v0540, arraySize(hw_mft_list_v0540)}, // HolyBro mini no can 2,3
|
||||
{0x0600, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // CUAV V5nano R:0 V:6 with can 2
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_query_manifest
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user