Content Details

As the concept of efficient energy consumption gains widespread recognition, motor energy consumption is receiving increasing attention. The development of motor control schemes is a complex process, particularly when it comes to motor control algorithms. To tackle the challenges faced in motor control solution development, ST, in collaboration with their partner MathWorks, presented their strategies at the STM32 China Summit held on May 12.


Four major challenges in developing motor control schemes

According to Chen Xiaoting, Market Manager for Communications, Electronics, and Semiconductor Industries at MathWorks China, their collaboration with ST began early, primarily focusing on two aspects:


The tools provided by MathWorks are utilized by ST's engineers, including both research and application engineers.

They have many shared customers and collaborate extensively in supporting them. As supporting customers is their common goal, they have engaged in numerous technical collaborations over the past two years. These collaborations include mutual training sessions, where MathWorks trains ST engineers and vice versa, enabling both parties to gain a deeper understanding of each other's products.

They also jointly conduct various marketing activities to introduce the latest technologies from both sides. Additionally, they have collaborated on creating videos to help users understand MathWorks' tools and ST's hardware.

When discussing the benefits of this collaboration for the motor control industry, Chen Xiaoting mentioned the inherent difficulties in motor control itself. From his perspective, the development of motor control schemes currently faces the following four challenges:


System modeling: Accurate modeling of the motor control system is required for simulation and control algorithm design. The modeling challenge lies in considering multiple factors such as the physical characteristics of the motor, circuit control characteristics, sensor accuracy, etc. Additionally, multidimensional modeling is necessary to accurately predict system behavior.


Control algorithm design: Designing control algorithms that are suitable for specific application scenarios is crucial for motor control systems. The algorithm design challenge involves synthesizing various factors, including system characteristics, control requirements, and real-world application environments. Multiple levels of optimization and testing are required to ensure the stability and reliability of the algorithms.


Hardware design: Hardware design for motor control systems needs to consider factors such as circuit complexity, power loss, EMI, etc. Additionally, hardware reliability and stability must be ensured to guarantee long-term system operation.

Debugging and testing: Debugging and testing motor control systems require validation through multiple stages, including analog simulation, experimental testing, and system integration. Substantial time and effort are required to ensure system stability and performance.


ST and MathWorks collaboration in addressing motor control scheme design challenges

According to Chen Xiaoting, utilizing MathWorks' software tool, Matlab, which provides a model-based design (MBD) workflow for motor control, effectively addresses the challenges faced in motor control scheme design. He stated that the MBD motor control workflow generally consists of the following steps:


  • Calibration of phase current ADC offset and calibration of angle offset between the position sensor and rotor.
  • Estimation of motor parameters.
  • Establishment of the controlled object model: inverter and motor model.
  • Development of a complete field-oriented control (FOC) model for closed-loop simulation.
  • Deployment on hardware for testing and verification.


The MBD-based motor control solution offers several benefits for development engineers:

Improved development efficiency: MBD assists engineers in faster design, simulation, and testing of motor control algorithms, thereby enhancing development efficiency. By utilizing model-based design tools, engineers can intuitively design and test algorithms, reducing development cycles and costs.


Enhanced code quality: MBD helps developers better manage their code, improving its quality. By employing model verification and testing tools, engineers can identify errors and defects in algorithms, thereby enhancing code quality and reliability.


Improved system performance: MBD facilitates optimized design of motor control algorithms, leading to improved system performance. By utilizing model optimization tools, engineers can better optimize algorithm parameters and control strategies, enhancing system response speed and accuracy.


Reduced development risks: Through model verification and testing tools, engineers can identify and address potential problems and risks more effectively, thereby reducing development risks and costs.


In summary, the MBD-based motor control solution enables development engineers to enhance development efficiency, code quality, and system performance while reducing development risks and costs.


Cao Jindong, Director of the Microcontroller and Digital IC Products Department (MDG) at STMicroelectronics China, stated that MathWorks' MBD motor control workflow currently supports ST's mainstream MCU models, such as STM32F4, STM32F7, STM32G4, STM32H7, STM32L4, STM32L5, and other product series.


Given the wide range of products ST offers and the frequent introduction of new products each year, how can the adaptation of new products be effectively managed? According to Chen Xiaoting, the support for ST development boards currently relies on ST's own STM32CubeMX for peripheral I/O configuration, and the Arm core is supported through Arm instruction set compatibility.


Therefore, if the I/O of a new product is similar to a previously adapted product, the existing toolchain can be quickly modified. However, if the new product is a multi-core heterogeneous product, the adaptation process becomes more challenging. Of course, if the new architecture holds significant market potential, both parties will allocate more resources to its development. Typically, the complete software toolchain is released approximately one year after receiving the product samples.

Cao Jindong believes that MathWorks' approach of supporting ST's products through STM32CubeMX is very clever. STM32CubeMX can generate configuration software for the entire system regardless of the specific MCU.


For example, when using STM32C0, selecting a package and configuring the I/O pins in STM32CubeMX results in a schematic diagram that includes the package and pins. If MathWorks' software can interface with STM32CubeMX or extract chip resources from it, it would greatly expedite the upgrade process for ST. When ST releases a new chip, if I/O peripheral configuration is already available in STM32CubeMX and the latest ARM core instructions are supported, upgrading for MathWorks becomes much faster. Cao Jindong is confident that MathWorks' software will increasingly support their STM32 product line.


So how can motor control and AI algorithms designed in Matlab be deployed onto embedded processors like STM32? Chen Xiaoting explains that MathWorks has several decades of experience in automated code generation for industries such as automotive and defense. They have a unique code generation framework that allows models developed in Matlab or Simulink to be deployed anywhere. In the case of STM32, Embedded Coder converts Matlab and Simulink algorithms into C/C++ code and optimizes it specifically for STM32 processors, replacing standard C code.


He also points out that MathWorks allows customers to import models into Matlab for AI training. Since AI training requires datasets, MathWorks supports customers in collecting and preprocessing their own datasets and utilizing AI models for training. Once the AI model is trained, it can be deployed on STM32 or even on a GPU in a PC.


However, before deploying to an embedded CPU, the most critical step is selecting a lightweight AI model that is suitable for the user's application and then performing network pruning (removing or reducing deep neural network connections and neurons) and quantization (quantizing activation, weights, and biases to int8 data type) on the selected AI algorithm. These compression tasks can be accomplished using user-friendly tools provided by Matlab, enabling inference on resource-constrained hardware. In other words, MathWorks supports the complete process from algorithm development to implementation.


Ding Xiaolei, Microcontroller Marketing Manager at STMicroelectronics, adds that STM32 has a tool called STM32 Cube.AI. This tool, when combined with certain features of Matlab, facilitates the entire AI development process. "STM32 Cube.AI optimizes and deploys pre-trained models onto STM32 MCUs. Because we have a deep understanding of our own MCUs, the deployment is more optimized, with smaller memory footprint, higher development efficiency, and better code flow. However, there are various mainstream AI models and frameworks available. Through the ONNX interface, we can convert well-trained models, which enables seamless collaboration with Matlab.


This allows development users to go from data collection, model selection, and training in the front-end to generating ONNX format models and subsequently using ST's Cube.AI for deployment. This creates a more streamlined and practical development process for AI."


Cao Jindong further emphasizes the increasing importance of collaboration with software support partners. He states that designing the chip itself is not the most difficult part; the challenge lies in providing software and specific application systems related to the chip for customer development. Working with partners like MathWorks helps customers become familiar with using MCUs for specific applications, which is a vital aspect of ST's ecosystem.



  • What is the role of EDA tools in IC design?

    Electronic Design Automation (EDA) tools play a vital role in IC design. These software tools help designers automate and optimize the design process. They assist with tasks such as schematic capture, simulation, synthesis, layout, and verification, improving design productivity and enabling faster time-to-market.

  • What are the major challenges in IC design?

    IC design faces various challenges, including increasing circuit complexity, power consumption, and shrinking transistor sizes. Other challenges include maintaining signal integrity, ensuring manufacturability, and dealing with the growing complexity of design rules and process technologies.

  • What is RTL design in IC design?

    RTL (Register Transfer Level) design is a step in IC design where the behavior and functionality of the circuit are described at the register transfer level. It involves defining the flow of data between registers and the operations performed on that data, without specifying the physical implementation.