 We'll come all at today's DevCon presentation with the title, Building the Motor Control Platform with ST Spin32F0 Family Drivers. My name is Jiri Keperda, and I'm Product Marketing Engineer at ST Microelectronics. Let's warm up with a couple of poll questions. The first question is, do you have any experience with integrated architecture, meaning integrating microcontroller and gate driver? So there are two answers, yes and no, and I will come back with the results after a few slides. Let's start with a review of the motor control architecture. The brain of the system is a wide range of MCUs based on ST Spin32F0 Family. The gate driver provides the necessary strength and timing in order to drive the bridge inverter, either made of MOSFETs, typically for low voltage applications, or it is made of IGBTs, typically for high voltage applications. ST gate driver portfolio does include half bridge gate drivers represented by L6400 family and L6300 family with capability up to four amps. Recently, we developed also free-phase integrated gate drivers under ST drive family name for both high and low voltage applications. You can find low voltage, high voltage MOSFETs, IGBTs and also A-specs for inverter bridge in the ST portfolio. Now, there are two options, how we can integrate the motor control system. We can integrate the MCU together with gate driver and leaving the power stage discrete. Second option would be integrated gate driver with MOSFETs or IGBTs on one single package. Let's have a look on these two options from the application point of view. The first option in terms of integration is called ST Spin Family, and the typical use would be the application where we have portfolio of products with very similar requirements for MCU, but different requirements on the power stage, meaning the output power. The IPM slim modules and also PWD drivers represents the second option. The very similar output power is the common characteristic for this architecture and leaving the freedom on MCU selection based on the features of the system. Quick summary of the microcontrollers for motor control applications. ST is currently offering several lines of MCUs. The integrated solution is represented by ST Spin32 family. For more tailored application, the selection does include high performance MCUs, including the latest STM32 MP1. Next line includes mainstream MCUs, and the ultra low power line is dedicated for low IQ sensitive applications. The last line does include also the virus capable MCUs. Now, let's check the first question. I will repeat the question, do you have any experience with integrated architecture, microcontroller and gate driver? Oh, it's almost tight. 47.6 is the answer yes, and 52.4 answered no. So, I think that's a good starting point. So, now we will discuss system in package solutions for motor control. The PWD family together with ST Spin32 F0 represent the system in package technology. Currently, there are two devices from PWD family available on the market, and the third one is in development phase close to the launch for the mass market. The PWD family drivers are targeting industrial market, factory automation, fans, pumps, and blowers, home appliances, cooking hoods, and gas heaters, and also power supply units. The PWD 13F60 is a high density power driver integrating gate drivers and four-inchal power MOSFETs in dual half bridge configuration. The integrated power MOSFETs have a low RDS on of 320 mAh and 600 volt drain source breakdown voltage. The embedded gate drivers high side can be easily supplied by the integrated bootstrap diode. The input pins extended range allows an easy interfacing with microcontrollers, DSP units, or whole effect sensors. The device is available in compact QFN package. The PWD 5F60 is an advanced power and system package driver, which integrates gate driver and four-inchal power MOSFETs in a compact QFN package. The integrated power MOSFETs have RDS on of 1.38 ohm and a 600 volt drain source breakdown voltage. The embedded gate driver features two comparators that can be used for peak current control or overcurrent protection. Integrated bootstrap diodes, fast decay or slow decay, on-board constant off-time peak control, undervoltage protection, and low side and high side. 3.3 to 15 volt compatible inputs with hysteresis and pulldown. The evaluation board EVAL-PWD-5F60 demonstrates how to use the PWD-5F60 to drive a single phase load in full bridge topology. This allows a control of both directions and the amount of the current flowing into the load. The typical application that can benefit from the high integration of the PWD-5F60 are, for example, single-phase BLDC motors or fans. The board has a very small footprint and optimized layout thanks to the integrated features of the PWD-5F60, and it can be simply run by applying the supply voltage and a direction signal. Before we move to the next chapter, ST Spin32F0 family, we have here also second poll question. The question is, do you have experience with, first answer, low-voltage motor control design, second, high-voltage motor control design, third, both, and the four is obvious either. We started today's presentation with a motor control architecture. We will focus on the second option as highlighted in terms of integration. This option does integrate a microcontroller together with gate driver into single QFN seven-by-seven millimeter package compared to the first option combining power stage together with the gate driver as discussed on previous slides where we introduce PWD family drivers. Let's have a look what we have under hood. The integrated microcontroller is standard 32-bit STN32 ARM Cortex M0 from the ST standard STN32 portfolio. It is the same silicon as STN32F031C6. The analog and power conversion provides free phase gate driver with 600 milliamp sync source capability up to 45 volt for low-voltage family and one amp or 350 milliamp gate current capability for high-voltage family depending on subversion. The low-voltage version of STN32F0 includes also 3.3 volt bug converter which provides the supply for microcontroller and 12-volt LDO for the gate driver supply. As I mentioned on the previous slide, currently we have two main group of STN32F0. Low-voltage is rated up to 45 volt and the high-voltage group we decided to split the family into subfamilies. 250-volt subfamilies and 600-volt subfamilies. All drivers can be used in sensor or sensorless configuration and we are providing for each part number dedicated firmware for the evaluation. The microcontroller STN32F031 is used across all STN32F0 products. The 32-bit M0 ARM core-based architecture has clock frequency of 48 megahertz, four kilobyte of SRAM and 32-kilobyte flash for the program. The number of GPIOs depend on version and it could be up to 20. Five general purpose timers, including dedicated timers for motor control with complementary outputs ensures the best possible performance. The ATD converter has up to nine channels which are multiplex and they can be used externally or internally together with built-in op-amps for current sensing. The SPI, UART and I2C combustion protocols are available. The last feature is the serial wire debug. All products from STN32F0 family have an extended temperature range from minus 40 Celsius degree up to 125 Celsius degree. Now there is a time to share the second question from the poll, meaning the results. So actually it looks like I was not able to get any results compared to previous question. So there is a small hiccup here. Nevertheless, let's move to next chapter. Which is STN32F0 low voltage. Currently we have three options of low voltage STN32F0 drivers. The low voltage STN32F0 family has several common electrical parameters. Voltage range is up to 45 volt. On the lower side depends on the version but it can be as low as 6.6 volt. Built-in buck converter which provides 3.3 volt supply for the microcontroller. LDO which provides 12 volt supply for the gate driver. All drivers of STN32F0 family have a standard set of protections under voltage lockout, over current protection and thermal shutdown. There is also extended temperature range as I mentioned previously. We use 7x7 QFN compact package. Here we have a side-by-side parametric comparison of all STN32F0 drivers. The operating voltage range starts at 8.2 volt at STN32F0 and the under voltage lockout was lowered down to 6.6 volt for the A and B version. The MCU, LDO and buck converter are the same across all three drivers. The major difference among those three drivers is the number of available GPIOs and number of op-amps. Since we were pin limited there is a trade-off between those two features. The STN32F0 version provides four op-amps and 15 available GPIOs. The B version offers three op-amps and 16 GPIOs. And finally, the B version has the highest number of GPIOs, 20 and only one op-amp as a trade-off. Both A and B version have also bootloader. STN32F0 provides ecosystem for the development of motor control applications. The evaluation boards allows you rapid prototyping and quick setup to evaluate and demonstrate the proof of concept. The ST eval-spin3201 is based on STN32F0 this FOC in free shunt configuration. The firmware is available for sensor and also sensorless application. The ST eval-spin3202 provides FOC and a six step commutation algorithm in one shunt configuration. The firmware is again available for sensor and sensorless application. The ST Spin32F0B is on ST eval-spin3204 evaluation board in one shunt configuration with six step commutation firmware. I skipped the ST eval-ESC002V1 since it is reference design for ESC rather than generic evaluation board. This evaluation board has ST Spin32F0 on it and it goes with high speed six step commutation firmware. You may find this table helpful in case you are looking for a reference documentation and available firmware. The eval-kit-robot-1 is an evaluation kit offering a ready to use servo brushless solution. The Maxon motor, which is included in the kit offers a very high torque density and very low cogging torque. This motor together with an incremental encoder and ST Spin32F0A running field oriented control with closed loop positioning is an excellent choice for reliable and high precision position and speed control. The ST Spin32 motor control workbench is a graphical user interface software running on PC that reduces the design effort and time needed for the ST Spin32PM SM FOC firmware configuration. The user generates a project file through the graphical user interface and the same GUI allows you a real time monitoring of the system and changing the key variables. More details about software tools including the real application will be presented also in the second half of today's presentation by my colleague Rosario. I would like to share with you also an application which is slightly different than Free Face BLDC. The ST Val Spin3201 supports also the application with brush DC motors with an incremental decoder. The brush DC motor library with graphical user interface allows you speed and position control. The communication is performed through the UART. Now we are moving to the next chapter which covers high voltage ST Spin32F family. The next step in the evolution of the ST Spin32F0 family is a high voltage option. As you can see from the block diagram, the architecture is very similar. The high voltage drivers have the same M0 core based microcontroller. The gate drivers are made in the BCD6 offline technology which provides very good robustness and I'll share more details in a few minutes. From the development point of view, the key is that the entire development ecosystem is the same as for low voltage drivers. Currently, there are four options of high voltage drivers. Two versions of 150 volt subfamily and two drivers from the 600 volt family. They are pin to pin compatible. Also, high voltage options are offering FOC and a six step commutation algorithm and compatibility with ST Spin32 ecosystem. Both versions can save up to 60% of the space on the PCB due to the system in package solution, meaning integrating ST Spin32 Cortex M0 micro together with high voltage gate drivers. Few key parameters for the ST Spin32 F0 600 family. The 601 version can provide up to 350 milliamp gate current and the 602 version up to one amp for higher power applications. It has integrated bootstrap diode and it is offered in two package versions. The other parameters are the same as other ST Spin32 F0 family drivers. Similarly, the ST Spin32 F0 250 has two options in terms of gate current capability. The 251 provides up to 350 milliamp and 252 up to one amp gate current and also two package options are available. You may ask the question, why we develop 250 volt to land drivers? These drivers can be used in the high power tools, garden tools, industrial pumps and industrial automation. Electrical characteristics of the gate driver are the key parameters from the robustness point of view. The integrated bootstrap diode with zero static drop provides not only bill of material savings but also improvement in the electrical behavior. The gate drivers, both high side and low side are protected by undervoltage lockout. The drivers have interlocking cross conduction prevention which has a direct impact on the reliability and longevity of the system. The PCB layout especially the ground rounding for the high power application is critical. The gate drivers have separated GND pins for logic and low side power. The gate drivers of ST Spin32 F0 high voltage family were successfully tested with below ground spikes 100 volt and more. As I mentioned before, the high voltage version of ST Spin32 F0 family offers two package options. 72 leads QFN 10x10 package with pitch 0.5 and 1.8 millimeter Cripitch for the critical pins. The 64 leads to QFP 10x10 package with the pitch 0.5 and Cripitch 1.12 millimeter. The list of evaluation boards includes all versions of high voltage ST Spin32 and the firmware covers both FOC and six step commutation algorithm, one shunt and free shunt configuration and sensor and sensor less application. The summary table and tools overview should help you to figure out what do you need to get started. I would like to stress one key parameter, the ST longevity commitment. For the ST Spin32 F0 high voltage drivers it is 10 years longevity commitment. All evaluation boards have the same architecture. They included a stealing debugger, feedback network, power stage, power supply, and of course the high voltage ST Spin32 F0. In this case, ST Spin32 F0 601. This board is using single shunt sensing. The EV Spin32 F0 601 S3 has free shunt resistors and the power stage supply voltage can be within the range 50 volt and 280 volt AC. EV Spin32 F0 0602 S1 has a single shunt configuration and has dual footprint either for MOSFETs or IGBTs. The last evaluation board EV Spin32 F0 251 S1 is also single shunt configuration with dual footprint for IGBTs or MOSFETs. The board allow the load up to 16 amp and the ST link is detachable. My presentation is over. Thank you very much for your attention. And now it is Rosario's turn. After that, we will have a Q&A session, have a fun. Hello and welcome to this video presentation where we will show how to spin a permanent magnet synchronous motor using the motor control software development kit. My name is Rosario Tanasio and I'm an applications manager at ST Micro Electronics. So what is the motor control workbench and how does it benefit a designer of motor control applications? The motor control workbench is a GUI that is part of the motor control software development kit or SDK. This also includes the FOC library for permanent magnet synchronous motors. The ST motor control workbench provides an easy way to configure motor control application software and matching hardware setup. The project generated by the tool is compatible with the STM32 Cubemax for further extension or modification. The motor control workbench supports many of the boards of the motor control ecosystem or can also be used with the custom boards. It has a large number of example projects to start with. The user can create a new project input the motor parameters, set the signal conditioning current circuits for current and voltage sensing and also leverage on an embedded tool for the tuning of the API controller parameters. This is also an interface that allows it to monitor the application once the motor is spinning. The FOC library includes both the sensorless or censored control for speed and position control using all effect sensors or unencoder. The software reduces the design effort and time needed for application setup. Let's check software requirements. First of all, we need to have a laptop with the 64-bit Windows 7 or Windows 10. Then we need to have a development environment. We recommend the IAR embedded workbench for ARM or the STM32Q by D. We will have to download and install the X-Cube motor control software development kit full version. You can do that from st.com register and get approval which should take a few minutes. Then download and install the STM32Q by Macs as well as the ST-Link drivers. And finally download and install JavaJR8 for Windows. Okay, next is an overview of the hardware setup. We need our laptop with the software that we've just mentioned installed, motor control workbench and STM32Q by Macs. We need a USB cable. We need also a demo board for this specific test. We have selected the ST-Spin3201 which has the ST-Spin320F0 and six low voltage FETs that implement a three phase inverter. The topology is the three shunt one for this specific board. As you can see, the board is a general purpose one. It has a lot of test points, a potentiometer to close the speed feedback loop as well as the connector for the oil effect sensors or the encoder plus three push buttons that can be used to enable or disable the application or reset the microcontroller. The ST-Link is also present on this board so you don't need an external one. And we need to supply this board with power supply that is capable of delivering 12 volt and a minimum current of one amp. The motor that we have used for this demonstration is BLDC, low power 4.2 watts but capable of reaching 8,000 RPM. It has four power pairs. The oscilloscope is also necessary as well as a current probe that we will use down the road for tuning. For the wiring, you need to connect your power supply cables to J2. Be careful the admissible voltage range is 8 to 45 volts DC. The motor winding phases need to be connected to J3. And the USB cable to J5 on one end and on the other end, any of the available USB ports on your laptop. I have placed the current probe on phase V. The laptop is, as you can see on the right side, running the motor control workbench. And this is the basic setup. But the motor is shown here. It's a little black cylinder. The board is already supplied as the red LED show. The motor I've used for this demonstration is available on Anheim Automation website. If you want to buy one for a few bucks and repeat the test. It has a rated voltage of 12 volts, rated speed of 8,000 RPM. The peak current is 2.2 amps, rated torque is 0.7 ounces per inch. The line-to-line resistance is 3.5 amps and the line-to-line inductance is 0.7 milliarys. The back EMF constant is 0.8 volts per kilo RPM. And this motor has four pole pairs. One thing to note is the back EMF constant very often is not available on the data sheet of the motor manufacturer. If this is the case, like for example, for the Anheim Automation motor, you can always measure it. The way to do that is spin the rotor at constant speed. We typically use a drill to do that and a digital oscilloscope to measure first two phase voltage and the electrical frequency. The other important thing to notice is this data sheet provides line-to-line resistance and inductance, but the motor control workbench uses a per-phase model. Therefore, you will need to divide these values by two in order to use them properly with our software tool. Now I want to go over the workflow and it's to be followed for successful spinning the motor. First of all, we need to create a new project with the motor control workbench and then we needed to set up the motor control workbench by inputting the motor parameters, setting the current sensing and the deprotection, then working on some driver management settings such as selecting a proper switching frequency for our application. We needed to set the type of speed sensing, startup parameters, and the serial communication. Once we have done this, we can generate the compile and download the code into the ST Spin32F0. If all of this is done correctly, we can connect the board to the motor control workbench. One thing I want to mention is that if for any reason the motor parameters are not available, you can use the ST motor provider. This is available for download on our website or you can proceed with the manual characterization and extraction of these parameters. IOC file that is generated by the motor control workbench can then be imported in the STM32QB-MX for code expansion, further code generation or tuning. The final code can then be compiled by using IR or Kyle or, for example, our STM32QB IDE and finally downloaded on the microcontroller. If everything is done correctly, as I have shown here, and you try to spin the motor and you get error from the motor control workbench monitor, don't get discouraged that this is quite normal. There are still a couple of steps that need to be done. First of all, we need that to perform the tuning of the current regulator. Then we need it to successfully switch from open loop to closed loop while using torque mode. And the final step is to tune the speed regulator. Now that we have talked about the tools, we can proceed with the generation of the code using the motor control workbench. We start from a new project and we can see from this window that we have the option of selecting either a custom board both for the control and the power or one of our, for example, nuclear boards or one of our expansion boards dedicated to motor control applications. The other option is to select a complete inverter board which features both the control and the power stage. Among the featured board, you will find the ST-SPIN32-1. We select it and we click on OK. The motor control main page will now load up and will allow us to change and configure the application parameters. We start from the motor ones. We set the number of pole pairs, the maximum speed, the peak current, the supply voltage, the phase resistance, the phase inductance, and finally the back emf constant according to what we have seen in one of the previous sections. When we are done, we click on OK. Here we can also select to use the bus voltage sensing to have overcurrent protection and eventually also temperature sensing for a protection. From the current sensing tab, we can define the current reading topology. We have three options, one shunt, three shunt, and the two insulated current sensor. The board is a three shunt topology, so we will keep this. We also keep the sensor resistor value, 10 milli ohm and the amplification and a torque gain of 7.7. It is provided by some external opamps mounted on the ST-SPIN32-1. In a general application, we will customize both the value of the shunt resistor, the amplification on board, in order to exploit as much as we can, the dynamic of the A2D converter. Once we are done, we click on the next tab, which is the speed sensing one. Here we can choose between sensorless or sensor diffusive, for example, using all sensor or quadrature encoder. We'll keep the sensorless observer plus the PLL and move on to the next settings. From the fever and drive management tab, we select the drive settings. Here we choose to go with a switching frequency of 15 kilohertz. We can also define the execution rate as we speed the regulator. We keep one. We can input, for example, the values of Kp and Ki for the speed regulator, as well as for the torque and the flux regulator. For now, we use some low values for Kp and especially Ki, so I modify Ki here. Also, here we start from low values in here as well. And we have also some divisors. I will use the bigger number for all the integral terms of the three PI regulators. On this part of this window, I can select the target speed. I will use 2000 RPM. And the cutoff frequency, I will start from 6,000 read-ins per second. Very important that the execution rate, if I keep it one, the control will be executed once every PWM period. Otherwise, if I choose two or three, it will be executed once every two PWM periods or three PWM periods. At this point, we are done with this. Next, we want to define the startup parameters. So here we have the advanced customized table, which allows us to define five different steps. Here I have already defined the table. In this column, you define the duration of each step. Here you define the speed and here the current. The first step is very important because it allows the alignment of the rotor. It needs to have a longer duration, the final speed of zero and a current that is 50, 60% of the nominal current of the motor. Then in step number two, you start ramping up the speed to 5,500 RPM in this case with a final current of 1.3. Then we keep increasing the speed to 1,000 RPM, keeping the same current. And we do that for step number three and four. And finally, we approach our final speed by using a final speed of 1,800 RPM with a final current of 1.2. We start executing the controller algorithm from step number three. And we define a minimum output speed that is slightly higher than the final speed of step number three, so 1,020 RPM. Last thing, we define the estimated speed and the tolerance in these two menus here. We want to have kind of wide tolerance at least in the initial phases. So I've used 150% and 50% as upper limit and lower limit. Once we are done with this section, we can close this window and move to the next. At this point, we have everything we need to generate the code. To do this, click on the blue arrow, which will start the generation of the code. At this point, you need to choose your debugger, IR in my case, and then click on generate. Okay, once the generation is completed, we can open, we click on open folder, click on eWorm and select the project. IR will open. The next thing we have to do is rebuild the whole project. This will take one minute or two. And after that, we have to compile and flash our STSPIN32 with the generated code. To flash the microcontroller, just click on this green arrow. Okay, once done with that, we can simply go back to the model control workbench and close the cube MX. And we can open the monitor by clicking on this icon. To connect the board, click on this icon. Okay, at this point, the board is connected. We can click on the advanced tab and try to spin our motor using the torque mode. Okay, so let's set the current reference. For example, 120, we hit set the reference and then start the motor. You will see that the motor will increase its speed. And then after a while, we will see this speed feedback error appearing on the left side of our monitor. This is normal with the model control workbench. And it's due to the fact that the PI parameters as well as the observer constant C1 and C2 are not yet tuned. So we need to do that next. Let's proceed with the tuning. In the configuration tab, you have also a tool to do the tuning of the PI loop parameters. In order to do this, we will use the five steps of the rev up table that will be configured with the final speed equal to zero for all the five steps. And the final torque value that can be defined using this formula that you can see here. So the final torque is equal to 32,535 divided by the max readable current, which in our case is 21.4 amps times the nominal motor current, which is 2.2 amps. Okay, at this point, we use a final torque for step one of 1200 with a duration of initial zero. For the second step, we define a duration of 50 millisecond. Then we decrease the torque to 600 and we select step number three duration equal to zero. And for step number four, same final torque value of step number three with a duration of 50 milliseconds. Now we have defined our step function. We can go back to the advanced tab, start with some low values for the KP and the KI of our PI controller, for example, 150 and put at zero, both the KP and the KI for the ID regulator. Once we have done this, we can hit the start motor tab and observe the response of the controller on the oscilloscope. Now you can see that this response is not ideal. It's a little bit slow. And when this happens, it means that you need to increase your KI. So next step will be to bring a KI up to 100. We clear the fault and we hit the start motor again. We now observe that the response has improved, but it's still not enough. So we will increase a little bit further, the value of KI to 200, clear the fault and start the motor again. Now we see that the response starts to have some oscillations. So at this point, I will not increase the KI anymore and I will start increasing the KP parameter until I find the response that is satisfactory. Okay, so at the end of this tuning procedure, I came up with the two values of a KP and KI. KP equal to 1500 and KI equal to 100. At this point, I am ready to test again in torque mode. I set the reference to 120, clear the fault and start the motor. I observed the behavior of the motor by looking at the measured speed. And I noticed that again, the speed feedback error is here. This is happening because we haven't tuned yet the value of C2 of the observer. This value is currently equal to 24,000. We can start by halving it, repeating the test by clearing the fault and starting the motor until we see that the speed feedback error is gone. At the end of this procedure, I have found that the value of 880 works well for this motor. So I cleared the fault, start the motor again and I can finally now observe that the motor speed is stable, the motor is able to hold the torque and if I change the torque reference, the motor follows the reference and the speed increases. So at this point, I have attuned current loop. My next step will be that of adding the speed controller to the system. Okay, so to add the speed controller, let's select the control mode speed and let's start with low values of Kp and Ki. We select the target speed of 3000 rpm, we clear the previous faults and we try now to start the motor and see what happens. We can monitor the speed of the motor using the plotter. So here you can see that there is a big overshoot with the current parameters and that the response is very slow. So definitely we need to work on the Kp and Ki parameters in order to improve this current behavior. To do that, we can, for example, start with higher values of Kp. Check again what the response of the motor is when we do a step from 3000 rpm to 1000 rpm and back to 3000 rpm. In this way, we can again monitor the speed. We see that now the speed is following the reference quite well and by iterating this kind of procedure, we can achieve a really well tuned motor. So this is it for this demonstration. I hope you have enjoyed it. The for more information about our demo boards, our tools and our ecosystem, visit www.st.com.