From 4574feaee69b5674155f82ea054c533ad30d7cf3 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 10 Mar 2017 15:29:05 -1000 Subject: [PATCH] px4fmu-v5 Remove GPIO_RC_OUT and vetted RC_IN wiring Removed the legacy FMUv4 define that was activating a nonexistent pull up and on some HW driving the PPM_IN aka RC_IN aka SPEKTRUM_RX to VDD. Also detailed the connections of this pins for the board. The simplest connection is RC_IN to a timer capture pin and a UART. In this case the UART_RX pin and just be left as is. While the pin can be configured as the PPM_IN (Timer capture) or as SPEKTRUM_R facilitate binding. Renamed the macros and defines to be more explicit as to what Is being done and the sense of the parameters --- src/drivers/boards/px4fmu-v5/board_config.h | 22 ++++++++++++++------- src/drivers/boards/px4fmu-v5/px4fmu_init.c | 4 ---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/drivers/boards/px4fmu-v5/board_config.h b/src/drivers/boards/px4fmu-v5/board_config.h index de68d416b4..da9693c9ac 100644 --- a/src/drivers/boards/px4fmu-v5/board_config.h +++ b/src/drivers/boards/px4fmu-v5/board_config.h @@ -338,18 +338,26 @@ __BEGIN_DECLS #define GPIO_LED_SAFETY /* PE12 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN12) #define GPIO_BTN_SAFETY /* PE10 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN10) -#define INVERT_RC_INPUT(_s) board_rc_input(_s); +#define INVERT_RC_INPUT(_invert_true) board_rc_input(_invert_true); /* Power switch controls ******************************************************/ -#define POWER_SPEKTRUM(_s) px4_arch_gpiowrite(GPIO_SPEKTRUM_POWER_EN, (1-_s)) -#define SPEKTRUM_RX_AS_UART() px4_arch_configgpio(GPIO_USART6_RX) /* NOT FMUv5 test HW ONLY*/ +#define SPEKTRUM_POWER(_on_true) px4_arch_gpiowrite(GPIO_SPEKTRUM_POWER_EN, (_on_true)) -// FMUv5 has a separate GPIO for serial RC output -#define GPIO_RC_OUT /* PG9 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN9) -#define SPEKTRUM_RX_AS_GPIO() px4_arch_configgpio(GPIO_RC_OUT) -#define SPEKTRUM_RX_HIGH(_s) px4_arch_gpiowrite(GPIO_RC_OUT, (_s)) +/* + * FMUv5 has a separate RC_IN + * + * GPIO PPM_IN on PI5 T8CH1 + * SPEKTRUM_RX (it's TX or RX in Bind) on UART6 PG9 (NOT FMUv5 test HW ONLY) + * In version is possible in the UART + * and can drive GPIO PPM_IN as an output + */ + +#define GPIO_PPM_IN_AS_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTI|GPIO_PIN5) +#define SPEKTRUM_RX_AS_GPIO_OUTPUT() px4_arch_configgpio(GPIO_PPM_IN_AS_OUT) +#define SPEKTRUM_RX_AS_UART() /* Can be left as uart */ +#define SPEKTRUM_OUT(_one_true) px4_arch_gpiowrite(GPIO_PPM_IN_AS_OUT, (_one_true)) #define SDIO_SLOTNO 0 /* Only one slot */ #define SDIO_MINOR 0 diff --git a/src/drivers/boards/px4fmu-v5/px4fmu_init.c b/src/drivers/boards/px4fmu-v5/px4fmu_init.c index cbce071e64..42d70a3a2b 100644 --- a/src/drivers/boards/px4fmu-v5/px4fmu_init.c +++ b/src/drivers/boards/px4fmu-v5/px4fmu_init.c @@ -257,10 +257,6 @@ stm32_boardinitialize(void) stm32_configgpio(GPIO_LED_SAFETY); stm32_configgpio(GPIO_BTN_SAFETY); -#ifdef GPIO_RC_OUT - stm32_configgpio(GPIO_RC_OUT); /* Serial RC output pin */ -#endif - /* configure SPI interfaces */ stm32_spiinitialize();