Posted on 01 May 2019

Sensorless Field Oriented Control using an 8-Bit Microcontroller

Free Bodo's Power Magazines!




The PWM unit directly triggers the AD-converter via hardware events

Field Oriented Control (FOC) is increasingly being used in consumer and industrial motor control applications because it results in higher efficiency by running the motor at optimum torque at all times, better dynamic response to enable very precise variable speed control, and lower torque ripple to provide even and steady motor rotation at speed and also during start and stop operation. Typically a 16- or 32-bit MCU or digital signal processor (DSP) is required to handle the complex trigonometric equations.

By Arno Rabenstein, Infineon Technologies AG


Compared to current solutions on the market, in which FOC execution engages almost the whole central processing unit (CPU) load, FOC execution on the Infineon 8-bit microcontrollers XC886 and XC888 - e.g. with 15 kHz PWM frequency and 133 µs current control response time - only requires 58 percent of the CPU’s performance, providing ample headroom for application specific functionality. The execution of a sensorless FOC on a standard 8-bit microcontroller is enabled by the highly optimized PWM unit CAPCOM6E that triggers the AD-converter for measuring the DC-link current via a single shunt resistor. The calculations of the sensorless FOC algorithm in 16-bit arithmetics can only be realized by a nested utilization of the co-processors MDU and CORDIC – called vector computer – and the 8051 compatible CPU itself. The MDU is a 16-bit multiply and divide unit, the CORDIC is a 16-bit co-processor dedicated for vector rotation and angular calculations.

Sensorless Field Oriented Control implemented on 8-bit microcontrollers XC886 and XC888 is the perfect answer to energy related regulations and pricing pressure for appliance manufacturers. Unlike most competitive FOC implementations that are hard-coded, XC886 and XC888 microcontroller-based solutions offer the added benefit of software reprogrammability to offer more versatile application options.

Sensorless Field Oriented Control

A field oriented control algorithm requires information about the rotor position. This can be achieved by position sensors like an encoder or resolver. Another approach is a sensorless FOC for BLDC motors, which is more suitable for cost critical applications. It is based on the interaction between the permanent magnet of the rotor and the magnetic field of the stator.

In order to determine the actual angle of the rotor, the flux vector Ψ can be calculated by integrating dedicated voltages.

Equation 1

The voltage model is a simple model for rotating field motors which is based on dedicated differential equations. The stator current vector is requires a precise measurement of the phase currents. The integration is simplified by replacing it by a lowpass filter with a very low cut-off frequency.

A sensorless field oriented control (FOC) implemented on a standard 8-bit microcontroller offers the full benefits of sinusoidal commutation at a minimum of system cost. When using just a single shunt in the DC-link in order to acquire the phase currents, there are demanding requirements on fast and accurate AD-conversion. The phase currents must be reconstructed out of the DC-link current signal which is the response of a three phase space vector pulse width modulation.

A space vector is a sinusoid whose center is able to “float” in space. A three-phase space vector is represented by a hexagon which can be divided in six sectors. Any desired voltagespace vector will consist of a “real” voltage from one of the phases and an “imaginary” right-angle voltage created from the other two phases. The space-vector algorithm will determine the time required at a first active state, a second active state, and an inactive state to produce the desired magnitude and angle of the space vector.

Figure 1 gives an example. The first active state (b&f) is TU, the second active state (c&e) is T-W, the inactive state is T0 which appears twice, first as (000) vector (a&f), second as (111) vector (d).

Space Vector Pulse Width Modulation - Three-phase inverter output signal and DClink current I_Dclink

In order to reconstruct the phase currents out of the DC-link current, the AD-converter has to be triggered during the active states. A perfectly sinusoidal commutation will require space vectors also pointing exactly onto the corners of the hexagon. Then only one phase current could be measured at the DC-link and only one phase current could be reconstructed. This is not tolerated by the FOC algorithm itself. As a result, the corners of the hexagon have to be blanked by the space vector pulse width modulation. This blanking causes some ripple in the output signals which have to be reduced to a minimum.

Acquisition of Actual Values

Figure 2 shows the block diagram of the sensorless FOC with speed control for a permanent magnet synchronous motor (PMSM). In order to estimate the rotor position by a single shunt measurement, the PWM pattern generation and the triggering of the AD-converter for current measurement must be very fast and accurate. Any jitter in the trigger point will influence the actual rotor’s angle estimation. As a result, the total harmonic distortion of the sinusoidal current signals will increase.

Sensorless Field Oriented Control of PMSM motor

The XC886/888C(L)M microcontrollers implement the above requirement using an event based hardware trigger from the PWM unit CapCom6E towards the AD-converter. The green lightning symbols in the second PWM period in Figure 3 represent the hardware events which directly trigger the AD-converter sampling. The event based trigger eliminates any interrupt latency and enables fast and accurate current measurement. After sampling of the signal, the conversion phase does not require a valid signal at the input, because the sampled voltage is stored internally. After conversion the result is stored in one of four result registers. Two result registers are used to hold the appropriate DC-link current values IDClink. The ADC sample time is as low as 250ns. As the current is measured in time slot (b) and (e) of Figure 1, there is always enough time for conversion available.

Timing diagram of Space Vector Pulse Width Modulation and AD-Converter

The moment of triggering is adjusted by the compare and period values of the unit CAPCOM6E. There are two timers implemented which can be synchronized against each other. Timer T12 is responsible for generating the space vector pulse width modulation pattern. There are shadow registers for the compare values implemented in the device which allow a glitch-free operation. Start of timer T13 is synchronized to the period match of timer T12 and is responsible for triggering the AD-converter. The compare value and period value is adjusted suchlike that the current is measured in the middle of the active states. Two AD-converter channels are used in parallel to sample the amplified shunt resistor signal. It is configured to store the results in two different result registers. Hence the FOC calculations can directly read the result registers and do not care about triggering the measurement in time.

Block diagram of the XC886-888 8-bit microcontrollers with vector computer

Field Oriented Control Calculations

From a control point of view, the field oriented control is comparable with that of a dc motor. The basic concept is a cascade control with the important difference that the electrical variables (Vd, Id, Vq and Iq) are turning with the rotor. Thus the currents measured at the stator (Iα and Iβ) have to be transformed in the rotor coordinates (Id and Iq). The controller for the currents is realized in the rotating system as PI-controller, whereas the field exciting d-component and the torque exciting q-component is controlled separately. The speed controller adjusts - as for a dc motor - the reference value for the torque exciting current Iq. Due to the permanent magnets at the rotor, the reference value for the field exciting current Id is set to zero.

The outputs of the current controllers represent the reference voltages (Vd and Vq) in the rotor coordinates. These values are transformed into the stator coordinates (Vα and Vβ) in order to calculate the polar coordinates (norm and angle). Using space vector pulse with modulation, the norm and angle values are converted in three phase currents by modulating the high-side and low-side switches of the power inverter accordingly.

All calculations are executed step by step in one interrupt service routine which is called at timer T12 period match. The execution takes more than one PWM cycle. As a result, the control loop time is twice a PWM period, e.g. at 20kHz PWM frequency, the control loop is calculated every 100µs.

FOC Drive Application Kit: CANmotion

The FOC Drive Application Kit provides a cost-effective method of evaluating and developing sensorless brushless DC (BLDC) motor control applications using the Sensorless Field Oriented Control technique.

The kit is featuring the CANmotion evaluation board which integrates the XC886CM MCU (TQFP-48) and a 3-phase power inverter providing all the necessary functions to control a 24V BLDC motor. The complete sensorless FOC source code with a comprehensive documentation allows the users to jump start with FOC development.

A CAN to USB bridge, built by using the XC886CM again, is available in the kit for hex code download and parameter adjustments. A CAN message based user interface enables the users to set and modify all motor control parameters for speed and current control. The unique CAN based monitoring offers real-time control of the motor control application. The 24V BLDC motor and a plug-in power supply make the kit ready-to-use.

The pre-compiled demos provide a platform for easy evaluation and performance measurement of the FOC algorithm. The complete development environment including a free tool chain allows the users to advance to the next stage of application development and customization using the same application kit.

For further details on Infineon’s Sensorless FOC algorithm and the FOC Drive Application Kit, please refer to following webpage:


Key Features of XC886 and XC888 which enable Sensorless Field Oriented Control

• High performance 16-bit vector computer (CORDIC + MDU), Vector rotation and transformations like Park transform Normalizing and scaling, Interrupt based operation with minimum CPU load
• PWM unit for advanced motor control (CapCom6E), 16-bit resolution for high precision space vector, PWM generation Dead time control for minimum hardware effort (direct control of MOSFET/IGBT), CTRAP provides hardware overload protection
• A fast 10-bit A/D Converter (sample time of 0.25 µs), Hardware synchronization to PWM unit reduce CPU load, Use of two out of four result registers to maximize sampling performance, Enables single shunt current measurement, Fast ADC reduces torque ripple due to minimized blind angle in sensorless FOC


Internet Links

FOC Drive Application Kit:
XC800 8-bit microcontroller:
Datasheet and usermanual XC886:
Datasheet and usermanual XC888:



VN:F [1.9.17_1161]
Rating: 0.0/6 (0 votes cast)

This post was written by:

- who has written 155 posts on PowerGuru - Power Electronics Information Portal.

Contact the author

Leave a Response

You must be logged in to post a comment.