From 67500123e3907554b33ac29479ad9448de741b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 24 Sep 2019 19:58:40 +0200 Subject: [PATCH] fmu-v5: add dshot support But only on the first 4 FMU outputs, as the next ones conflict with px4io serial dma (UART8_RX) RX DMA is disabled on the GPS port as well (conflicts with TIM1). --- boards/px4/fmu-v5/default.cmake | 1 + boards/px4/fmu-v5/nuttx-config/critmonitor/defconfig | 1 - boards/px4/fmu-v5/nuttx-config/irqmonitor/defconfig | 1 - boards/px4/fmu-v5/nuttx-config/nsh/defconfig | 1 - boards/px4/fmu-v5/nuttx-config/stackcheck/defconfig | 1 - boards/px4/fmu-v5/src/board_config.h | 2 ++ boards/px4/fmu-v5/src/timer_config.c | 8 +++++++- 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/boards/px4/fmu-v5/default.cmake b/boards/px4/fmu-v5/default.cmake index 272a39576a..6ee897c489 100644 --- a/boards/px4/fmu-v5/default.cmake +++ b/boards/px4/fmu-v5/default.cmake @@ -25,6 +25,7 @@ px4_add_board( camera_trigger differential_pressure # all available differential pressure drivers distance_sensor # all available distance sensor drivers + dshot gps #heater imu/adis16448 diff --git a/boards/px4/fmu-v5/nuttx-config/critmonitor/defconfig b/boards/px4/fmu-v5/nuttx-config/critmonitor/defconfig index 2155889c25..84b9a985eb 100644 --- a/boards/px4/fmu-v5/nuttx-config/critmonitor/defconfig +++ b/boards/px4/fmu-v5/nuttx-config/critmonitor/defconfig @@ -227,7 +227,6 @@ CONFIG_UART8_RXDMA=y CONFIG_UART8_TXBUFSIZE=1500 CONFIG_USART1_BAUD=57600 CONFIG_USART1_RXBUFSIZE=600 -CONFIG_USART1_RXDMA=y CONFIG_USART1_TXBUFSIZE=1500 CONFIG_USART2_BAUD=57600 CONFIG_USART2_IFLOWCONTROL=y diff --git a/boards/px4/fmu-v5/nuttx-config/irqmonitor/defconfig b/boards/px4/fmu-v5/nuttx-config/irqmonitor/defconfig index dcbe35338e..ba037bc8ec 100644 --- a/boards/px4/fmu-v5/nuttx-config/irqmonitor/defconfig +++ b/boards/px4/fmu-v5/nuttx-config/irqmonitor/defconfig @@ -226,7 +226,6 @@ CONFIG_UART8_RXDMA=y CONFIG_UART8_TXBUFSIZE=1500 CONFIG_USART1_BAUD=57600 CONFIG_USART1_RXBUFSIZE=600 -CONFIG_USART1_RXDMA=y CONFIG_USART1_TXBUFSIZE=1500 CONFIG_USART2_BAUD=57600 CONFIG_USART2_IFLOWCONTROL=y diff --git a/boards/px4/fmu-v5/nuttx-config/nsh/defconfig b/boards/px4/fmu-v5/nuttx-config/nsh/defconfig index 598b4bb528..9846adfaaa 100644 --- a/boards/px4/fmu-v5/nuttx-config/nsh/defconfig +++ b/boards/px4/fmu-v5/nuttx-config/nsh/defconfig @@ -225,7 +225,6 @@ CONFIG_UART8_RXDMA=y CONFIG_UART8_TXBUFSIZE=1500 CONFIG_USART1_BAUD=57600 CONFIG_USART1_RXBUFSIZE=600 -CONFIG_USART1_RXDMA=y CONFIG_USART1_TXBUFSIZE=1500 CONFIG_USART2_BAUD=57600 CONFIG_USART2_IFLOWCONTROL=y diff --git a/boards/px4/fmu-v5/nuttx-config/stackcheck/defconfig b/boards/px4/fmu-v5/nuttx-config/stackcheck/defconfig index 71a8b59fca..6f01c87d53 100644 --- a/boards/px4/fmu-v5/nuttx-config/stackcheck/defconfig +++ b/boards/px4/fmu-v5/nuttx-config/stackcheck/defconfig @@ -217,7 +217,6 @@ CONFIG_UART8_RXDMA=y CONFIG_UART8_TXBUFSIZE=1500 CONFIG_USART1_BAUD=57600 CONFIG_USART1_RXBUFSIZE=600 -CONFIG_USART1_RXDMA=y CONFIG_USART1_TXBUFSIZE=1500 CONFIG_USART2_BAUD=57600 CONFIG_USART2_IFLOWCONTROL=y diff --git a/boards/px4/fmu-v5/src/board_config.h b/boards/px4/fmu-v5/src/board_config.h index 5fd9a9e315..4b55f960c1 100644 --- a/boards/px4/fmu-v5/src/board_config.h +++ b/boards/px4/fmu-v5/src/board_config.h @@ -673,6 +673,8 @@ #define BOARD_NUM_IO_TIMERS 5 +#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7}; + __BEGIN_DECLS /**************************************************************************************************** diff --git a/boards/px4/fmu-v5/src/timer_config.c b/boards/px4/fmu-v5/src/timer_config.c index 42a838eef2..cde6354cff 100644 --- a/boards/px4/fmu-v5/src/timer_config.c +++ b/boards/px4/fmu-v5/src/timer_config.c @@ -60,7 +60,13 @@ __EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = { .last_channel_index = 3, .handler = io_timer_handler0, .vectorno = STM32_IRQ_TIM1CC, - + .dshot = { + .dma_base = DSHOT_DMA2_BASE, + .channel = DShot_Channel6, + .stream = DShot_Stream5, + .start_ccr_register = TIM_DMABASE_CCR1, + .channels_number = 4u /* CCR1, CCR2, CCR3 and CCR4 */ + } }, { .base = STM32_TIM4_BASE,