Dshot is drone ESC digital protocol
You need STM32 MCU, BLHeli_32 ESC, BLDC
STM32 MCU makes Dshot signal using PWM and DMA
KEYWORD - DSHOT
BLHeli_32 ESC
BLDC
STM32 HAL
TIMER
PWM
DMA
- STM32CubeIDE
- STM32 HAL driver
- STM32F411
- BLHeli_32 ESC
- Drone BLDC
- Change motor throttle
- Throttle range : 2000 steps (0% - 100%)
- Choose Dshot 150/300/600
- Other command : no
- Telemetry : no
1st | 2nd | 3rd | |
---|---|---|---|
ESC Firmware | BLHeli | BLHeli_S | BLHeli_32 |
Analogue signal | Digital signal |
|
---|---|---|
ESC Protocol | PWM Oneshot125 Oneshot42 Multishot |
Dshot150 Dshot300 Dshot600 Proshot1000 |
- 11bits : 0 - 47 command, 48 - 2047 throttle
- 1bit : telemetry request
- 4bits : checksum
bit 0 | bit 1 | |
---|---|---|
duty cycle | 37.425% | 74.850% |
bits / sec | sec / bit | sec / frame | |
---|---|---|---|
Dshot150 | 150,000 bits/s | 6.67us | 106.7us |
Dshot300 | 300,000 bits/s | 3.33us | 53.3us |
Dshot600 | 600,000 bits/s | 1.67us | 26.7us |
- throttle value : 11 / telemetry request : 0 (no) / checksum 4 bits
- 0 0 0 0 0 0 0 1 0 1 1 / 0 / 0 1 1 1
- After power on, Send zero throttle for a while until 1 high beep is ended.
- 7p of BLHeli_32 manual ARM Rev32.x.pdf
- TIM5, TIM2 is 100MHz
- MOTOR 1 - PA3
- MOTOR 2 - PA2
- MOTOR 3 - PA0
- MOTOR 4 - PA1
- Some instance are not pre-defined, so need to change in person...
- like
TIM_DMA_ID_CC4
,TIM_DMA_CC4
,CCR4
...
- like
/* User Configuration */
// Timer Clock
#define TIMER_CLOCK 100000000 // 100MHz
// MOTOR 1 (PA3) - TIM5 Channel 4, DMA1 Stream 3
#define MOTOR_1_TIM (&htim5)
#define MOTOR_1_TIM_CHANNEL TIM_CHANNEL_4
// MOTOR 2 (PA2) - TIM2 Channel 3, DMA1 Stream 1
#define MOTOR_2_TIM (&htim2)
#define MOTOR_2_TIM_CHANNEL TIM_CHANNEL_3
// MOTOR 3 (PA0) - TIM2 Channel 1, DMA1 Stream 5
#define MOTOR_3_TIM (&htim2)
#define MOTOR_3_TIM_CHANNEL TIM_CHANNEL_1
// MOTOR 4 (PA1) - TIM5 Channel 2, DMA1 Stream 4
#define MOTOR_4_TIM (&htim5)
#define MOTOR_4_TIM_CHANNEL TIM_CHANNEL_2
- only contain dshot things
#include "dshot.h"
// 4 motor value
uint16_t my_motor_value[4] = {0, 0, 0, 0};
int main (void)
{
// initialize
dshot_init(DSHOT600);
while (1)
{
// transmit new dshot signals
dshot_write(my_motor_value);
HAL_Delay(1);
}
}