forked from Archive/PX4-Autopilot
durandal-v1: enable dshot
This commit is contained in:
parent
d5b655bad6
commit
0f42ecc5c7
|
@ -24,7 +24,7 @@ px4_add_board(
|
|||
camera_trigger
|
||||
differential_pressure # all available differential pressure drivers
|
||||
distance_sensor # all available distance sensor drivers
|
||||
# dshot -- todo needslooking at
|
||||
dshot
|
||||
gps
|
||||
heater
|
||||
#imu # all available imu drivers
|
||||
|
|
|
@ -374,8 +374,6 @@
|
|||
|
||||
/* UART RX DMA configurations */
|
||||
|
||||
#define DMAMAP_USART1_RX DMAMAP_USART1_RX_2
|
||||
#define DMAMAP_USART6_RX DMAMAP_USART6_RX_2
|
||||
#define DMAMAP_UART8_RX DMAMAP_DMA12_UART8RX_0 /* DMA1:81 */
|
||||
#define DMAMAP_UART8_TX DMAMAP_DMA12_UART8TX_0 /* DMA1:82 */
|
||||
|
||||
|
|
|
@ -340,6 +340,8 @@
|
|||
|
||||
#define DIRECT_INPUT_TIMER_CHANNELS 5
|
||||
|
||||
#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4};
|
||||
|
||||
/* User GPIOs
|
||||
*
|
||||
* GPIO0-4 are the PWM servo outputs.
|
||||
|
|
|
@ -60,7 +60,12 @@ __EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = {
|
|||
.last_channel_index = 3,
|
||||
.handler = io_timer_handler0,
|
||||
.vectorno = STM32_IRQ_TIMCC,
|
||||
|
||||
.dshot = {
|
||||
.dma_base = STM32_DMA1_BASE,
|
||||
.dmamap = DMAMAP_DMA12_TIM1UP_0,
|
||||
.start_ccr_register = TIM_DMABASE_CCR1,
|
||||
.channels_number = 4u /* CCR1, CCR2, CCR3 and CCR4 */
|
||||
}
|
||||
},
|
||||
{
|
||||
.base = STM32_TIM4_BASE,
|
||||
|
@ -71,6 +76,12 @@ __EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = {
|
|||
.last_channel_index = 4,
|
||||
.handler = io_timer_handler1,
|
||||
.vectorno = STM32_IRQ_TIM4,
|
||||
.dshot = {
|
||||
.dma_base = STM32_DMA1_BASE,
|
||||
.dmamap = DMAMAP_DMA12_TIM4UP_0,
|
||||
.start_ccr_register = TIM_DMABASE_CCR2,
|
||||
.channels_number = 1u /* CCR2 */
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 66401c8960c5211ded41ae4f60bfb1746a84bd50
|
||||
Subproject commit 2d7920055f96f5734d5166e2c58daa16c6dff2f5
|
|
@ -174,11 +174,11 @@ void up_dshot_trigger(void)
|
|||
|
||||
first_motor += motors_number;
|
||||
|
||||
stm32_dmasetup(dshot_handler[timer].dma_handle,
|
||||
io_timers[timer].base + STM32_GTIM_DMAR_OFFSET,
|
||||
(uint32_t)(dshot_burst_buffer[timer]),
|
||||
dshot_handler[timer].dma_size,
|
||||
DSHOT_DMA_SCR);
|
||||
px4_stm32_dmasetup(dshot_handler[timer].dma_handle,
|
||||
io_timers[timer].base + STM32_GTIM_DMAR_OFFSET,
|
||||
(uint32_t)(dshot_burst_buffer[timer]),
|
||||
dshot_handler[timer].dma_size,
|
||||
DSHOT_DMA_SCR);
|
||||
|
||||
// Clean UDE flag before DMA is started
|
||||
io_timer_update_dma_req(timer, false);
|
||||
|
|
|
@ -32,6 +32,6 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
|
||||
#define px4_stm32_dmasetup stm32_dmasetup
|
||||
#include "../../../stm32_common/include/px4_arch/dshot.h"
|
||||
|
||||
|
|
|
@ -33,5 +33,6 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#define px4_stm32_dmasetup stm32_dmasetup
|
||||
#include "../../../stm32_common/include/px4_arch/dshot.h"
|
||||
|
||||
|
|
|
@ -33,5 +33,6 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#define px4_stm32_dmasetup stm32_dmasetup
|
||||
#include "../../../stm32_common/include/px4_arch/dshot.h"
|
||||
|
||||
|
|
|
@ -32,5 +32,18 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <stm32_dma.h>
|
||||
|
||||
static inline void px4_stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr,
|
||||
size_t ntransfers, uint32_t scr)
|
||||
{
|
||||
struct stm32_dma_config_s cfg;
|
||||
cfg.paddr = paddr;
|
||||
cfg.maddr = maddr;
|
||||
cfg.cfg1 = scr;
|
||||
cfg.cfg2 = 0;
|
||||
cfg.ndata = ntransfers;
|
||||
stm32_dmasetup(handle, &cfg);
|
||||
}
|
||||
|
||||
#include "../../../stm32_common/include/px4_arch/dshot.h"
|
||||
|
|
Loading…
Reference in New Issue