Skip to content

Configuration

neoxic edited this page May 2, 2023 · 11 revisions

DSHOT programming

Command Description
1-5 Play beacon tone 1-5
7 Set normal motor direction
8 Set reversed motor direction
9 3D mode off (unidirectional mode)
10 3D mode on (bidirectional mode)
12 Save settings
20 Turtle mode off
21 Turtle mode on
22-25 LED 1-4 on
26-29 LED 1-4 off
40 Increase motor timing
41 Decrease motor timing
42 Increase acceleration ramping
43 Decrease acceleration ramping

Commands 40-43 are non-standard hence they must be manually repeated at least 6 times. They beep the new value back. For example:

dshotprog 255 40 40 40 40 40 40  # Increase "timing" value by 1
dshotprog 255 12  # Save settings

CLI

The firmware features a UNIX-style console (no echo, LF as EOL) on the signal line at 38400 baud 8N1 using a USB-TTL adapter. Although not strictly required (see below), the following simple circuit is needed to convert two RX/TX pins on the USB-TTL adapter into one-wire two-way connection with the ESC:

In case of one-way connection when the ESC is connected to the TX and GND pins or via Betaflight, type beep to enable audio feedback mode. You should hear a beep in return.

For connection via Betaflight, use KISS ESC passthrough mode:

  1. Open Betaflight Configurator.

  2. Make sure ESCSERIAL resource is assigned to PPM pin (or any other pin with a timer).

  3. Go to Motors, set ESC/Motor protocol to DISABLED, and click Save and Reboot.

  4. After reboot, go to CLI and type one of the following to enter passthrough mode:

     escprog ki 0  # Connect to ESC 1
     escprog ki 1  # Connect to ESC 2
     escprog ki 2  # Connect to ESC 3
     escprog ki 3  # Connect to ESC 4
    
  5. Close Betaflight Configurator.

  6. Use Betaflight serial device (COM port) for one-way connection.

Connecting via socat

Examples depending on socat's flavour:

socat - /dev/ttyUSB0,rawer,b38400
socat - /dev/cu.SLAB_USBtoUART,rawer,ispeed=38400,ospeed=38400

Connecting via PuTTY

Since standard PuTTY uses CR as EOL for serial connections, download modified PuTTY.

Open a serial connection, turn on echo, and enable CR/LF:

Commands

help

Print basic usage help.

info

Print ESC information.

show

Print settings.

get <param>

Print (and beep if audio feedback mode is enabled) the value of <param>.

set <param> <value>

Set <param> to <value> and print (and beep if audio feedback mode is enabled) the resulting (possibly trimmed) value.

reset

Reset settings to defaults. Type save to save the changes.

save

Save settings.

play <music> [<volume>]

Play <music> with optional <volume>.

throt <value>

Set the current throttle position as value between -2000 (full reverse) and 2000 (full forward). This command is intended for real time testing. Use with caution because this command actually starts the motor. If arming is enabled (the default), type throt 0 to arm the ESC. It is possible to change settings on the fly while the motor is running.

beep

Enable audio feedback mode. This command also beeps the last value.

Examples

info
ESCape32 rev3 [ESCAPE1]
Temp: 25C
Volt: 11.60V
Curr: 0.00A
Csum: 0mAh
ERPM: 0
OK
beep
OK
get revdir
revdir: 0
OK
set revdir 1
revdir: 1
OK
save
OK
play cdefg_g_a2Cag_g
OK
play a2D_D3EF#2D_D3C#b2E_E3DC#2a_a3
OK
throt 0
OK
throt 100
OK
throt 0
OK

Settings

arm: 1

Enable arming (wait for 250ms zero throttle on startup):

  • 0: off
  • 1: on

damp: 1

Enable damped mode (active freewheeling):

  • 0: off
  • 1: on

revdir: 0

Reversed motor direction:

  • 0: off
  • 1: on

timing: 4

Motor timing (3.75*X degrees) [1..7]. The default value is the middle ground in most cases. Should the motor stutter on a full throttle punch, try increasing this value a notch. See also duty_ramp.

sine_range: 0

Sine startup range (%) [0 - off, 5..25]. This value sets the portion of throttle range dedicated to sine startup mode. Additionally, increasing duty_min a notch can help smooth out transition between sine startup and normal drive.

sine_power: 8

Sine startup power (%) [1..15]. Use with caution because higher values may lead to motor overheating.

freq_min: 24

Minimum PWM frequency (kHz) [16..48].

freq_max: 48

Maximum PWM frequency (kHz) [16..96]. Smooth transition from minimum to maximum PWM frequency happens across 30000-60000 ERPM range.

duty_min: 1

Minimum duty cycle (%) [1..100].

duty_max: 100

Maximum duty cycle (%) [1..100].

duty_spup: 15

Maximum power during spin-up (%) [1..100]. Higher values give more power to the motor until the first sync'ed revolution, yet may increase the risk of overheating should the motor get jammed during a full throttle punch. Do not exceed the default value unless you know what you are doing.

duty_ramp: 10

Acceleration ramping (0.5*X %/ms) [0 - off, 1..10]. This parameter controls power increase during acceleration. Decreasing this value is another way to eliminate desyncs on a full throttle punch. See also timing.

duty_drag: 0

Drag brake amount when the motor is stopped (%) [0..100]. This value is also a starting brake amount in proportional brake mode.

throt_mode: 0

Throttle mode:

  • 0: forward
  • 1: forward/reverse
  • 2: forward/brake/reverse (proportional brake mode)

throt_cal: 1

Automatic throttle calibration for standard servo PWM frequencies, e.g. 50Hz, 100Hz, 125Hz, 200Hz, 250Hz, 333Hz:

  • 0: off
  • 1: on

This mode works by aligning the internal clock with servo PWM period that is a multiple of 1000µs, i.e. for PWM frequency F=1000/n where n=3..20. It must be disabled should a non-standard servo PWM signal be used.

throt_min: 1000

Minimum throttle in servo PWM mode (µs).

throt_mid: 1500

Middle throttle in servo PWM mode (µs).

throt_max: 2000

Maximum throttle in servo PWM mode (µs).

input_mode: 0

Input mode:

  • 0: servo PWM, DSHOT
  • 1: analog
  • 2: serial (+)
  • 3: iBUS
  • 4: SBUS (*)

Mode 1 is available on ESCs with PA2/PA6 input pin. Mode 2-4 is available on ESCs with PA2 input pin.

(+) 16-bit value (first low byte, then high byte) is received at 115200 baud 8N1 following by at least one idle character, lower 12 bits are throttle value from -2000 (full reverse) to 2000 (full forward), higher 4 bits are CRC (XOR'ed nibbles), update rate is 40Hz or higher.

(*) Uninverted on AT32F421 MCU.

input_chid: 0

iBUS/SBUS channel ID [0 - off, 1..14 - iBUS, 1..16 - SBUS].

telem_mode: 0

Telemetry mode:

  • 0: KISS
  • 1: KISS auto (+)
  • 2: iBUS
  • 3: S.Port (*)

(+) Telemetry data is sent every 32ms.

(*) Uninverted on AT32F421 MCU.

telem_phid: 0

S.Port physical ID [0 - off, 1..28].

telem_poles: 14

Number of motor poles for RPM telemetry [2..100].

prot_temp: 0

Temperature threshold (˚C) [0 - off, 60..140]. If enabled, maximum power is reduced when the ESC becomes hotter than this temperature. The lowest maximum power is 25% at 15˚C above the theshold.

prot_volt: 0

Low voltage cutoff per battery cell (V/10) [0 - off, 28..38].

prot_cells: 0

Number of battery cells [0 - auto, 1..12].

prot_curr: 0

Maximum current (A) [0..255].

music

Startup music. A sequence of characters is translated into music in the following way:

  • _ (underscore) is a pause;
  • cdefgab are low notes;
  • CDEFGAB are high notes;
  • # (pound) after a note makes it a sharp note;
  • 12345678 after a note or pause is a duration: 1 - 1/16 (default), 2 - 1/8, 3 - 3/16, 4 - 1/4, etc.

See Examples above.

volume: 25

Sound volume (%) [0..100].

beacon: 50

Beacon volume (%) [0..100].

Clone this wiki locally