User Tools

Site Tools


The QuimDC Command Line Interface

The QuimDC Command Line Interface (C.L.I.) aims to behave like the linux bash.


  • You can type “help” to display all the available commands
  • You can use “tab” to auto complete a command
  • You can use “tab” twice to display all the possible commands for the auto complete
  • You can move to the right and to the left using the Right and Left arrow keys
  • You can retrieve the last past commands using the Up and Down arrow keys even after a reboot or a flash of the card
  • All debug commands begin by “dbg_”, to print a list of debug commands type “dbg_” and use “tab”

Official API

This section describes all the command type available through CLI.

Help Command

Display the list of all available commands except debug commands with their syntax.

- motor_reset_position <int>
- srst
- rword <int>
- loop_mesurement [<motor>] [<int value>]
- ref_pwm [<motor>] [<int value>]
- ref_speed [<motor>] [<int value>]
- ref_position [<motor>] [<int value>]
- ref_current [<motor>] [<int value>]
- encoder_motor [<motor>]
- current_motor [<motor>]
- speed_motor [<motor>]
- pwm_motor [<motor>]
- motor_watchdog_value [<int value>]
- speed_pid_p [<motor>] [<int value>]
- speed_pid_i [<motor>] [<int value>]
- speed_pid_d [<motor>] [<int value>]
- speed_pid_do [<motor>] [<int value>]
- speed_pid_fixed_point_divider [<motor>] [<int value>]
- speed_pid_uIAntiWU_Limit [<motor>] [<int value>]
- current_pid_p [<motor>] [<int value>]
- current_pid_i [<motor>] [<int value>]
- current_pid_d [<motor>] [<int value>]
- current_pid_do [<motor>] [<int value>]
- current_pid_fixed_point_divider [<motor>] [<int value>]
- current_pid_uIAntiWU_Limit [<motor>] [<int value>]
- position_pid_p [<motor>] [<int value>]
- position_pid_i [<motor>] [<int value>]
- position_pid_d [<motor>] [<int value>]
- position_pid_do [<motor>] [<int value>]
- position_pid_fixed_point_divider [<motor>] [<int value>]
- position_pid_uIAntiWU_Limit [<motor>] [<int value>]
- pwmDutyMax [<motor>] [<int value>]
- bemf_compensation [<motor>] [<int value>]
- loop_function [<motor>] [<int value>]
- ticks_per_turn_motor [<motor>] [<int value>]
- resistance_motor [<motor>] [<float value>]
- kv_motor [<motor>] [<float value>]
- nominal_power_voltage [<motor>] [<float value>]
- polarity [<motor>] [<int value>]
- position_speed_period [<motor>] [<int value>]
- print_board_states
- enterOperationalMode
- leaveOperationalMode
- startAutoPublish [<motor>] [<int value>]
- stopAutoPublish [<motor>]
- save_parameters_to_flash
- load_parameters_from_flash
- erase_flash
- help

Board States

The print_board_states displays useful informations according to the current loop function of each motor. Here is an example with motor 1 in position speed current closed loop and motor 2 in pwm open loop :

D:005-000000 ####################
D:006-000000 # THE BOARD STATES #
D:007-000000 ####################
D:008-000000 Operational Mode : no
D:009-000000 Motor Watchdog value : 15
D:010-000000 Right Motor(1) : 
D:011-000000     Control : Position Speed Current double Closed Loop
D:012-000000     Polarity : 1
D:013-000000     Position and Speed Period : 1 ms
D:014-000000     Position ref : 0 tick
D:015-000000     Position PID : p=10000 i=1000 d=0 do=0 uIAntiWU=15000 FPdivider=128
D:016-000000     Speed ref : 0 tick/s
D:017-000000     Speed PID : p=5 i=1 d=0 do=0 uIAntiWU=40000 FPdivider=300
D:018-000000     Current ref : 0 mA | 0 ADC
D:019-000000     Current PID : p=0 i=5 d=0 do=0 uIAntiWU=15000 FPdivider=128
D:020-000000     Resistance : 1.000000 Ohm
D:021-000000     Kv : inf Rpm/V
D:022-000000     Ticks Per Turn : 1
D:023-000000     Nominal Power Voltage : 1.000000 V
D:024-000000 Left Motor(2) : 
D:025-000000     Control : Pwm Open Loop

Save parameters

You can save the parameters using save_parameters_to_flash.


>D:001-000000 Parameters saved

Operational Mode

To enter operational mode use :


To leave operational mode use :


Data Publication

Some information like average speed, PWM duty cycle, voltage, and current can be published periodically to the serial port. To enable this auto-publishing mode for a specific motor, use :

>startAutoPublish [<motor>] [<int frequency>]

To disable auto-publishing mode, use :

>stopAutoPublish [<motor>]

Motor Parameters

Getter and Setter

Some functions are used to access specific parameters for each motor. They can take up to 2 parameters :

- func_name [<motor>] [<int value>]

Let's use ref_speed as an example :

  • With 0 parameter, ref_speed displays the reference/target speed for both motors separated by ':'.

>D:001-000000 ans = 30000:15000
  • With 1 parameter, ref_speed displays the reference/target speed for the selected motor. The parameter is called motor and can take the following value : '1' '2' 'r' 'l'. '1' and 'r' stand for the right motor and '2' and 'l' stand for the left one.
>ref_speed 1

>D:001-000000 ans = 30000

>ref_speed l

>D:001-000000 ans = 15000
  • With 2 parameters, ref_speed will set the reference/target speed for the selected motor. [<int value>] or [<float value>] in the help section indicate the type value.
>ref_speed r 

>D:001-000000 ans = 30000

>ref_speed r 0

>ref_speed r 

>D:003-000000 ans = 0


>D:004-000000 ans = 0:15000

List of commands :

Name Type value Range value Comment
ref_speed int [0;2147483647] reference/target speed (tick/s or pwm)
ref_position int [0;2147483647] reference/target position (tick)
ref_current int [0;2147483647] reference/target current (mA)
speed_pid_p int [0;2147483647]
speed_pid_i int [0;2147483647]
speed_pid_d int [0;2147483647]
speed_pid_do int [0;2147483647]
speed_pid_fixed_point_divider int [0;2147483647]
speed_pid_uIAntiWU_Limit int [0;2147483647] saturation limit for pid integral terme
current_pid_p int [0;2147483647]
current_pid_i int [0;2147483647]
current_pid_d int [0;2147483647]
current_pid_do int [0;2147483647]
current_pid_fixed_point_divider int [0;2147483647]
current_pid_uIAntiWU_Limit int [0;2147483647]
position_pid_p int [0;2147483647]
position_pid_i int [0;2147483647]
position_pid_d int [0;2147483647]
position_pid_do int [0;2147483647]
position_pid_fixed_point_divider int [0;2147483647]
position_pid_uIAntiWU_Limit int [0;2147483647]
loop_function int 0,1,2,3
ticks_per_turn_motor int [0;2147483647]
resistance_motor float [0.0;inf] Ohm (type inf to set the value to INFINITY)
kv_motor float [0.0;inf] Rpm/V (type inf to set the value to INFINITY)
nominal_power_voltage float [0.0;inf] V (type inf to set the value to INFINITY)
polarity int -1 or 1 only -1 and 1 are supported any other value will have unexpected results
position_speed_period int [0;2147483647]

Getter and Setter for both motor

Some functions allow you to get and set one parameter for both motors at the same time. They can take up to 1 parameter :

- func_name [<int value>]

Let's use motor_watchdog_value as an example :

  • With 0 parameter, motor_watchdog_value displays the card watchdog value.

>D:001-000000 ans = -1
  • With 1 parameter, motor_watchdog_value sets the card watchdog value at the specific value.
>motor_watchdog_value 15


>D:003-000000 ans = 15

List of commands :

Name Type value Range value Comment
motor_watchdog_value int [-1;2147483647] -1 will disable the watchdog


Some functions are read only, they take up to 1 parameter :

- func_name [<motor>]

Let's use encoder_motor as an example :

  • With 0 parameter, encoder_motor display the encoder value for both motor separated by ':'.

>D:001-000000 ans = 0:45359
  • With 1 parameter, encoder_motor displays the encoder value for the selected motor. The parameter is called motor and can take the following value : '1' '2' 'r' 'l'. '1' and 'r' stand for the right motor and '2' and 'l' stand for the left one.
>encoder_motor 1

>D:001-000000 ans = 0

>encoder_motor l

>D:001-000000 ans = 45359

List of commands :

  • encoder_motor
  • current_motor
Name Type value Range value Comment
encoder_motor int [0;65535] 16 bits counter
current_motor int [0;4096] 12 bits ADC

Flash memory layout (deprecated)

See “How to write a parameter in the flash” for more information.

The maximum length of a command is 64 characters. Each flash page is composed of 2048 “32 bits” units. But because of the prefetch buffer, only 512 units are available. One unit can store 4 characters so we can save 2048 characters per page.

Therefore we can save 32 command lines per page. The first page will be reserved for some configuration. The following table describes the flash memory layout for the command history.

Group's name Name Address Description
Configurations ADDR_CHECK_HISTORY_INIT 0x0807F000 If set to 0, means that a history is stored in the flash
ADDR_NUMBER_HISTORY_SAVED 0x0807F004 The number of commands saved in this page
Command 1 ADDR_FIRST_HISTORY_CMD 0x0807F040 ex : h,e,l
None 0x0807F044 ex : p,\0,0xFF
Command 2 None 0x0807F080 ex : t,r,c
None 0x0807F084 ex : _,t,o
None 0x0807F084 ex : g,g,l
None 0x0807F084 ex : e, ,4
None 0x0807F084 ex : 4,\0,0xFF
Command 3 None 0x0807F0C0

For example, here the Command 1 is “help” and the Command 2 is “trc_toggle 44”. “trc_toggle 44” was the last command typed by the user.

the_quimdc_command_line_interface.txt · Last modified: 2019/07/16 15:19 by ddecoeyer