Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DShot module #12854

Merged
merged 27 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8874e89
stm32 timers: add dshot implementation
Igor-Misic Aug 31, 2019
9532a63
fmu: remove unused include and variable
bkueng Aug 31, 2019
ca1d68f
MOT_ORDERING, MC_AIRMODE: move param def to mixer_module and 'Mixer O…
bkueng Aug 31, 2019
f253ee0
dshot: add dshot driver
bkueng Aug 31, 2019
929d49e
ROMFS: add dshot startup support
bkueng Aug 31, 2019
474840c
omnibusf4sd: add dshot timer config
bkueng Aug 31, 2019
a3c4b63
fmu-v4: add dshot timer config
Igor-Misic Aug 31, 2019
87fec4c
beta75x airframe: enable DShot600
bkueng Aug 31, 2019
10156f3
px4_micro_hal: add PX4_ARCH_DCACHE_LINESIZE definition
bkueng Sep 2, 2019
78e9837
dshot: handle dcache, flush cache before DMA transfer
bkueng Sep 2, 2019
5ff8193
kakutef7: enable dshot
bkueng Sep 2, 2019
2370c85
dshot: move implementation to a separate directory & library
bkueng Sep 2, 2019
df871ae
esc_status: trim the message and remove unused fields
bkueng Sep 2, 2019
d3e718c
module_schema.yaml: add 'decimal' and 'increment' for floats
bkueng Sep 2, 2019
fb82d94
dshot: add telemetry and publish esc_status message
bkueng Sep 2, 2019
5e0b112
dshot: add support to send commands via CLI
bkueng Sep 2, 2019
1407983
dshot telemetry: retrieve & print ESC info with 'dshot esc_info' CLI …
bkueng Sep 5, 2019
ac6de52
dshot: reduce static buffer size
bkueng Sep 7, 2019
343b5c7
dshot: check if DMA still in progress
bkueng Sep 8, 2019
5da5586
dshot: update timer generation before DMA request
bkueng Sep 8, 2019
479cb6d
kakutef7, kopis airframe: enable dshot & telemetry
bkueng Sep 8, 2019
3aa3943
mixer_module: extend printf status output
bkueng Sep 20, 2019
24bd023
parameters: update perf counter for flash-based param_save_default()
bkueng Sep 23, 2019
940a224
dshot: allow boards to enable dshot only on a subset of the timers
bkueng Sep 24, 2019
e9cd447
fmu-v5: add dshot support
bkueng Sep 24, 2019
6b191aa
parameters: defer auto-saving to after disarming for flash-based params
bkueng Sep 25, 2019
69a5561
fmu-v3: enable DShot
bkueng Sep 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions ROMFS/px4fmu_common/init.d/airframes/4041_beta75x
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ then
param set MPC_MAN_TILT_MAX 60

param set MOT_ORDERING 1
param set PWM_DISARMED 950
param set PWM_MAX 1900
param set PWM_MIN 1250
param set PWM_RATE 0
param set DSHOT_CONFIG 600

param set RC_FLT_CUTOFF 0

Expand Down
17 changes: 8 additions & 9 deletions ROMFS/px4fmu_common/init.d/airframes/4053_holybro_kopis2
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,31 @@ then
param set IMU_GYRO_CUTOFF 120
param set MC_DTERM_CUTOFF 0

param set MC_ROLLRATE_P 0.036
param set MC_ROLLRATE_P 0.075
param set MC_ROLLRATE_I 0.25
param set MC_ROLLRATE_D 0.0006
param set MC_ROLLRATE_D 0.0015
param set MC_ROLLRATE_MAX 1600
param set MC_ROLL_P 10

param set MC_PITCHRATE_P 0.036
param set MC_PITCHRATE_P 0.075
param set MC_PITCHRATE_I 0.32
param set MC_PITCHRATE_D 0.0004
param set MC_PITCHRATE_D 0.0015
param set MC_PITCHRATE_MAX 1600
param set MC_PITCH_P 10

param set MC_YAWRATE_MAX 1000
param set MC_YAWRATE_P 0.04
param set MC_YAWRATE_P 0.15
param set MC_YAW_P 4

param set MOT_ORDERING 1
param set MPC_MANTHR_MIN 0
param set MPC_MAN_TILT_MAX 60
param set PWM_MAX 1950
param set PWM_MIN 1075
param set PWM_RATE 400

param set DSHOT_CONFIG 1200

param set OSD_ATXXXX_CFG 1

param set THR_MDL_FAC 0.7
param set THR_MDL_FAC 0.35

param set MPC_THR_CURVE 1
param set MPC_THR_HOVER 0.12
Expand Down
162 changes: 89 additions & 73 deletions ROMFS/px4fmu_common/init.d/rc.interface
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Otherwise, the variable name goes to the end of the argument.
#

set FMU_CMD fmu
set MIXER_AUX_FILE none
set OUTPUT_AUX_DEV /dev/pwm_output1
set OUTPUT_DEV none
Expand Down Expand Up @@ -42,9 +43,19 @@ then
if [ $IO_PRESENT = yes ]
then
set OUTPUT_MODE io
if param greater DSHOT_CONFIG 0
then
set FMU_CMD dshot
bkueng marked this conversation as resolved.
Show resolved Hide resolved
fi
fi
else
set OUTPUT_MODE fmu
if param greater DSHOT_CONFIG 0
then
set OUTPUT_MODE dshot
set FMU_CMD dshot
else
set OUTPUT_MODE fmu
fi
fi
fi

Expand Down Expand Up @@ -80,11 +91,11 @@ then
fi
fi

if [ $OUTPUT_MODE = fmu ]
if [ $OUTPUT_MODE = $FMU_CMD ]
then
if ! fmu mode_$FMU_MODE $FMU_ARGS
if ! $FMU_CMD mode_$FMU_MODE
then
echo "FMU start failed" >> $LOG_FILE
echo "$FMU_CMD start failed" >> $LOG_FILE
# Error tune.
tune_control play -t 2
fi
Expand Down Expand Up @@ -195,7 +206,7 @@ then

if [ $MIXER_AUX_FILE != none ]
then
if fmu mode_${AUX_MODE} $FMU_ARGS
if $FMU_CMD mode_${AUX_MODE}
then
# Append aux mixer to main device.
if param greater SYS_HITL 0
Expand Down Expand Up @@ -228,82 +239,86 @@ then
set FAILSAFE_AUX none
fi

# Set min / max for aux out and rates.
if [ $PWM_AUX_OUT != none ]
# for DShot do not configure pwm values
if [ $FMU_CMD != dshot ]
then
# Set PWM_AUX output frequency.
if [ $PWM_AUX_RATE != none ]
# Set min / max for aux out and rates.
if [ $PWM_AUX_OUT != none ]
then
pwm rate -c ${PWM_AUX_OUT} -r ${PWM_AUX_RATE} -d ${OUTPUT_AUX_DEV}
fi
# Set PWM_AUX output frequency.
if [ $PWM_AUX_RATE != none ]
then
pwm rate -c ${PWM_AUX_OUT} -r ${PWM_AUX_RATE} -d ${OUTPUT_AUX_DEV}
fi

# Set disarmed, min and max PWM_AUX values.
if [ $PWM_AUX_DISARMED != none ]
then
pwm disarmed -c ${PWM_AUX_OUT} -p ${PWM_AUX_DISARMED} -d ${OUTPUT_AUX_DEV}
fi
if [ $PWM_AUX_MIN != none ]
then
pwm min -c ${PWM_AUX_OUT} -p ${PWM_AUX_MIN} -d ${OUTPUT_AUX_DEV}
# Set disarmed, min and max PWM_AUX values.
if [ $PWM_AUX_DISARMED != none ]
then
pwm disarmed -c ${PWM_AUX_OUT} -p ${PWM_AUX_DISARMED} -d ${OUTPUT_AUX_DEV}
fi
if [ $PWM_AUX_MIN != none ]
then
pwm min -c ${PWM_AUX_OUT} -p ${PWM_AUX_MIN} -d ${OUTPUT_AUX_DEV}
fi
if [ $PWM_AUX_MAX != none ]
then
pwm max -c ${PWM_AUX_OUT} -p ${PWM_AUX_MAX} -d ${OUTPUT_AUX_DEV}
fi
fi
if [ $PWM_AUX_MAX != none ]

#
# Per channel disarmed settings.
#
pwm disarmed -c 1 -p p:PWM_AUX_DIS1 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 2 -p p:PWM_AUX_DIS2 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 3 -p p:PWM_AUX_DIS3 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 4 -p p:PWM_AUX_DIS4 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 5 -p p:PWM_AUX_DIS5 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 6 -p p:PWM_AUX_DIS6 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 7 -p p:PWM_AUX_DIS7 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 8 -p p:PWM_AUX_DIS8 -d ${OUTPUT_AUX_DEV}

#
# Per channel min settings.
#
pwm min -c 1 -p p:PWM_AUX_MIN1 -d ${OUTPUT_AUX_DEV}
pwm min -c 2 -p p:PWM_AUX_MIN2 -d ${OUTPUT_AUX_DEV}
pwm min -c 3 -p p:PWM_AUX_MIN3 -d ${OUTPUT_AUX_DEV}
pwm min -c 4 -p p:PWM_AUX_MIN4 -d ${OUTPUT_AUX_DEV}
pwm min -c 5 -p p:PWM_AUX_MIN5 -d ${OUTPUT_AUX_DEV}
pwm min -c 6 -p p:PWM_AUX_MIN6 -d ${OUTPUT_AUX_DEV}
pwm min -c 7 -p p:PWM_AUX_MIN7 -d ${OUTPUT_AUX_DEV}
pwm min -c 8 -p p:PWM_AUX_MIN8 -d ${OUTPUT_AUX_DEV}

#
# Per channel max settings.
#
pwm max -c 1 -p p:PWM_AUX_MAX1 -d ${OUTPUT_AUX_DEV}
pwm max -c 2 -p p:PWM_AUX_MAX2 -d ${OUTPUT_AUX_DEV}
pwm max -c 3 -p p:PWM_AUX_MAX3 -d ${OUTPUT_AUX_DEV}
pwm max -c 4 -p p:PWM_AUX_MAX4 -d ${OUTPUT_AUX_DEV}
pwm max -c 5 -p p:PWM_AUX_MAX5 -d ${OUTPUT_AUX_DEV}
pwm max -c 6 -p p:PWM_AUX_MAX6 -d ${OUTPUT_AUX_DEV}
pwm max -c 7 -p p:PWM_AUX_MAX7 -d ${OUTPUT_AUX_DEV}
pwm max -c 8 -p p:PWM_AUX_MAX8 -d ${OUTPUT_AUX_DEV}

if [ $FAILSAFE_AUX != none ]
then
pwm max -c ${PWM_AUX_OUT} -p ${PWM_AUX_MAX} -d ${OUTPUT_AUX_DEV}
pwm failsafe -c ${PWM_AUX_OUT} -p ${FAILSAFE} -d ${OUTPUT_AUX_DEV}
fi
fi

#
# Per channel disarmed settings.
#
pwm disarmed -c 1 -p p:PWM_AUX_DIS1 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 2 -p p:PWM_AUX_DIS2 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 3 -p p:PWM_AUX_DIS3 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 4 -p p:PWM_AUX_DIS4 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 5 -p p:PWM_AUX_DIS5 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 6 -p p:PWM_AUX_DIS6 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 7 -p p:PWM_AUX_DIS7 -d ${OUTPUT_AUX_DEV}
pwm disarmed -c 8 -p p:PWM_AUX_DIS8 -d ${OUTPUT_AUX_DEV}

#
# Per channel min settings.
#
pwm min -c 1 -p p:PWM_AUX_MIN1 -d ${OUTPUT_AUX_DEV}
pwm min -c 2 -p p:PWM_AUX_MIN2 -d ${OUTPUT_AUX_DEV}
pwm min -c 3 -p p:PWM_AUX_MIN3 -d ${OUTPUT_AUX_DEV}
pwm min -c 4 -p p:PWM_AUX_MIN4 -d ${OUTPUT_AUX_DEV}
pwm min -c 5 -p p:PWM_AUX_MIN5 -d ${OUTPUT_AUX_DEV}
pwm min -c 6 -p p:PWM_AUX_MIN6 -d ${OUTPUT_AUX_DEV}
pwm min -c 7 -p p:PWM_AUX_MIN7 -d ${OUTPUT_AUX_DEV}
pwm min -c 8 -p p:PWM_AUX_MIN8 -d ${OUTPUT_AUX_DEV}

#
# Per channel max settings.
#
pwm max -c 1 -p p:PWM_AUX_MAX1 -d ${OUTPUT_AUX_DEV}
pwm max -c 2 -p p:PWM_AUX_MAX2 -d ${OUTPUT_AUX_DEV}
pwm max -c 3 -p p:PWM_AUX_MAX3 -d ${OUTPUT_AUX_DEV}
pwm max -c 4 -p p:PWM_AUX_MAX4 -d ${OUTPUT_AUX_DEV}
pwm max -c 5 -p p:PWM_AUX_MAX5 -d ${OUTPUT_AUX_DEV}
pwm max -c 6 -p p:PWM_AUX_MAX6 -d ${OUTPUT_AUX_DEV}
pwm max -c 7 -p p:PWM_AUX_MAX7 -d ${OUTPUT_AUX_DEV}
pwm max -c 8 -p p:PWM_AUX_MAX8 -d ${OUTPUT_AUX_DEV}

if [ $FAILSAFE_AUX != none ]
then
pwm failsafe -c ${PWM_AUX_OUT} -p ${FAILSAFE} -d ${OUTPUT_AUX_DEV}
#
# Per channel failsafe settings.
#
pwm failsafe -c 1 -p p:PWM_AUX_FAIL1 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 2 -p p:PWM_AUX_FAIL2 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 3 -p p:PWM_AUX_FAIL3 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 4 -p p:PWM_AUX_FAIL4 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 5 -p p:PWM_AUX_FAIL5 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 6 -p p:PWM_AUX_FAIL6 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 7 -p p:PWM_AUX_FAIL7 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 8 -p p:PWM_AUX_FAIL8 -d ${OUTPUT_AUX_DEV}
fi

#
# Per channel failsafe settings.
#
pwm failsafe -c 1 -p p:PWM_AUX_FAIL1 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 2 -p p:PWM_AUX_FAIL2 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 3 -p p:PWM_AUX_FAIL3 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 4 -p p:PWM_AUX_FAIL4 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 5 -p p:PWM_AUX_FAIL5 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 6 -p p:PWM_AUX_FAIL6 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 7 -p p:PWM_AUX_FAIL7 -d ${OUTPUT_AUX_DEV}
pwm failsafe -c 8 -p p:PWM_AUX_FAIL8 -d ${OUTPUT_AUX_DEV}
fi
fi

Expand Down Expand Up @@ -386,6 +401,7 @@ then
pwm failsafe -c 8 -p p:PWM_MAIN_FAIL8
fi

unset FMU_CMD
unset MIXER_AUX_FILE
unset OUTPUT_AUX_DEV
unset OUTPUT_DEV
2 changes: 0 additions & 2 deletions ROMFS/px4fmu_common/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ set FAILSAFE none
set FAILSAFE_AUX none
set FCONFIG /fs/microsd/etc/config.txt
set FEXTRAS /fs/microsd/etc/extras.txt
set FMU_ARGS ""
set FMU_MODE pwm
set FRC /fs/microsd/etc/rc.txt
set IOFW "/etc/extras/px4_io-v2_default.bin"
Expand Down Expand Up @@ -521,7 +520,6 @@ unset FAILSAFE
unset FAILSAFE_AUX
unset FCONFIG
unset FEXTRAS
unset FMU_ARGS
unset FMU_MODE
unset FRC
unset IO_PRESENT
Expand Down
2 changes: 2 additions & 0 deletions boards/av/x-v1/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@

#define BOARD_ENABLE_CONSOLE_BUFFER

#define BOARD_NUM_IO_TIMERS 5

__BEGIN_DECLS

/****************************************************************************************************
Expand Down
1 change: 1 addition & 0 deletions boards/holybro/kakutef7/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ px4_add_board(
DRIVERS
adc
barometer/bmp280
dshot
gps
imu/mpu6000
magnetometer
Expand Down
3 changes: 2 additions & 1 deletion boards/holybro/kakutef7/init/rc.board_extras
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ then
atxxxx start
fi


# DShot telemetry is always on UART7
dshot telemetry /dev/ttyS5

5 changes: 0 additions & 5 deletions boards/holybro/kakutef7/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@
#define GPIO_UART7_RX GPIO_UART7_RX_1 /* PE7 */
#define GPIO_UART7_TX GPIO_UART7_TX_1 /* PE8 */

/* UART RX DMA configurations */

#define DMAMAP_USART1_RX DMAMAP_USART1_RX_2
#define DMAMAP_USART6_RX DMAMAP_USART6_RX_2

/* SPI
* SPI1 SD Card
* SPI2 is OSD AT7456E
Expand Down
9 changes: 8 additions & 1 deletion boards/holybro/kakutef7/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
# CONFIG_MMCSD_HAVE_CARDDETECT is not set
Expand Down Expand Up @@ -156,6 +163,7 @@ CONFIG_STM32F7_BBSRAM=y
CONFIG_STM32F7_BBSRAM_FILES=5
CONFIG_STM32F7_BKPSRAM=y
CONFIG_STM32F7_DMA1=y
CONFIG_STM32F7_DMA2=y
CONFIG_STM32F7_I2C1=y
CONFIG_STM32F7_I2C_DYNTIMEO=y
CONFIG_STM32F7_I2C_DYNTIMEO_STARTSTOP=10
Expand Down Expand Up @@ -191,7 +199,6 @@ CONFIG_TASK_NAME_SIZE=24
CONFIG_TIME_EXTENDED=y
CONFIG_UART4_BAUD=57600
CONFIG_UART4_RXBUFSIZE=600
CONFIG_UART4_RXDMA=y
CONFIG_UART4_TXBUFSIZE=1500
CONFIG_UART7_BAUD=57600
CONFIG_UART7_RXBUFSIZE=600
Expand Down
2 changes: 2 additions & 0 deletions boards/holybro/kakutef7/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@

#define BOARD_ENABLE_CONSOLE_BUFFER

#define BOARD_NUM_IO_TIMERS 4

__BEGIN_DECLS

/****************************************************************************************************
Expand Down
Loading