mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
px4fmu-v2: Add detection for Pixhack V3 (#10231)
The Simple HW detection was detecting the Pixhack V3 as a mini. This commit adds further discrimination, based on the fact the Pixhack V3 left VDD_5V_PERIPH_EN floating. Where a mini ,V2, V3 HW has it connected to the active low enable of the VDD_5V_PERIPH and VDD_5V_HIGHPOWER via a 10K pull down. The detection enables the 40K pull up and samples the pin. This reads back as a logical one on the Pixhack V3, and a logical zero on the Mini. Since the float is applied some 3.3 Ms post pin setting at reset the 10 us should leave the 5 Volt supplies in the on state because of the 10K pull down. This is assuming typical 40K pullup 10K pull down This results in typical 0.66V (.875V max) on the /EN pin which should not be detected as a high on the TPS2041.
This commit is contained in:
parent
01744a9efc
commit
18ccf8dbd2
@ -49,8 +49,10 @@
|
||||
|
||||
/* 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_INPUT|GPIO_FLOAT|GPIO_PORTB|GPIO_PIN12)
|
||||
#define HW_VER_FMUV2_STATE 0x8 /* PB12:PU:1 PB12:PD:0 PB4:PU:0 PB4PD:0 */
|
||||
|
||||
@ -407,18 +407,45 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
hw_type[2] = '0';
|
||||
|
||||
/* Has CAN2 transceiver Remove pull up */
|
||||
|
||||
stm32_configgpio(GPIO_CAN2_RX);
|
||||
|
||||
break;
|
||||
|
||||
case HW_VER_FMUV2MINI_STATE:
|
||||
hw_type[2] = 'M';
|
||||
|
||||
/* 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';
|
||||
message("\nPixhack V3 detected, forcing to fmu-v3");
|
||||
|
||||
} else {
|
||||
|
||||
/* It is a mini */
|
||||
|
||||
hw_type[2] = 'M';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// questionable px4fmu-v2 hardware, try forcing regular FMUv2 (not much else we can do)
|
||||
message("bad version detected, forcing to fmu-v2\n");
|
||||
hw_version = 0x8;
|
||||
|
||||
/* questionable px4fmu-v2 hardware, try forcing regular FMUv2 (not much else we can do) */
|
||||
|
||||
message("\nbad version detected, forcing to fmu-v2");
|
||||
hw_version = HW_VER_FMUV2_STATE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user