2026-07-29
Taking a complete FOC motor drive system from assembled hardware to stable operation involves motor parameter identification, verification of the sampling chain, observer commissioning and the switch to closed loop. An omission at any one of these stages is amplified later into a fault that is hard to trace. Following the real commissioning order — motor parameter measurement, verification of voltage and current sampling, confirmation of hardware protection, open-loop spinning, observer verification and closed-loop operation — this article sets out a reproducible bring-up procedure with the key criteria and the usual remedies for each stage.
The current loop, the observer and the field-weakening algorithm of an FOC controller all depend on accurate motor parameters, so parameter measurement is the first step of commissioning.
Phase resistance: measure the line resistance between any two motor terminals with a two-wire method. For a star-connected motor the phase resistance is half the line resistance:
Inductance: measure the line inductance between any two phases with a two-wire method. Turn the shaft slowly and record the maximum and the minimum line inductance. For a surface-mounted motor with a low saliency ratio the dq inductances are approximately:
If the saliency ratio is significant (an interior-magnet motor), the variation of the line inductance with rotor position separates the dq-axis inductances:
Inductance measurement for motors with sinusoidal back EMF (Dalton test method): for a motor with sinusoidal back EMF, a three-line inductance measurement combined with the Dalton test method yields the dq inductances. It measures the line inductances , and between each pair of phases and solves for and , which is more accurate than the simple two-wire maximum/minimum method.
Because the line inductance of a salient-pole motor varies with a period of half an electrical cycle, the three measured line inductances give the average inductance and the amplitude of the variation:
where is the average of the three line inductances and the amplitude of their variation with rotor position. The dq-axis inductances are then:
Here corresponds to an interior-magnet motor with a saliency ratio of ; a measured indicates a surface-mounted motor.
Flux linkage: rotate the shaft at constant speed by hand or with another motor and observe the line back-EMF waveform on an oscilloscope. Record the peak-to-peak value and the peak-to-peak frequency (the reciprocal of the time between two adjacent peaks on the screen; peak to peak corresponds to half an electrical cycle).
For a star-connected motor the line back-EMF amplitude is times the phase EMF amplitude, so the phase EMF amplitude follows from the line back-EMF peak-to-peak value as:
Because the interval from a positive peak to the adjacent negative peak (peak to peak) is half an electrical cycle, the peak-to-peak frequency is 2 times the electrical frequency :
The permanent magnet flux linkage is the ratio of the phase EMF amplitude to the electrical angular frequency:
Substituting the two expressions above gives the flux linkage directly from the oscilloscope readings:
Voltage sampling underpins DC bus voltage observation, field-weakening control and power calculation. A wrong voltage sampling gain makes both the voltage loop and the flux linkage observation inaccurate.
Method: power the controller from an adjustable DC supply set to a low current limit (so that an accidental short cannot damage the devices). Read the raw ADC value and the converted voltage of the DC bus channel in the debugger and compare them with the voltage shown on the supply.
Criterion: the converted voltage agrees with the actual supply output, within the accuracy of the sampling resistors and the ADC reference. If it does not, check the divider resistor values, the ADC reference voltage and the conversion factor.
Current sampling is the core input of the current loop; any error in direction, range or gain makes the current loop diverge.
Method: set an adjustable DC supply to below 3V (to stay under the MCU pin rating and avoid destroying the chip) and to a moderate current. Connect the supply directly across the shunt alloy resistor and watch the ADC value of the current channel in the debugger.
Direction and polarity criteria:
Value criterion: convert the sampled value into an actual current and compare it with the current shown on the supply; the two should agree.
where is the current-to-voltage coefficient of the shunt and the amplifier gain.
The controller must have reliable overcurrent protection, so that an accidental short or a runaway during first commissioning cannot destroy the power devices.
Method: short the input of the hardware protection comparator to VCC with tweezers to emulate an overcurrent signal. The controller should enter the brake interrupt immediately (emergency stop and PWM shutdown).
Criterion: the debugger shows entry into the brake interrupt, the PWM outputs are disabled and the motor circuit reaches a safe state. This confirms that the whole protection chain (comparator, MCU interrupt, PWM shutdown) is functional.
Before energising the motor in open loop, the polarity and the dead time of the PWM outputs must be verified, so that a shoot-through of the high and low side cannot destroy the power devices.
Method: on an oscilloscope, capture one high/low pair of the 6 timer PWM channels (for example the A-phase high and low legs) and observe:
Channel consistency: apply a different duty cycle to each phase and check that the PWM duty of each phase maps one-to-one onto the defined channel, ruling out crossed channels and high/low legs swapped by wiring or configuration.
Criteria:
This is the last hardware check before power-up and effectively prevents shoot-through damage to the power devices.
Once the sampling and protection chains are confirmed, the first powered spinning test can be run.
Setup: fix the dq-axis voltage at 5%–10% of rated and apply a fixed open-loop angle increment to spin the motor slowly.
Phase current check: capture the phase current with a current probe (note that current flowing into the motor is positive). At the same time observe the three-phase currents of with JScope or a serial terminal.
Criteria:
This step verifies the consistency of the current sampling chain, the Clarke transform and the angle reference.
The observer is the core of sensorless FOC, and whether it works correctly decides whether the later switch to closed loop succeeds.
Method: enable IF (current-frequency) closed-loop mode, raise the forced open-loop speed step by step, and watch whether the observer angle changes in step with the open-loop angle reference.
Criterion: the observer angle increases in step with the open-loop angle, with a constant angle difference between them (the drag angle, set by the load and the current phase). A stable difference with the observer angle lagging the open-loop angle indicates normal observer convergence.
If the observer angle jumps, diverges or runs opposite to the open-loop angle, check the observer parameters (inductance, flux linkage), the back-EMF polarity and the current sampling direction.
With the observer working correctly, enable the conditions for switching from open loop to closed loop, so that the system can transfer smoothly into closed-loop operation once they are met.
Method: with the transfer conditions enabled, check that the motor runs correctly over 20%–100% of rated speed.
Criteria:
Common problem: intermittent stalling at high speed indicates an insufficient current sampling window, where too high a PWM duty cycle leaves too little effective sampling time. Reduce the maximum duty cycle range to give current sampling a sufficient window.
After closed-loop operation has been verified, the firmware can be changed to the id closed-loop start mode.
Method: configure the closed-loop start parameters (a given id current with iq = 0 for the drag); under normal conditions the motor starts directly in closed loop.
Criterion: the motor goes from standstill straight into closed-loop operation without the open-loop drag, starting smoothly and without loss of synchronism.
Whether dead-time compensation improves performance depends on the sampling topology and the operating mode; it is not always beneficial.
| Sampling topology | Sensorless mode | Sensored mode |
|---|---|---|
| Two/three-shunt (23 Shunt) | Not recommended: at low speed the compensation tends to overshoot and, all things considered, biases the observer input more and degrades operation | Can be enabled, but avoid overcompensation |
| Single shunt (1 Shunt) | Not recommended: at low duty cycle single-shunt sampling carries a sector-dependent offset, so compensation usually costs more than it gains | Not recommended |
Underlying reason: dead-time compensation is meant to cancel the voltage error caused by the turn-on and turn-off delay of the switches, but the correction depends on the actual current direction. At low speed the current is small and the correction overshoots easily; besides, single-shunt current reconstruction at low duty cycle already carries a sector-dependent offset, so adding dead-time compensation introduces a larger error still.
Effect of inductance saturation under heavy load: in sensorless mode at heavy load the angle output depends strongly on the stator inductance. Heavy load saturates the inductance and lowers its actual value; if the controller keeps the no-load calibrated value, the observer angle lags the true position.
There are two remedies:
Effect of stator resistance drift with temperature: the stator resistance rises by 30%–40% from 25°C to 100°C. The resistance error directly affects the observer at low speed and can make closed-loop starting fail in the hot state.
Remedy: enable the resistance measurement before start function, which measures the stator resistance online at power-up or before starting instead of using a fixed parameter. The observer then uses the actual present resistance whether the motor is cold or hot, which keeps starting reliable.
Bring-up of FOC is essentially the step-by-step verification of a chain: first the motor parameters, then the voltage and current sampling and the hardware protection, then the current waveforms and the observer convergence under open-loop spinning, and finally the progressive enabling of the closed-loop transfer and the optimisation of the start strategy. Every step has clear criteria and known remedies, and following the sequence markedly shortens commissioning by preventing repeated investigation on a faulty link. Practical work also needs the experience items above — the trade-off over dead-time compensation, the correction for inductance saturation and the compensation of resistance drift — to run stably under different loads and temperatures.
Compiled with AI assistance and reviewed by a human.