board_hw_info: update id string from V5X{0-a}{0-a} to V5X{xxx}{xxx}

This commit is contained in:
Igor Mišić
2022-05-03 12:10:16 -07:00
committed by David Sidrane
parent ac497e21c6
commit d9df4db473
19 changed files with 68 additions and 57 deletions
+1 -3
View File
@@ -115,9 +115,7 @@
#define GPIO_HW_REV_SENSE /* PC3 */ ADC1_GPIO(13)
#define GPIO_HW_VER_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_VER_SENSE /* PC2 */ ADC1_GPIO(12)
#define HW_INFO_INIT {'V','5','x', 'x',0}
#define HW_INFO_INIT_VER 2
#define HW_INFO_INIT_REV 3
#define HW_INFO_INIT_PREFIX "VAM"
#define BOARD_TAP_ESC_MODE 2 // select closed-loop control mode for the esc
// #define BOARD_USE_ESC_CURRENT_REPORT
+1 -3
View File
@@ -83,9 +83,7 @@
#define GPIO_HW_VER_REV_DRIVE /* PB1 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN1)
#define GPIO_HW_REV_SENSE /* PA0 */ ADC1_GPIO(0)
#define GPIO_HW_VER_SENSE /* PA1 */ ADC1_GPIO(1)
#define HW_INFO_INIT {'C','A','N','G','P','S','x', 'x',0}
#define HW_INFO_INIT_VER 6
#define HW_INFO_INIT_REV 7
#define HW_INFO_INIT_PREFIX "CANGPS"
#define FLASH_BASED_PARAMS
@@ -152,9 +152,7 @@
#define GPIO_HW_REV_SENSE /* PC3 */ GPIO_ADC12_INP13
#define GPIO_HW_VER_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_VER_SENSE /* PC2 */ GPIO_ADC123_INP12
#define HW_INFO_INIT {'V','D','x', 'x',0}
#define HW_INFO_INIT_VER 2
#define HW_INFO_INIT_REV 3
#define HW_INFO_INIT_PREFIX "VD"
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 2
+2 -3
View File
@@ -185,9 +185,8 @@
#define GPIO_HW_REV_SENSE /* PC3 */ ADC1_GPIO(13)
#define GPIO_HW_VER_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_VER_SENSE /* PC2 */ ADC1_GPIO(12)
#define HW_INFO_INIT {'V','5','x', 'x',0}
#define HW_INFO_INIT_VER 2
#define HW_INFO_INIT_REV 3
#define HW_INFO_INIT_PREFIX "VPI32X5"
/* CAN Silence
*
* Silent mode control \ ESC Mux select
+1 -3
View File
@@ -142,9 +142,7 @@
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_REV_SENSE /* PF5 */ ADC3_GPIO(15)
#define GPIO_HW_VER_SENSE /* PF4 */ ADC3_GPIO(14)
#define HW_INFO_INIT {'V','1','x', 'x',0}
#define HW_INFO_INIT_VER 2 /* Offset in above string of the VER */
#define HW_INFO_INIT_REV 3 /* Offset in above string of the REV */
#define HW_INFO_INIT_PREFIX "V1"
/* PWM
*/
+1 -3
View File
@@ -182,9 +182,7 @@
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_REV_SENSE /* PH4 */ GPIO_ADC3_INP15
#define GPIO_HW_VER_SENSE /* PH3 */ GPIO_ADC3_INP14
#define HW_INFO_INIT {'V','2','x', 'x',0}
#define HW_INFO_INIT_VER 3 /* Offset in above string of the VER */
#define HW_INFO_INIT_REV 4 /* Offset in above string of the REV */
#define HW_INFO_INIT_PREFIX "V2"
/* PE6 is nARMED --> FCv2 this goes to TP13
* The GPIO will be set as input while not armed HW will have external HW Pull UP.
+2 -3
View File
@@ -192,9 +192,8 @@
#define GPIO_HW_VER_REV_DRIVE /* GPIO_AD_B0_01 GPIO1_IO01 */ (GPIO_PORT1 | GPIO_PIN1 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | HW_IOMUX)
#define GPIO_HW_REV_SENSE /* GPIO_AD_B1_08 GPIO1 Pin 24 */ ADC1_GPIO(13, 24)
#define GPIO_HW_VER_SENSE /* GPIO_AD_B1_04 GPIO1 Pin 20 */ ADC1_GPIO(9, 20)
#define HW_INFO_INIT {'V','5','x', 'x',0}
#define HW_INFO_INIT_VER 2
#define HW_INFO_INIT_REV 3
#define HW_INFO_INIT_PREFIX "V5"
/* CAN Silence
*
* Silent mode control \ ESC Mux select
+2 -3
View File
@@ -188,9 +188,8 @@
#define GPIO_HW_REV_SENSE /* PC3 */ ADC1_GPIO(13)
#define GPIO_HW_VER_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_VER_SENSE /* PC2 */ ADC1_GPIO(12)
#define HW_INFO_INIT {'V','5','x', 'x',0}
#define HW_INFO_INIT_VER 2
#define HW_INFO_INIT_REV 3
#define HW_INFO_INIT_PREFIX "V5"
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 3
#define V500 HW_VER_REV(0x0,0x0) // FMUV5, Rev 0
#define V515 HW_VER_REV(0x1,0x5) // CUAV V5, Rev 5
+4 -3
View File
@@ -184,15 +184,16 @@
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_REV_SENSE /* PF5 */ ADC3_GPIO(15)
#define GPIO_HW_VER_SENSE /* PF4 */ ADC3_GPIO(14)
#define HW_INFO_INIT {'V','5','X','x', 'x',0}
#define HW_INFO_INIT_VER 3 /* Offset in above string of the VER */
#define HW_INFO_INIT_REV 4 /* Offset in above string of the REV */
#define HW_INFO_INIT_PREFIX "V5X"
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 3
// Base FMUM
#define V5X00 HW_VER_REV(0x0,0x0) // FMUV5X, Rev 0
#define V5X10 HW_VER_REV(0x1,0x0) // NO PX4IO, Rev 0
#define V5X01 HW_VER_REV(0x0,0x1) // FMUV5X I2C2 BMP388, Rev 1
#define V5X02 HW_VER_REV(0x0,0x2) // FMUV5X, Rev 2
#define V5X80 HW_VER_REV(0x8,0x0) // USB (Q), Rev 0
#define V5X81 HW_VER_REV(0x8,0x1) // USB (Q) I2C2 BMP388, Rev 1
#define V5X82 HW_VER_REV(0x8,0x2) // USB (Q) I2C2 BMP388, Rev 2
#define V5X90 HW_VER_REV(0x9,0x0) // NO USB, Rev 0
#define V5X91 HW_VER_REV(0x9,0x1) // NO USB I2C2 BMP388, Rev 1
#define V5X92 HW_VER_REV(0x9,0x2) // NO USB I2C2 BMP388, Rev 2
+4 -1
View File
@@ -118,6 +118,9 @@ static px4_hw_mft_list_entry_t mft_lists[] = {
{V5X01, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, Rev 1
{V5X02, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, Rev 2
{V5X10, hw_mft_list_v0510, arraySize(hw_mft_list_v0510)}, // NO PX4IO, Rev 0
{V5X80, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // USB (Q), Rev 0
{V5X81, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // USB (Q) I2C2 BMP388, Rev 1
{V5X82, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // USB (Q) I2C2 BMP388, Rev 2
{V5X90, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB, Rev 0
{V5X91, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB I2C2 BMP388, Rev 1
{V5X92, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB I2C2 BMP388, Rev 2
@@ -146,7 +149,7 @@ __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() << 8;
uint32_t ver_rev = board_get_hw_version() << 16;
ver_rev |= board_get_hw_revision();
for (unsigned i = 0; i < arraySize(mft_lists); i++) {
+1 -3
View File
@@ -173,9 +173,7 @@
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_REV_SENSE /* PH4 */ GPIO_ADC3_INP15
#define GPIO_HW_VER_SENSE /* PH3 */ GPIO_ADC3_INP14
#define HW_INFO_INIT {'V','6','U','x', 'x',0}
#define HW_INFO_INIT_VER 3 /* Offset in above string of the VER */
#define HW_INFO_INIT_REV 4 /* Offset in above string of the REV */
#define HW_INFO_INIT_PREFIX "V6U"
/* HEATER
* PWM in future
+1 -3
View File
@@ -211,9 +211,7 @@
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_REV_SENSE /* PH4 */ GPIO_ADC3_INP15
#define GPIO_HW_VER_SENSE /* PH3 */ GPIO_ADC3_INP14
#define HW_INFO_INIT {'V','6','X','x', 'x',0}
#define HW_INFO_INIT_VER 3 /* Offset in above string of the VER */
#define HW_INFO_INIT_REV 4 /* Offset in above string of the REV */
#define HW_INFO_INIT_PREFIX "V6X"
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 2 // Rev 0 and Rev 3 Sensor sets
// Base/FMUM
@@ -173,9 +173,7 @@
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
#define GPIO_HW_REV_SENSE /* PF5 */ ADC3_GPIO(15)
#define GPIO_HW_VER_SENSE /* PF4 */ ADC3_GPIO(14)
#define HW_INFO_INIT {'V','5','X','x', 'x',0}
#define HW_INFO_INIT_VER 3 /* Offset in above string of the VER */
#define HW_INFO_INIT_REV 4 /* Offset in above string of the REV */
#define HW_INFO_INIT_PREFIX "VSA"
/* HEATER
* PWM in future
@@ -262,9 +262,12 @@
#if defined(BOARD_HAS_HW_VERSIONING)
# define BOARD_HAS_VERSIONING 1
# define HW_VER_REV(v,r) ((uint32_t)((v) & 0xff) << 8) | ((uint32_t)(r) & 0xff)
# define HW_VER_REV(v,r) ((uint32_t)((v) & 0xffff) << 16) | ((uint32_t)(r) & 0xffff)
#endif
#define HW_INFO_REV_DIGITS 3
#define HW_INFO_VER_DIGITS 3
/* Default LED logical to color mapping */
#if defined(BOARD_OVERLOAD_LED)
@@ -32,9 +32,10 @@
****************************************************************************/
#pragma once
#include "micro_hal.h"
__BEGIN_DECLS
#define HW_INFO_SUFFIX "%0" STRINGIFY(HW_INFO_VER_DIGITS) "x%0" STRINGIFY(HW_INFO_REV_DIGITS) "x"
/************************************************************************************
* Name: board_determine_hw_info
*
@@ -44,7 +44,7 @@
static int hw_version = 0;
static int hw_revision = 0;
static char hw_info[] = HW_INFO_INIT;
static char hw_info[] = HW_INFO_INIT_PREFIX HW_INFO_SUFFIX;
__EXPORT const char *board_get_hw_type_name(void)
{
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2019 PX4 Development Team. All rights reserved.
* Copyright (C) 2019, 2022 PX4 Development Team. All rights reserved.
* Author: @author David Sidrane <david_s5@nscdg.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -52,12 +52,16 @@
# define GPIO_HW_REV_DRIVE GPIO_HW_VER_REV_DRIVE
# define GPIO_HW_VER_DRIVE GPIO_HW_VER_REV_DRIVE
# endif
#define HW_INFO_SIZE (int) arraySize(HW_INFO_INIT_PREFIX) + HW_INFO_VER_DIGITS + HW_INFO_REV_DIGITS
/****************************************************************************
* Private Data
****************************************************************************/
static int hw_version = 0;
static int hw_revision = 0;
static char hw_info[] = HW_INFO_INIT;
static char hw_info[HW_INFO_SIZE] = {0};
/****************************************************************************
* Protected Functions
@@ -193,7 +197,7 @@ static int read_id_dn(int *id, uint32_t gpio_drive, uint32_t gpio_sense, int adc
/* Are Resistors in place ?*/
uint32_t dn_sum = 0;
uint16_t dn = 0;
uint32_t dn = 0;
if ((high ^ low) && low == 0) {
/* Yes - Fire up the ADC (it has once control) */
@@ -204,14 +208,14 @@ static int read_id_dn(int *id, uint32_t gpio_drive, uint32_t gpio_sense, int adc
for (unsigned av = 0; av < samples; av++) {
dn = px4_arch_adc_sample(HW_REV_VER_ADC_BASE, adc_channel);
if (dn == 0xffff) {
if (dn == UINT32_MAX) {
break;
}
dn_sum += dn;
}
if (dn != 0xffff) {
if (dn != UINT32_MAX) {
*id = dn_sum / samples;
rv = OK;
}
@@ -338,8 +342,12 @@ int board_determine_hw_info()
int rv = determine_hw_info(&hw_revision, &hw_version);
if (rv == OK) {
hw_info[HW_INFO_INIT_REV] = board_get_hw_revision() + '0';
hw_info[HW_INFO_INIT_VER] = board_get_hw_version() + '0';
if (rv == OK) {
snprintf(hw_info, sizeof(hw_info), HW_INFO_INIT_PREFIX HW_INFO_SUFFIX, hw_version, hw_revision);
}
}
return rv;
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2017 PX4 Development Team. All rights reserved.
* Copyright (C) 2017, 2022 PX4 Development Team. All rights reserved.
* Author: @author David Sidrane <david_s5@nscdg.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -56,12 +56,16 @@
# define GPIO_HW_REV_DRIVE GPIO_HW_VER_REV_DRIVE
# define GPIO_HW_VER_DRIVE GPIO_HW_VER_REV_DRIVE
# endif
#define HW_INFO_SIZE (int) arraySize(HW_INFO_INIT_PREFIX) + HW_INFO_VER_DIGITS + HW_INFO_REV_DIGITS
/****************************************************************************
* Private Data
****************************************************************************/
static int hw_version = 0;
static int hw_revision = 0;
static char hw_info[] = HW_INFO_INIT;
static char hw_info[HW_INFO_SIZE] = {0};
static const uint16_t mtd_mft_version = MTD_MFT_v0; //< Current version of structure in EEPROM
static const char *mtd_mft_path = "/fs/mtd_mft";
@@ -443,16 +447,25 @@ __EXPORT int board_get_hw_revision()
int board_determine_hw_info()
{
// ADC hw version range: {0x1 - 0xF}
int rv = determine_hw_info(&hw_revision, &hw_version);
if (rv == OK) {
hw_info[HW_INFO_INIT_REV] = board_get_hw_revision() < 10 ?
board_get_hw_revision() + '0' :
board_get_hw_revision() + 'a' - 10;
hw_info[HW_INFO_INIT_VER] = board_get_hw_version() < 10 ?
board_get_hw_version() + '0' :
board_get_hw_version() + 'a' - 10;
/* EEPROM hw version range: {0x10 - 0xFFFF} */
if (hw_version == HW_VERSION_EEPROM) {
mtd_mft_t mtd_mft;
rv = board_get_eeprom_hw_info(&mtd_mft);
if (rv == OK) {
hw_version = mtd_mft.hw_extended_ver;
}
}
}
if (rv == OK) {
snprintf(hw_info, sizeof(hw_info), HW_INFO_INIT_PREFIX HW_INFO_SUFFIX, hw_version, hw_revision);
}
return rv;
+3 -2
View File
@@ -46,6 +46,7 @@
#include <stdbool.h>
#include <string.h>
#include <version/version.h>
#include <version/version.h>
/* string constants for version commands */
static const char sz_ver_hw_str[] = "hw";
@@ -141,11 +142,11 @@ extern "C" __EXPORT int ver_main(int argc, char *argv[])
int r = px4_board_hw_revision();
if (v >= 0) {
snprintf(vb, sizeof(vb), "0x%08X", v);
snprintf(vb, sizeof(vb), "0x%0" STRINGIFY(HW_INFO_VER_DIGITS) "X", v);
}
if (r >= 0) {
snprintf(rb, sizeof(rb), "0x%08X", r);
snprintf(rb, sizeof(rb), "0x%0" STRINGIFY(HW_INFO_REV_DIGITS) "X", r);
}
printf("HW type: %s\n", strlen(px4_board_sub_type()) ? px4_board_sub_type() : "NA");