 Welcome and thank you very much for joining our tutorial plug and play design for very precise field-oriented three-phase motor control. In this presentation, you'll learn about the basics of field-oriented control used for driving three-phase brushless DC motors, the features and performance of ST Spin 32F0 driver in ST Microelectronics' latest system in package technology, and how to build, quickly and easily, your first prototype of your drone, power tool, or smart manufacturing equipment with the ST Spin 32F0 product evaluation board and motor control workbench tool. Let's start with a quick overview of a three-phase brushless DC motor design and its working principles. The stator consists of three coils, 120 degrees apart. The windings or coils are connected together in a star configuration. The sum of the current is zero. The rotation is obtained thanks to the attractive forces between two magnetic fields. One field is located on the rotor, which is the moving part. The second magnetic field is located on the stator, which is the body of the motor. A permanent magnet generates the magnetic field of the rotor while the second magnetic field is generated through the electromagnet. The rotor magnetic field is always present and is generated by a permanent magnet. When a current flows from one motor phase to another one, the magnetic fields are combined and so generate the stator field. By applying the right voltage at the right time to the motor phases, we obtain currents which generate a rotating magnetic field. The magnetic field is directly proportional to the current through the coil or winding. The output torque of an electrical motor depends on the intensity of the rotor and stator magnetic fields and on their phase relation. The angle between those two magnetic vectors is called a load angle, theta. In order to keep the motor in motion, it is necessary to change the direction of the stator magnetic field. In the ideal case, the control circuit modulates the phase current in each coil in such a way that the load angle is close to 90 degrees. This is because the maximum torque and also the maximum efficiency is achieved when the load angle is 90 degrees. On the other side, the load angle, which means the phase relation between the stator vector and rotor vector, must always be greater than zero degrees in order to keep the motor in motion. A negative angle means a reverse rotation. Now, we can summarize that the output torque depends on the phase current and the load angle. The advantages of BLDC motors over brushed DC motors are higher reliability, lower EMI, better longevity, increased efficiency and better power density. There are several drive control schemes for driving brushless DC motors. The state-of-the-art in BLDC motor control is the field-oriented control. The field-oriented control algorithm allows you to obtain the maximum performance from a BLDC motor. The objective of the algorithm is to control the vector components of the stator magnetic field. For example, the phase currents in order to obtain the target intensity and phase relation with the rotor magnetic field. The field-oriented control algorithm requires some data. We need three phase currents. The third one can be obtained as the negative of the sum of the other two. The currents are usually sensed using shunt resistors connected to the low-side MOSFET of each half-bridge of the power stage. We need to know the position of the rotor magnetic field. The easiest way to obtain this information is to measure it using Hall Effect sensors, resolvers or encoders. However, it is also possible to use a sensorless algorithm that reconstructs the position starting from the voltages and the currents of the motor phases, flux estimators. The next parameter is the target quadrature current, which is proportional to the torque through the motor torque constant, KT. This value is usually imposed by a second control loop according to the specific application. The most common control type is the speed control, where the torque is adjusted in order to obtain the desired rotation speed. The last parameter is the direct current, but its value is usually imposed to zero in order to obtain the maximum efficiency. Negative values of direct current can be used to reach very high speed thanks to the field weakening. However, this technique will not be explored during this presentation. Designing an effective field-oriented control scheme can be challenging. The accuracy of the current values is critical, and it is important to have them on time. The performance of the analog-to-digital converter and its synchronization with the rest of the algorithm, for example the driving of the power stage, is a key part of the project. The same consideration is valid for the rotor position. Accuracy and reliability of this value is a must, regardless of the method selected for measuring it. One of the biggest challenges, even for modern microcontrollers, is to perform all the calculations required by the algorithm as fast as possible. The microcontroller has to handle multiple vector transformations, digital filtering, PI controllers calculations, and so on. In fact, the calculated time has a direct impact on the maximum speed you can achieve in your application. Last but not least, your final application is not just a motor, but it should interface with other ICs in the system, or even directly with the user. This slide provides you an overview of ST Microelectronics' low-voltage motor drivers called the ST Spin Family. The ST Motor Drivers portfolio includes monolithic drivers, embedding all the functions needed to drive motors efficiently and with the highest accuracy while ensuring maximum reliability. ST Spin Family includes low-voltage monolithic drivers, which are ideal for battery-powered applications. Controllers for stepper motors with all of the features required to drive external discrete power MOSFETs and so simplify the design. System and package solutions integrating in a small QFN package, a high-performing controller, and discrete MOSFETs with voltage rating up to 85 volts. This broad portfolio of motor drivers addresses perfectly a wide range of applications that spans across all types of power rating and system partitioning. These ICs can also be found in a variety of applications, ranging from office machines to medical and industrial equipment. ST Microelectronics has developed the ST Spin 32F0 IC, a system in package which combines our high-performance 32-bit microcontroller and low-voltage gate drivers for driving external low-voltage and low RDS on MOSFETs. To a certain extent, we can say that with the ST Spin 32F0, we are driving motor control for the fourth industrial generation. The demand for more intelligent, highly specialized ICs is growing rapidly, fueled by the needs of smart industry, smart cities, and smart homes. Leveraging ST Microelectronics core technologies, the ST Spin 32F0 motor driver family accelerates the trend by bringing the high computational power of a 32-bit microcontroller together with a three-phase gate driver in the same package IC. The QFN package size is 7x7 mm. This enables designers to design very accurate field-oriented control of electric motors, six-step sensorless or other advanced driving algorithm, including the speed control loop. Let's have a look in more detail at all the features of ST Spin 32F0. First, let's check out the high-performance, low-voltage, three-phase gate drivers, 600 mA current capability, which can drive a wide range of MOSFETs or IGBTs. The gate drivers feature cross-conduction, under-voltage lockout, thermal shutdown, and programmable overcurrent protection. The integrated bootstrap diodes save overall bill of material, but also save space on the PCB. The space parameter is a key parameter in portable and high-performance products, like power tools. The next key block is the embedded 32-bit STM32F0, which is the microcontroller with ARM Cortex M0 core. It has good computational power with 48 MHz, 4-kilobyte SRAM, and 32-kilobyte flash memory and provides enough power for the field-oriented control algorithm. It has 16 general-purpose IOs, five general-purpose timers, and a 12-bit analog-to-digital converter with up to nine channels that can support one shunt or three shunt FOC topology. The ST Spin 32F0 provides several communication protocols, I2C, UART, and SPI. Three frequency generators with open-drain output provide the decoded result for three Hall sensors inputs. There are four rail-to-rail operation amplifiers for signal conditioning and a comparator for overcurrent protection with a programmable threshold. These features allow you the flexibility to either design cost-effective sensorless systems or accurate control systems with Hall effect sensor feedback. The 3.3-volt DC-DC buck converter provides voltage rails for microcontrollers with high efficiency and other external devices. The buck converter is one of the key ST Spin 32 advantages for applications with a high conversion ratio as for battery-based applications, thermal management being another challenge for high-performance applications. The 12-volt linear regulator is an embedded thermal protection and provides the supply for gate drivers. Design support tools are one of the most critical elements of successful development for designers who are designing highly complex and state-of-the-art systems. The STSW Spin 3201 firmware is a customization of the STM32 PMSM FOC library, a part of the STM32 motor control software development kit, MCSDK. It is dedicated to the ST EVAL Spin 3201 evaluation board. In this customization, the target speed is imposed through a potentiometer and the motor is started and or stopped using the user 1 button of the board. It is also possible to use the STM32 motor control workbench GUI to monitor and change in real time some of the variables of the algorithm and to initialize a new project according to the application needs. This GUI is not included in the STSW Spin 3201 package but it is distributed with the STM32 MCSDK. The PMSM field-oriented control firmware library and STM32 motor control workbench enables the user to evaluate the STM32 performance in applications driving three-phase permanent magnet motors. The STM32 motor control software development kit is part of ST's motor control ecosystem which offers a wide range of hardware and software solutions for motor control applications. The STM32 motor control workbench is PC software which reduces the design effort and time in the PMSM FOC firmware library configuration. The user, through a graphical user interface, generates all parameter header files which configure the library according to the application need. It can monitor and control the BLDC motor in real time and it can also change some variables of the algorithm. The current software development kit supports applications with speed and position sensors like quadrature encoders and Hall sensors. It also supports sensorless operation with a state observer. Current can be read using either a one-shunt resistor or three-shunt resistor. Reading isolated current sensors is available as well. Also the speed and torque control is available. Now we'll explain how to drive the ST Spin 32F0 with FOC algorithms using the STM32 motor control workbench software. The first step is to set up the hardware. We will connect the ST EVAL Spin 3201 evaluation board to the PC using the USB cable. Next we will make the connection between the evaluation board and a power supply, not exceeding 45 volts. And of course, we will connect the motor. Let's move to the next step. Configuring the library using the STM32 motor control workbench. On the main window, there is a radio button, New Project. There is also a list of recent projects and a list of example projects, including one example for ST EVAL Spin 3201 with Shinano motor. We'll focus on starting a project from scratch now. Let's click on the New Project and a parameter window will appear. Choose the inverter board type and select the ST EVAL ST Spin 3201 from the drop-down menu. In this way, the application automatically loads all the hardware related parameters for the FOC library. From the motor drop-down menu, you can select one of the pre-configured motors or you can select a generic starting model. We picked the generic low voltage motor. Now we can click on the OK button. After clicking on the OK button, it takes you to the configuration window where you can easily manage parameters for FOC. On your left side, there are four icons. Each of these icons represents a sub-menu for parametric settings. These options are motor parameters, power stage, drive management, and control stage. If you don't find your motor in the preset list, you can create your own motor with its characteristics. Click on motor symbol and set the following parameters according to your application. Those parameters will be saved for current project and future use. Number of pole pairs, max application speed, nominal current, nominal DC voltage, phase resistance, phase inductance, and back EMF constant. If you click on save parameters, this new motor will appear in the preset list of available motors. If you switch over to the sensors tab, you can find the configuration parameters for hall sensors and quadrature encoder. In the configuration window, you can manually insert the power stage parameters by choosing the area you want to set. Rated bus voltage information, setting voltage range for your application, it means min, max, and nominal value. Bus voltage sensing, setting the parameters for the sensing of the V bus. Power switches, setting the polarity of the high side and low side driving signal, minimum dead time, and maximum switching frequency. Overcurrent protection, comparator threshold, overcurrent network gain, expected overcurrent threshold, and overcurrent feedback signal polarity. Current sensing, current reading topology, either three shunt resistor, one shunt resistor, two insulated current sensors, shunt resistor value, amplifying network gain, T rise, and T noise. Since we already selected the STE valve spin 3201 device, the configuration parameters for the power stage are already set. All parameters in this section are related to the power stage characteristics. The third option is the Drive Management menu. Clicking on Firmware Drive Management, a drop-down menu appears where you can select and set the following parameters. Drive settings. This means PWM frequency, control mode, execution rate, dead time, and PID control loop parameters if you want to change them manually. Sensing and firmware protection. Set protection, for example, under voltage lockout. Startup parameters. Set parameters for initial ramp of current and speed. Additional features. For example, to set flux weakening, MTPA, feed forward, or sensorless speed feedback. On the icon Speed Sensing, you can select the sensing algorithm, Sensorless, Hall Sensors, Encoders. In the driving section, you need to make two changes, the execution rate in the torque and flux regulator section and the PWM frequency to get the ratio between PWM frequency and execution rate below 14 kHz. In the next window, you can set the parameters for the control stage section. The first option is the MCU selection. ST Spin 32F0 is the right choice. The other options are clock source, CPU frequency, and nominal MCU supply voltage. You can also set user interface like UART and enable start-stop buttons. Since we already selected the ST EVAL Spin 3201 device, the configuration parameters for the control stage are already set. In this section, you can also map the ADC inputs for current sensing and protection. The Hall Effect Sensors and Encoder input are mapped here as well. Never change the pin map as it reflects the internal mapping of the ST Spin 32F0. If you selected Hall Sensors in the Drive Management section, you need to check the pin mapping and timer selection. Please make sure that your selection is Timer 2 and pin A0 for Channel 1, pin A1 for Channel 2, and pin A2 for Channel 3 as shown. Similarly, we check the setup for Encoder in the corresponding section, which is currently grayed out. Please note that ST EVAL Spin 3201 has advanced motor control Timer 1 with complementary outputs to drive directly high-side and low-side drivers with shoot-through protection. In this section, it is also possible to set the baud rate of the UART communication. It is recommended to use the minimum value. We are almost at the end of the configuration procedure. There are five last steps before you are able to spin the motor. 1. You need to save the parameter's file by clicking on the Save button and choose the name of the application. The pink arrow is pointing to the icon now. 2. You need to generate the source code. Please hit the blue arrow icon in the menu. The pink arrow is pointing to the icon now. You will be asked to set the IDE you intend to use, and please choose How Hardware Abstraction Layer in Driver Selection. 3. Next step, you need to compile the code using your preferred IDE. For example, IAR, Keel, AC6, or True Studio. 4. Download and debug the compiled code. 5. Finally, connect the board to the PC. Finally, you can enjoy the spinning motor in your application and real-time communication with the GUI. You can observe several parameters on the dashboard related to the motor performance, like motor power, temperature, and measured speed. You can change the speed, either using the potentiometer or using the target speed setting. Now, we can summarize the main points of today's tutorial. The ST Spin 32F0 delivers the flexibility and power of a microcontroller-based motor drive with the convenience, simplicity, and space efficiency of a single IC. The solution is equally attractive for developers with existing investments in proprietary motor control IPs or those seeking an off-the-shelf motor control algorithm. The ST Spin 32F0 significantly simplifies design challenges by leveraging the extensive STM32 development ecosystem with software tools, firmware libraries, and middleware available on top of the popular motion control algorithms, such as field-oriented control, FOC, and six-step control to streamline firmware development. Thank you very much. For more information, please check out our website at www.st.com-st-spin.