National High-Tech Enterprise IEC 61000 EMC · IEC 60730 Class B · RoHS ISO 9001 certified Jinhua, Zhejiang · around 200 staff · 25 in R&D
TECHNICAL NOTE 03 / 22

FOC Motor Control - Bring-up Guide

Sailike R&DFOC technical notes 中文原文

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.

a. Motor parameter measurement

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 Rline between any two motor terminals with a two-wire method. For a star-connected motor the phase resistance is half the line resistance:

Rs=Rline2

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:

Ld≈Lq≈Lmin2

If the saliency ratio is significant (an interior-magnet motor), the variation of the line inductance with rotor position separates the dq-axis inductances:

Ld=Lmin2,Lq=Lmax2

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 LAB , LBC and LCA between each pair of phases and solves for Ld and Lq , 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:

KL=LAB+LBC+LCA3(1)ML=(LBC−KL)2+(LAB−LCA)23(2)

where KL is the average of the three line inductances and ML the amplitude of their variation with rotor position. The dq-axis inductances are then:

Ld=KL−ML2,Lq=KL+ML2

Here Ld<Lq corresponds to an interior-magnet motor with a saliency ratio of ρ=Lq/Ld>1 ; a measured Ld≈Lq 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 Epp and the peak-to-peak frequency fpp (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 3 times the phase EMF amplitude, so the phase EMF amplitude Em follows from the line back-EMF peak-to-peak value Epp as:

Em=Epp23

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 fpp is 2 times the electrical frequency fe :

fe=fpp2

The permanent magnet flux linkage ψf is the ratio of the phase EMF amplitude to the electrical angular frequency:

ψf=Emωe=Em2πfe

Substituting the two expressions above gives the flux linkage directly from the oscilloscope readings:

ψf=Epp23·2π·(fpp/2)=Epp23πfpp

b. Verifying voltage sampling

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.

c. Verifying current sampling

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:

  • For two- or three-low-side-shunt sampling (23 Shunt), the sampled value is positive when the current flows from ground towards the leg, that is, in the direction through the low-side shunt resistor.
  • For single-shunt sampling (1 Shunt), the sampled value is positive when the DC bus current is positive.

Value criterion: convert the sampled value into an actual current and compare it with the current shown on the supply; the two should agree.

Imeasured=ADC\_value−offsetKshunt·Gamp

where Kshunt is the current-to-voltage coefficient of the shunt and Gamp the amplifier gain.

d. Verifying hardware protection

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.

e. Verifying PWM polarity and dead time

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:

  • Waveform polarity: whether the active level of the high and low legs matches the circuit design (active high or active low, depending on the gate driver).
  • Dead time: whether the dead time between commutations matches the firmware setting (for example 1 µs), so that the high and low legs never conduct together.

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:

  • The waveform polarity matches the circuit design (active high or active low).
  • The measured dead time matches the firmware setting.
  • The three duty cycles map correctly onto the defined channels.

This is the last hardware check before power-up and effectively prevents shoot-through damage to the power devices.

f. Open-loop spinning and waveform checks

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 Iabc with JScope or a serial terminal.

Criteria:

  • The phase current waveforms from the oscilloscope and from JScope or the serial link agree in value and direction.
  • In the αβ frame the phase voltage and the phase current should be in phase (power factor near 1). Dead time may keep the current from being a pure sine, but its direction should follow the voltage.

This step verifies the consistency of the current sampling chain, the Clarke transform and the angle reference.

g. Observer verification

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.

θobs−θopenloop=const(稳态)

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.

h. Switching from open loop to closed loop

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:

  • Operation is smooth across the whole speed range, without stalling or jumps.
  • The transfer produces no noticeable current surge or speed fluctuation.

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.

i. Closed-loop start

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.

j. The trade-off over dead-time compensation

Whether dead-time compensation improves performance depends on the sampling topology and the operating mode; it is not always beneficial.

Sampling topologySensorless modeSensored 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 operationCan 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 gainsNot 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.

k. Appendix: practical engineering experience

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:

  1. Calibrate the saturated inductance: measure the inductance at different load currents and build a current-inductance curve for run-time lookup.
  2. Simplified fix: multiply the q-axis inductance used by the observer by a correction factor of 0.5–0.7. The heavier the overload, the deeper the saturation, the smaller the actual inductance and the smaller the factor should be.
Lq_used=k·Lq_measured,k∈[0.5,0.7]

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.

l. Conclusion

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.