Use this file to discover all available pages before exploring further.
VESC firmware supports three motor types and a unified control interface (mc_interface) that works across all of them. You select the motor type and control mode through the configuration, and issue commands through the same set of functions regardless of the underlying algorithm.
Field Oriented Control. Sinusoidal current control with smooth torque and high efficiency. Supports sensorless, Hall sensor, encoder, and HFI feedback.
BLDC
Trapezoidal commutation for brushless DC motors. Lower computational overhead than FOC. Supports sensorless, sensored, and hybrid modes.
DC
Brushed DC motor support. Uses a fixed switching frequency defined by MCCONF_M_DC_F_SW (default: 25000 Hz).
The motor type is set via the mc_motor_type enum defined in datatypes.h:
All motor control commands go through mc_interface. This layer handles safety limits, fault detection, and dispatches to the underlying BLDC or FOC implementation.
// Get the current motor configuration (read-only pointer)const volatile mc_configuration *mc_interface_get_configuration(void);// Apply a new motor configurationvoid mc_interface_set_configuration(mc_configuration *configuration);// Calculate configuration CRC for validationunsigned mc_interface_calc_crc(mc_configuration *conf, bool is_motor_2);// Check if DC calibration has completedbool mc_interface_dccal_done(void);
// Get the current fault codemc_fault_code mc_interface_get_fault(void);// Convert a fault code to a human-readable stringconst char *mc_interface_fault_to_string(mc_fault_code fault);
When a fault occurs, the controller ignores new commands for MCCONF_M_FAULT_STOP_TIME milliseconds (default: 500 ms) before resuming normal operation.
VESC hardware with dual motor support uses mc_interface_select_motor_thread() to select which motor the current thread controls:
// Select motor 1 or 2 for the calling threadvoid mc_interface_select_motor_thread(int motor);// Get the motor currently selected for this threadint mc_interface_get_motor_thread(void);// Get the motor currently active (1 or 2)int mc_interface_motor_now(void);