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 viamc_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.
PWM_MODE_SYNCHRONOUS (MCCONF_PWM_MODE).
Commutation modes
The commutation zero-crossing detection strategy is set viamc_comm_mode:
The default is
COMM_MODE_INTEGRATE (MCCONF_COMM_MODE). You can switch modes at runtime:
Sensor modes
BLDC sensor mode is set viamc_sensor_mode:
The hall sensor angle-to-commutation mapping is stored in a lookup table. Initialize it with:
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
Themcpwm module implements the BLDC algorithm directly. Use mc_interface for normal operation; the mcpwm API is available for low-level access:
