From dace50c2aa9d0421855a1d61b5ad56b393a82017 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 10 Mar 2017 15:29:02 -1000 Subject: [PATCH] mindpx-v2 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_RX_AS_GPIO_OUTPUT to use it as and GPIO to 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/mindpx-v2/board_config.h | 31 +++++++++++++-------- src/drivers/boards/mindpx-v2/mindpx2_init.c | 2 -- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/drivers/boards/mindpx-v2/board_config.h b/src/drivers/boards/mindpx-v2/board_config.h index aaffbb2132..0d240d2386 100644 --- a/src/drivers/boards/mindpx-v2/board_config.h +++ b/src/drivers/boards/mindpx-v2/board_config.h @@ -276,22 +276,29 @@ #define RC_SERIAL_PORT "/dev/ttyS0" -// #define GPIO_RSSI_IN (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN1) -#define GPIO_SBUS_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN10) -#define INVERT_RC_INPUT(_s) px4_arch_gpiowrite(GPIO_SBUS_INV, _s); +// #define GPIO_RSSI_IN (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN1) +#define GPIO_SBUS_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN10) +#define INVERT_RC_INPUT(_invert_true) px4_arch_gpiowrite(GPIO_SBUS_INV, _invert_true); -#define GPIO_FRSKY_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN12) -#define INVERT_FRSKY(_s) px4_arch_gpiowrite(GPIO_FRSKY_INV, _s); +#define GPIO_FRSKY_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN12) +#define INVERT_FRSKY(_invert_true) px4_arch_gpiowrite(GPIO_FRSKY_INV, _invert_true); /* Power switch controls */ -#define GPIO_SPEKTRUM_PWR_EN -#define POWER_SPEKTRUM(_s) do { } while (0) -#define SPEKTRUM_RX_AS_UART() px4_arch_configgpio(GPIO_USART1_RX) +#define SPEKTRUM_POWER(_on_true) do { } while (0) -/* MindPXv2 has a separate GPIO for serial RC output */ -#define GPIO_RC_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN6) -#define SPEKTRUM_RX_AS_GPIO() px4_arch_configgpio(GPIO_RC_OUT) -#define SPEKTRUM_RX_HIGH(_s) px4_arch_gpiowrite(GPIO_RC_OUT, (_s)) +/* + * MindPXv2 has one RC_IN + * + * GPIO PPM_IN on PC6 T8CH1 + * SPEKTRUM_RX (it's TX or RX in Bind) on PC6 UART1 + * Inversion is possible via the 74LVC2G86 controlled by the FMU + * The FMU 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_PORTC|GPIO_PIN6) +#define SPEKTRUM_RX_AS_GPIO_OUTPUT() px4_arch_configgpio(GPIO_PPM_IN_AS_OUT) +#define SPEKTRUM_RX_AS_UART() px4_arch_configgpio(GPIO_USART1_RX) +#define SPEKTRUM_OUT(_one_true) px4_arch_gpiowrite(GPIO_PPM_IN_AS_OUT, (_one_true)) #define BOARD_NAME "MINDPX_V2" diff --git a/src/drivers/boards/mindpx-v2/mindpx2_init.c b/src/drivers/boards/mindpx-v2/mindpx2_init.c index 247569ff76..414b4d5e53 100644 --- a/src/drivers/boards/mindpx-v2/mindpx2_init.c +++ b/src/drivers/boards/mindpx-v2/mindpx2_init.c @@ -152,8 +152,6 @@ stm32_boardinitialize(void) /* configure power supply control/sense pins */ px4_arch_configgpio(GPIO_SBUS_INV); - px4_arch_configgpio(GPIO_RC_OUT); /* Serial RC output pin */ - px4_arch_gpiowrite(GPIO_RC_OUT, 1); /* set it high to pull RC input up */ px4_arch_configgpio(GPIO_FRSKY_INV); /* configure the GPIO pins to outputs and keep them low */