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:
David Sidrane 2018-08-15 06:24:18 -07:00 committed by Daniel Agar
parent 01744a9efc
commit 18ccf8dbd2
2 changed files with 33 additions and 4 deletions

View File

@ -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 */

View File

@ -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;
}