Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vedderb/bldc/llms.txt

Use this file to discover all available pages before exploring further.

All parameters belong to the mc_configuration struct defined in datatypes.h. Default values are set in motor/mcconf_default.h and can be overridden per hardware target.
Hardware-specific builds may override any of these defaults. The values shown here are the firmware-wide defaults that apply when no hardware override is present.

Current limits

ParameterDefaultDescription
l_current_max60.0 AMaximum motor phase current (upper limit).
l_current_min-60.0 AMinimum motor phase current (lower limit, negative for braking).
l_in_current_max99.0 AMaximum input (battery) current draw.
l_in_current_min-60.0 AMinimum input current (negative = regen current back into battery).
l_abs_current_max130.0 AHard absolute current limit — triggers FAULT_CODE_ABS_OVER_CURRENT immediately.
l_current_max_scale1.0Scale factor applied to l_current_max at runtime.
l_current_min_scale1.0Scale factor applied to l_current_min at runtime.
l_in_current_map_start1.0Input current to Q-axis current limit map start threshold.
l_in_current_map_filter0.005Low-pass filter constant for the mapped input current limit.
l_watt_max1,500,000 WMaximum output power. Set to a practical value for the drive system.
l_watt_min-1,500,000 WMinimum output power (maximum braking power).
Setting l_abs_current_max above the hardware current rating can destroy MOSFETs. Always set this below the gate driver and FET peak current specification.

Voltage limits

ParameterDefaultDescription
l_min_vin8.0 VMinimum input voltage — triggers FAULT_CODE_UNDER_VOLTAGE below this.
l_max_vin57.0 VMaximum input voltage — triggers FAULT_CODE_OVER_VOLTAGE above this.
l_battery_cut_start10.0 VInput voltage at which positive current output begins to ramp down.
l_battery_cut_end8.0 VInput voltage at which positive current output is cut to zero.
l_battery_regen_cut_start1000.0 VInput voltage at which regen current begins to ramp down (set very high to effectively disable).
l_battery_regen_cut_end1100.0 VInput voltage at which regen current is cut to zero.
Set l_battery_cut_start and l_battery_cut_end to match your battery chemistry’s minimum cell voltage multiplied by cell count, to protect cells from deep discharge.

Temperature limits

ParameterDefaultDescription
l_temp_fet_start85.0 °CMOSFET temperature at which current begins to be reduced.
l_temp_fet_end100.0 °CMOSFET temperature at which the motor is shut off (FAULT_CODE_OVER_TEMP_FET).
l_temp_motor_start85.0 °CMotor temperature at which current begins to be reduced.
l_temp_motor_end100.0 °CMotor temperature at which the motor is shut off (FAULT_CODE_OVER_TEMP_MOTOR).
l_temp_accel_dec0.15Fraction by which temperature limits are reduced during acceleration to prevent thermal runaway.
m_motor_temp_sens_typeTEMP_SENSOR_NTC_10K_25CType of motor temperature sensor.
m_ntc_motor_beta3380.0Beta coefficient for the NTC motor thermistor.
m_ptc_motor_coeff0.61 %/KResistance change coefficient for PTC sensors.

RPM limits

ParameterDefaultDescription
l_max_erpm100,000 ERPMMaximum electrical RPM (upper).
l_min_erpm-100,000 ERPMMinimum electrical RPM (lower).
l_erpm_start0.8Fraction of l_max_erpm at which RPM-based current limiting begins.
l_max_erpm_fbrake300 ERPMMaximum ERPM at which full braking is applied.
l_max_erpm_fbrake_cc1500 ERPMMaximum ERPM at which full braking is applied under current control.
l_min_duty0.005Minimum duty cycle.
l_max_duty0.95Maximum duty cycle.
l_duty_start1.0Duty cycle fraction at which current limiting begins (1.0 = disabled).

Motor parameters

These parameters describe the physical motor and are normally determined by running motor detection in VESC Tool.
ParameterDefaultDescription
si_motor_poles14Number of motor poles (pole count, not pole pairs).
si_gear_ratio3.0Drive gear ratio (motor revolutions per wheel revolution).
si_wheel_diameter0.083 mWheel diameter in meters, used for speed and odometer calculations.
si_battery_typeBATTERY_TYPE_LIION_3_0__4_2Battery chemistry selection for display and BMS integration.
si_battery_cells3Number of cells in series.
si_battery_ah6.0 AhBattery capacity in amp-hours.
si_motor_nl_current1.0 AMotor no-load current, used for efficiency calculations.
foc_motor_l7 µHPhase inductance (L). Set by motor detection.
foc_motor_r15 mΩPhase resistance (R). Set by motor detection.
foc_motor_flux_linkage0.00245 WbMotor flux linkage (λ). Set by motor detection.
foc_motor_ld_lq_diff0.0 HDifference between d-axis and q-axis inductance (saliency).
The default motor parameters are placeholders. Always run motor detection for accurate FOC operation.

FOC parameters

ParameterDefaultDescription
foc_current_kp0.03Proportional gain of the d/q axis current PI controller.
foc_current_ki50.0Integral gain of the d/q axis current PI controller.
foc_f_zv25,000 HzZero-vector (switching) frequency for FOC.
foc_dt_us0.12 µsDead-time compensation in microseconds.
foc_cc_decouplingFOC_CC_DECOUPLING_DISABLEDCross-coupling compensation mode for the current controller.
foc_sat_comp_modeSAT_COMP_DISABLEDStator saturation compensation mode.
foc_sat_comp0.0Stator saturation compensation factor.
foc_current_filter_const0.1Low-pass filter constant for displayed/logged currents.
foc_overmod_factor1.0Overmodulation factor (>1.0 enables overmodulation).
ParameterDefaultDescription
foc_observer_typeFOC_OBSERVER_MXLEMMING_LAMBDA_COMPPosition observer algorithm.
foc_observer_gain9×10⁷Observer feedback gain. A starting point is approximately 600 / L.
foc_observer_gain_slow0.05Fraction of foc_observer_gain used at minimum duty cycle.
foc_observer_offset-1.0Observer angle offset in timer update cycles.
foc_pll_kp2000.0PLL proportional gain used by the speed tracker.
foc_pll_ki30,000.0PLL integral gain used by the speed tracker.
ParameterDefaultDescription
foc_sensor_modeFOC_SENSOR_MODE_SENSORLESSSensor mode: sensorless, encoder, hall, HFI, or variants.
foc_sl_erpm3500 ERPMERPM above which only the observer is used (hybrid mode transition).
foc_sl_erpm_start2500 ERPMERPM below which only sensored commutation is used (hybrid mode).
foc_openloop_rpm1500 ERPMTarget RPM during open-loop startup or index-finding.
foc_openloop_rpm_low0.0Fraction of foc_openloop_rpm at minimum current.
foc_sl_openloop_hyst0.1 sTime below minimum RPM before open-loop is activated.
foc_sl_openloop_time0.05 sTime to remain in open-loop after RPM ramp.
foc_sl_openloop_time_lock0.0 sTime to lock rotor at start of open-loop sequence.
foc_sl_openloop_time_ramp0.1 sTime to ramp up to open-loop speed.
ParameterDefaultDescription
foc_fw_current_max0.0 AMaximum negative d-axis current for field weakening (0 = disabled).
foc_fw_duty_start0.8Duty cycle fraction at which field weakening begins.
foc_fw_ramp_time0.0 sRamp time for field weakening current.
foc_fw_q_current_factor0.05Fraction of field weakening current fed to the q-axis when target current is 0.
Field weakening increases motor and FET stress. Start with foc_fw_current_max set to a small fraction of l_current_max and monitor temperatures carefully.
ParameterDefaultDescription
foc_hfi_voltage_start20 VInjection voltage during ambiguity resolution at start.
foc_hfi_voltage_run4 VInjection voltage during normal HFI tracking.
foc_hfi_voltage_max6 VInjection voltage at maximum current.
foc_hfi_gain0.3Correction gain for HFI V2 mode.
foc_hfi_max_err0.30 radMaximum HFI angle error before truncation (noise rejection).
foc_hfi_hyst0.0Sense vector offset hysteresis.
foc_sl_erpm_hfi3000 ERPMERPM above which the observer takes over from HFI.
foc_hfi_reset_erpm500 ERPMERPM below which the HFI state is reset.
foc_hfi_samplesHFI_SAMPLES_16Number of HFI injection samples per electrical revolution.
foc_hfi_start_samples5Number of samples taken at start for ambiguity resolution.
foc_hfi_obs_ovr_sec0.001 sDuration to continue using the observer when entering HFI speed range.
foc_hfi_amb_modeFOC_AMB_MODE_SIX_VECTORHFI ambiguity resolution mode.
foc_hfi_amb_current60.0 ACurrent used during HFI ambiguity resolution.
foc_hfi_amb_tres15Ambiguity resolution threshold.
ParameterDefaultDescription
foc_phase_filter_enabletrueEnable hardware phase voltage filters when available.
foc_phase_filter_disable_faulttrueDisable FAULT_CODE_PHASE_FILTER (fault suppressed by default).
foc_phase_filter_max_erpm4000 ERPMUse phase voltage filter only below this ERPM.
ParameterDefaultDescription
foc_temp_compfalseEnable motor resistance temperature compensation.
foc_temp_comp_base_temp25.0 °CReference temperature for resistance compensation.
foc_mtpa_modeMTPA_MODE_OFFMaximum torque per amp algorithm mode.

Speed PID parameters

ParameterDefaultDescription
sp_pid_loop_ratePID_RATE_1000_HZPID loop execution rate (shared by speed and position PID).
s_pid_kp0.004Speed PID proportional gain.
s_pid_ki0.004Speed PID integral gain.
s_pid_kd0.0001Speed PID derivative gain.
s_pid_kd_filter0.2Low-pass filter constant for the speed PID derivative term.
s_pid_min_erpm900 ERPMMinimum ERPM for the speed PID (below this, output is zero).
s_pid_allow_brakingtrueAllow the speed PID to apply braking current.
s_pid_ramp_erpms_s25,000 ERPM/sSpeed setpoint ramp rate.
s_pid_speed_sourceS_PID_SPEED_SRC_PLLSpeed source used by the PID controller.

Position PID parameters

ParameterDefaultDescription
p_pid_kp0.025Position PID proportional gain.
p_pid_ki0.0Position PID integral gain.
p_pid_kd0.0Position PID derivative gain (error-based).
p_pid_kd_proc0.00035Position PID derivative gain (process-variable-based).
p_pid_kd_filter0.2Low-pass filter constant for the position PID derivative term.
p_pid_ang_div1.0Divide angle error by this value before the PID.
p_pid_gain_dec_angle0.0Reduce PID gains when error is below this angle.
p_pid_offset0.0 °Angle offset added to the position setpoint.

Miscellaneous parameters

ParameterDefaultDescription
m_fault_stop_time_ms500 msDuration for which motor commands are ignored after a fault clears.
m_duty_ramp_step0.02Maximum duty cycle ramp step per millisecond in duty control mode.
m_current_backoff_gain0.5Gain of the current limiting backoff algorithm.
m_encoder_counts8192Number of encoder counts per revolution.
m_sensor_port_modeSENSOR_PORT_MODE_HALLMode of the combined hall/encoder sensor port.
m_invert_directionfalseInvert the motor rotation direction.
m_drv8301_oc_modeDRV8301_OC_LIMITGate driver over-current protection mode.
m_drv8301_oc_adj16Gate driver over-current protection threshold (0–31).
m_bldc_f_sw_min3,000 HzMinimum switching frequency in BLDC mode.
m_bldc_f_sw_max35,000 HzMaximum switching frequency in BLDC mode.
m_dc_f_sw25,000 HzFixed switching frequency in DC motor mode.
m_out_aux_modeOUT_AUX_MODE_OFFAuxiliary output pin behavior.
m_hall_extra_samples3Extra ADC samples averaged when reading hall sensors.
m_batt_filter_const45Battery voltage display filter time constant.