Skip to content

Commit

Permalink
fmu-v4: add dshot timer config
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor-Misic authored and bkueng committed Oct 11, 2019
1 parent ac82c51 commit 543a057
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions boards/px4/fmu-v4/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ px4_add_board(
camera_trigger
differential_pressure # all available differential pressure drivers
distance_sensor # all available distance sensor drivers
dshot
gps
heater
imu # all available imu drivers
Expand Down
4 changes: 2 additions & 2 deletions boards/px4/fmu-v4/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@
/* UART8 has no alternate pin config */

/* UART RX DMA configurations */
#define DMAMAP_USART1_RX DMAMAP_USART1_RX_2
#define DMAMAP_USART6_RX DMAMAP_USART6_RX_2
#define DMAMAP_USART1_RX DMAMAP_USART1_RX_1 /*DMA2 Stream 2*/
#define DMAMAP_USART6_RX DMAMAP_USART6_RX_1 /*DMA2 Stream 1*/

/*
* CAN
Expand Down
1 change: 0 additions & 1 deletion boards/px4/fmu-v4/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ CONFIG_UART7_SERIAL_CONSOLE=y
CONFIG_UART7_TXBUFSIZE=300
CONFIG_UART8_BAUD=57600
CONFIG_UART8_RXBUFSIZE=300
CONFIG_UART8_RXDMA=y
CONFIG_UART8_TXBUFSIZE=300
CONFIG_USART1_RXBUFSIZE=600
CONFIG_USART1_RXDMA=y
Expand Down
1 change: 0 additions & 1 deletion boards/px4/fmu-v4/nuttx-config/stackcheck/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ CONFIG_UART7_SERIAL_CONSOLE=y
CONFIG_UART7_TXBUFSIZE=300
CONFIG_UART8_BAUD=57600
CONFIG_UART8_RXBUFSIZE=300
CONFIG_UART8_RXDMA=y
CONFIG_UART8_TXBUFSIZE=300
CONFIG_USART1_RXBUFSIZE=600
CONFIG_USART1_RXDMA=y
Expand Down
3 changes: 3 additions & 0 deletions boards/px4/fmu-v4/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@
#define BOARD_DMA_ALLOC_POOL_SIZE 5120

#define BOARD_HAS_ON_RESET 1

#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5};

__BEGIN_DECLS

/****************************************************************************************************
Expand Down
14 changes: 14 additions & 0 deletions boards/px4/fmu-v4/src/timer_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +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 */
}

},
{
Expand All @@ -71,6 +78,13 @@ __EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = {
.last_channel_index = 5,
.handler = io_timer_handler1,
.vectorno = STM32_IRQ_TIM4,
.dshot = {
.dma_base = DSHOT_DMA1_BASE,
.channel = DShot_Channel2,
.stream = DShot_Stream6,
.start_ccr_register = TIM_DMABASE_CCR2,
.channels_number = 2u /* CCR2 and CCR3 */
}
}
};

Expand Down

0 comments on commit 543a057

Please sign in to comment.