Skip to main content
VESC firmware supports trapezoidal (six-step) BLDC commutation as an alternative to FOC. BLDC mode has lower computational overhead and can work well for high-speed, low-torque applications where smooth sinusoidal current waveforms are not required.
The default motor type is FOC. To use BLDC mode, set MCCONF_DEFAULT_MOTOR_TYPE to MOTOR_TYPE_BLDC or change the motor type in VESC Tool.

PWM modes

The PWM switching scheme is selected via mc_pwm_mode in datatypes.h:

NONSYNCHRONOUS_HISW

High-side switching only. The low-side switch freewheels. Not recommended — higher losses and less reliable current sensing.

SYNCHRONOUS

Both high-side and low-side switches are actively controlled. This is the recommended and most tested mode. Default.

BIPOLAR

Drives both phases of the active pair simultaneously. Doubles the effective switching frequency. Can cause MOSFET failures — use with caution.
The default is PWM_MODE_SYNCHRONOUS (MCCONF_PWM_MODE).

Commutation modes

The commutation zero-crossing detection strategy is set via mc_comm_mode:
The default is COMM_MODE_INTEGRATE (MCCONF_COMM_MODE). You can switch modes at runtime:

Sensor modes

BLDC sensor mode is set via mc_sensor_mode:
The hall sensor angle-to-commutation mapping is stored in a lookup table. Initialize it with:
Default hall table values (BLDC mode):

Sensorless parameters

Sensorless BLDC commutation depends on the BEMF flux integrator. Key parameters:

Switching frequency

In BLDC mode the switching frequency scales with motor speed between a minimum and maximum: For DC motor mode, a fixed switching frequency is used:

Current control (BLDC mode)

RPM measurement

The mcpwm API

The mcpwm module implements the BLDC algorithm directly. Use mc_interface for normal operation; the mcpwm API is available for low-level access:

Detect mode

The detect mode applies test pulses to each phase to locate the hall sensor positions:
Run the hall sensor detection from VESC Tool instead of calling these functions directly. The tool automates the process and writes the result to the configuration.