Skip to content

Commit

Permalink
fmuv5x:Use ADC3 for HW VER/REV detection
Browse files Browse the repository at this point in the history
fmu-v5x:hrt needs to be running for ADC time out

       Fixes bug introduced in 320d2e adding platform layer.
  • Loading branch information
davids5 authored and bozkurthan committed Sep 4, 2019
1 parent 25487f6 commit 2c3aa87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions boards/px4/fmu-v5x/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ CONFIG_START_DAY=30
CONFIG_START_MONTH=11
CONFIG_STDIO_BUFFER_SIZE=32
CONFIG_STM32F7_ADC1=y
CONFIG_STM32F7_ADC3=y
CONFIG_STM32F7_BBSRAM=y
CONFIG_STM32F7_BBSRAM_FILES=5
CONFIG_STM32F7_BKPSRAM=y
Expand Down
11 changes: 8 additions & 3 deletions boards/px4/fmu-v5x/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
#define ADC_ADC1_6V6_CHANNEL /* PC0 */ ADC1_CH(10)
#define ADC_SCALED_VDD_3V3_SENSORS4_CHANNEL /* PC2 */ ADC1_CH(12)
#define ADC_ADC1_3V3_CHANNEL /* PC3 */ ADC1_CH(13)

#define ADC_HW_VER_SENSE_CHANNEL /* PF4 */ ADC3_CH(14)
#define ADC_HW_REV_SENSE_CHANNEL /* PF5 */ ADC3_CH(15)

Expand All @@ -328,12 +329,16 @@
(1 << ADC_SCALED_V5_CHANNEL) | \
(1 << ADC_ADC1_6V6_CHANNEL) | \
(1 << ADC_SCALED_VDD_3V3_SENSORS4_CHANNEL) | \
(1 << ADC_ADC1_3V3_CHANNEL) | \
(1 << ADC_HW_VER_SENSE_CHANNEL) | \
(1 << ADC_HW_REV_SENSE_CHANNEL))
(1 << ADC_ADC1_3V3_CHANNEL))

/* HW has to large of R termination on ADC todo:change when HW value is chosen */

#define HW_REV_VER_ADC_BASE STM32_ADC3_BASE

#define SYSTEM_ADC_BASE STM32_ADC1_BASE



#define BOARD_ADC_OPEN_CIRCUIT_V (5.6f)

/* HW Version and Revision drive signals Default to 1 to detect */
Expand Down
5 changes: 4 additions & 1 deletion boards/px4/fmu-v5x/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ __EXPORT int board_app_initialize(uintptr_t arg)
VDD_3V3_SENSORS4_EN(true);
VDD_3V3_SPEKTRUM_POWER_EN(true);

/* Need hrt running before using the ADC */

px4_platform_init();


if (OK == board_determine_hw_info()) {
syslog(LOG_INFO, "[boot] Rev 0x%1x : Ver 0x%1x %s\n", board_get_hw_revision(), board_get_hw_version(),
Expand All @@ -231,7 +235,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
syslog(LOG_ERR, "[boot] Failed to read HW revision and version\n");
}

px4_platform_init();

/* configure the DMA allocator */

Expand Down

0 comments on commit 2c3aa87

Please sign in to comment.