Skip to content

Configuration

neoxic edited this page Aug 12, 2023 · 11 revisions

This page corresponds to the latest firmware revision. Previous versions of this page can be found here.

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 Select motor timing
41 Select PWM frequency
42 Increase acceleration ramping
43 Decrease acceleration ramping
47 Reset settings to defaults

Commands 40-47 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  # Select the next timing value
dshotprog 255 12  # Save settings

Command 41 (select PWM frequency) selects the next value that corresponds to the following settings:

# freq_min freq_max
1 24 48
2 28 56
3 32 64
4 36 72
5 40 80
6 44 88
7 48 96

CLI (command line interface)

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. Go to Motors, set ESC/Motor protocol to DISABLED, and click Save and Reboot.

  3. Make sure ESCSERIAL resource is assigned to an inactive pin with a timer.

  4. 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's serial device (COM port) for one-way connection.

Connecting via ESCape32 CLI Utility

Download the latest release here and run:

escape32-cli -d /dev/mySerialDevice

On Windows, COM port must be specified as /dev/ttySx, i.e. COM1 → /dev/ttyS0, COM2 → /dev/ttyS1, etc.

On UNIX, the list of serial devices can be retrieved by running:

ls /dev/tty*  # Linux
ls /dev/cu.*  # macOS
ls /dev/cua*  # BSD

Connecting via socat

Examples depending on socat's flavour:

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

Connecting via PuTTY on Windows

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.

save

Save settings. For example, the following commands reverse motor direction and save the changes:

set revdir 1
save

reset

Reset settings to defaults.

play <music> [<volume>]

Play <music> with optional <volume>. See also music for music format. Examples:

play cdefg_g_a2Cag_g
play a2D_D3EF#2D_D3C#b2E_E3DC#2a_a3

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 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. In the following example, the last two commands beep the current timing value:

beep
get timing
beep

Settings

arm: 1

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

  • 0: off
  • 1: on

damp: 1

Enable damped mode (complementary PWM, 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].

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. Damped mode must be enabled (the default) before sine startup mode can be activated.

sine_power: 8

Sine startup power (%) [1..15]. Use 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: 10

Maximum power during spin-up (%) [1..25]. 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: 25

Acceleration ramping (0.1*X %/ms) [1..100]. This value controls power increase during acceleration. Should the motor stutter on a full throttle punch, try decreasing it. Alternatively, you can try increasing timing albeit at the cost of efficiency and torque.

duty_drag: 75

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 servo 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, Oneshot125, DSHOT
  • 1: analog
  • 2: serial (+)
  • 3: iBUS
  • 4: SBUS (*)

Mode 1 is available on ESCs with PA2/PA6 input pin. Modes 2-4 are 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..16].

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.

volume: 25

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

beacon: 50

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

led: 0

LED on/off bits [0..15].

brushed: 0

Enable brushed mode:

  • 0: off
  • 1: on

In this mode, the ESC can be used with brushed motors connected to phases A and B (or C and B). The following settings have no effect: timing, sine_range, sine_power, freq_max, duty_spup.

Clone this wiki locally