Cortex-M3-based STM32 microcontroller handles advanced motor control methods

Publisher:RadiantBreezeLatest update time:2012-08-07 Source: 21ic Keywords:Cortex-M3 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The advent of frequency converters and advanced motor control methods have made three-phase brushless motors (AC induction motors or permanent magnet synchronous motors) once a huge success in speed control applications. These high-performance motor drivers were mainly used in factory automation systems and robots. In the past decade, the sharp price reduction of electronic components has enabled these motor drivers to enter cost-sensitive markets such as home appliances, air conditioners or personal medical devices. This article will explore how standard ARM-based microcontrollers can break through complex control modes in a market that has long been dominated by DSPs and FPGAs. We will use STMicroelectronics' STM32 series microcontrollers based on the Cortex-M3 core as an example to illustrate this process.

untitled-1.jpg

Figure 3 : STM32: Solid foundation for growth


First, let's review the basics of motor control. Why are processors so important in motor control systems? Why do we need very good computing performance? After all, Nicolas Tesla didn't need a compiler when he invented the AC motor a century ago. Whenever speed regulation is required, one cannot avoid using an inverter to drive a decent 3-phase motor, and controlling a permanent magnet synchronous motor (PMSM) is even more inseparable from the inverter. The core of this complex power electronic system is a 3-phase DC-to-AC inverter, in which a microcontroller plays a management role and performs the common trinity of control functions in a fully digital way: sensing (current, speed, angle...), processing (algorithms, housekeeping...), and controlling the power switches (the minimum configuration has at least 6 switches).

The simplest way to achieve variable speed operation of a 3-phase AC motor is to use scalar control. The principle of scalar control is to maintain a constant ratio between the frequency and voltage applied to the motor. For entry-level motor drives, this is a very mainstream control method suitable for applications with very ordinary load characteristics and low control bandwidth requirements (such as very small power pumps and fans). Unfortunately, not all applications can tolerate such a simple control process and its application limitations. In particular, scalar control cannot guarantee the best motor performance (torque, efficiency) in transient environments. To overcome these limitations, other motor control methods have been developed, of which field-oriented control (also known as vector control) is one of the most widely used methods. This control method uses two decoupled DC controllers to drive any AC motor (induction motor or permanent magnet motor) in a split-field motor manner, regardless of the operating frequency (i.e. speed). The excitation current is related to the DC main flux (the flux of the magnets in a PMSM motor), while the 90° phase-shifted current can control the torque and function as the armature current of a DC motor. Field-oriented control allows precise speed control with fast response when the load changes, keeping the stator flux and rotor flux in perfect 90-degree phase difference, ensuring optimized energy efficiency even in transient operating environments. This is the basic theoretical framework for more complex control methods based on motor topologies, especially for PMSM motors. This theory is the basis for sensorless motor drives, which can significantly reduce costs (no speed or angle sensors and related wiring are required) and improve motor reliability. In this case, only the motor mathematical model, current and voltage values ​​must be used to estimate the rotor angle position by calculation. This state observer theory (among other control methods) can achieve sensorless speed control at a minimum of only a few hundred revolutions per minute, which in some cases is a stationary state. However, this is an additional real-time load on the CPU. Finally, the microcontroller must continuously recalculate the vector control algorithm at a rate of 1KHz to 20KHz, depending on the bandwidth of the final application. Processing Parke and Clarke transformations and implementing multiple PID controllers and software phase-locked loops does require intensive digital computing, which is why digital signal processors, microprocessors or FGPA devices have been used as controllers in the past.

Although dedicated dual-mode controllers and low-end fixed-point DSP architectures are available, STMicroelectronics still chose to develop STM32 microcontrollers using the Cortex-M3 core. This solution is well suited to meet the requirements of a large number of brushless motor drives, and from a one-time engineering cost perspective, the advantage of this solution is the cost-effectiveness of using industry-standard ARM® cores and standard microcontrollers. [page]

Based on the Harvard architecture, this 32-bit RISC uses the Thumb2 instruction set, providing 16-bit and 32-bit instructions. Compared with pure 32-bit code, this instruction set can greatly improve code density while retaining most of the advantages of the original ARM7 instruction set (additional optimized multiplication and addition operations and hardware division instructions).

Motor control systems require microcontrollers to have excellent real-time responsiveness (short interrupt latency), pure processing functions (such as single-cycle multiplication), and excellent control performance (when handling non-sequential execution flow and conditional branch instructions). Cortex-M3 can meet all these requirements. For example, when the clock frequency is 72MHz, a sensorless field-oriented control of a permanent magnet motor is completed in 25µs, which is equivalent to 25% CPU load at a 10 kHz sampling rate.

In the STM32 microcontroller, this core works closely with the STMicroelectronics optimized flash interface, and only a few external components are needed to handle external events (Figure 2 shows the block diagram of the STM32F103 medium-capacity microcontroller). Needless to say, the PWM timer and the analog-to-digital converter are the most important components. The PWM timer includes state-of-the-art features such as center-aligned mode PWM signal generation and dead-time insertion logic, with a special emphasis on safety: this module directly controls the commutation of the power switches, which can control the switching power up to several kilowatts. For example, the register code used to configure certain important parameters can be protected by a lock to prevent software failure. As long as the "Emergency Stop" pin is pulled low, all I/O pins are placed in a user-configurable safe state. This function is designed using a combinational logic module, which ensures that the protection circuits can still work properly before switching internally to the backup oscillator when the main clock (crystal) fails. Finally, the microcontroller also includes a fourth comparison channel dedicated to triggering the analog-to-digital converter to achieve the best current measurement accuracy.

untitled-1.jpg

Figure 2 : STM32F103 medium-capacity microcontroller block diagram

Even the most sophisticated algorithms can hardly correct inaccurate analog measurements, but the overall performance of the motor drive system depends to some extent on the quality of the analog-to-digital converters. The STM32F103 chip has three built-in 12-bit analog-to-digital converters with a sampling rate of 1MSps and a total unadjusted error (TUE) of less than 5 LSB over the entire temperature and voltage range. The digital interface of the analog-to-digital converter has three main functions: first, it frees the CPU from simple control tasks and data processing; second, it connects the rest of the chip (interrupt requests, DMA requests, trigger inputs); and finally, it synchronizes the operation of the STM32's multiplexers. Among these functions that are useful for brushless motor control, we first consider the channel read sequencer. Compared with the traditional scanning circuit (according to the analog input number, a certain number of channels are converted in sequence), within a sequence of 16 conversion channels (for example: Ch3, Ch3, Ch0, Ch11), the sequencer can convert channels in any order. When designers are designing printed circuit boards, this function brings designers greater design flexibility. In order to achieve the purpose of averaging conversion, multiple samples of the same channel are allowed (in a sequence). When the entire sequence is converted, the DMA channel sends the conversion results to RAM, and the interrupt handler generates an interrupt request.

The noise generated by transient voltages on the power switches during the detection of the motor phase currents (typically several hundred V/µs in offline switching applications) is a significant source of reading errors, which can result in very low signal-to-noise ratios in the measurements. The solution is to synchronize the analog-to-digital converter with the timer controlling the power stage: since the commutation moment can be predetermined (defined by the compare registers of the 3 PWM timers), an additional compare channel can be used to trigger an analog-to-digital conversion operation slightly before or after the commutation moment. For this reason, the STM32 enables a second sequencer (also called injection sequencer) that has a higher priority than the normal sequencer and can interrupt the current conversion operation with a new one that cannot be delayed. Normally, the normal sequencer is responsible for "housekeeping" the conversions, continuously detecting the temperature or the DC bus voltage (as a background task) and then sending them to the RAM through the DMA channel, while the injection sequencer will handle the time-critical conversion operations and store the conversion results in the analog-to-digital converter registers (an interrupt will be generated, but the delay cannot be accepted).

[page]

Having a general-purpose microcontroller capable of performing advanced motor control functions is one thing, but getting started easily is another. Both sides of the puzzle can be addressed with hardware and software tools. First, there is a motor control development starter kit, which includes test tools (JTAG probe and optoisolator), microcontroller chip, and power stage board and demonstration PMSM motor for product performance evaluation and development purposes. The modular design allows upgrading the demonstration application (e.g. dual motor control microcontroller board) to evaluate multiple (or custom) power stages. Finally, STMicroelectronics provides a motor control software library free of charge to STM32 customers. Version 2.0 of the motor control software library supports a variety of configurations using a simple and inexpensive list of #define statements in the header file. The software library contains field-oriented control algorithms for AC induction and synchronous motors, which are written in C programming language to simplify code readability and maintainability, again demonstrating the efficiency of modern compilers. The software library also provides a robust sensorless control algorithm for PMSM motors (based on flux observers), as well as a dedicated control algorithm for ultra-high-speed interior permanent magnet motors (IPM). Of course, the software also supports common speed and position sensors (incremental encoders, Hall sensors or tachometers). The STM32 supports three current sensing methods by using isolated sensors or shunts. The STM32 peripheral can implement an innovative single current sensing method to perform vector control using the lowest cost configuration (a simple unique resistor). This technology has been patented because it can minimize the intrinsic current distortion rate.

STMicroelectronics’ current main development projects are sensorless permanent magnet motor control to control the motor to standstill and dual motor control with built-in power factor correction. Recently, STMicroelectronics successfully demonstrated a single current sensing method, where only one STM32 microcontroller can perform two single current sensing vector control functions while also managing the PFC stage with a 40 kHz control loop (see Figure 1).

untitled-1.jpg

Figure 1 : The STM32F103HD can simultaneously handle dual motor control and digital PF

From power switch discrete devices to complex system chips, STMicroelectronics is committed to supporting the motor control market with its unique product portfolio for a long time. The STM32 microcontroller product line will continue to be deployed in four new directions, as shown in Figure 3, two of which are suitable for motor control. The first product line will target the low-cost market and develop low-end 16-bit motor control microcontrollers. The other product line is based on high performance and is aimed at applications that require higher processing performance, larger memory capacity and high-bandwidth interfaces. Such a broad product portfolio combined with the Cortex-M3 core is bound to establish the versatility of the STM32 architecture for current and future motor drives.

Keywords:Cortex-M3 Reference address:Cortex-M3-based STM32 microcontroller handles advanced motor control methods

Previous article:Design of deep sea remote motor control system based on STM32F103
Next article:Micr0 SD card reading and writing based on STM32F103XX microprocessor

Recommended ReadingLatest update time:2024-11-16 16:51

Solve the problem of entering an interrupt program immediately when the STM32 timer is turned on
When configuring the STM32 timer, the timer interrupt enable, timer enable, and clear update interrupt flag have different effects when the three programs are executed in different orders, as follows: TIM_ClearITPendingBit(TIM1, TIM_IT_Update); //Clear update interrupt request bit     TIM_ITConfig(TIM1, TIM_IT_Upd
[Microcontroller]
Problems encountered when using STLINK to burn external FLASH in STM32
Since the project requires a large number of image fonts and audio files, NOR flash and NAND flash are plugged in. The burning algorithm STLDR (which contains several sections of code running in SRAM) is needed. Several problems were encountered during debugging, all of which were caused by carelessness, so I wrote th
[Microcontroller]
STM32 external counting ETR calculation frequency
STM32 external counter ETR calculates frequency, measures 100K frequency, uses timer 2 for 250ms, and timer 3PD2 (TIM3_ETR) counts, and the calculation formula is f=n*t; void Tim3_Configuration(void) {      TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;    TIM_TimeBaseStructure.TIM_Prescaler = 0x00;     TIM_TimeBaseS
[Microcontroller]
STM32 Getting Started
  1. Install the MDK environment and download the third-party software mcuisp of the program.        Turn the BOOT0 switch to VCC, automatically search the serial port, and start programming. If the program is downloaded successfully, the information in the red box below will be printed out. After the program is downl
[Microcontroller]
STM32 Getting Started
Dual-core intelligent electro-hydraulic servo controller using DSP and STM32
  Most servo control systems use traditional hardware structures, and the control algorithms are relatively fixed. In addition, they cannot realize high-performance control algorithms under different working conditions, which makes it difficult to meet the needs of modern industry. At present, there is an urgent need
[Microcontroller]
Dual-core intelligent electro-hydraulic servo controller using DSP and STM32
About STM32 serial port overflow interrupt
I encountered a strange problem before:   Overflow interrupt processing is added to the serial port interrupt processing function: if(USART_GetITStatus(USART1,USART_IT_ORE) != RESET) //Generate overflow interrupt {        Utemp = USART_ReceiveData(USART1); //Throw away the received data        USART_ClearITPendingBit(
[Microcontroller]
STM32 LCD1602 Driver
#ifndef  LCD1602_STM32_H #define  LCD1602_STM32_H #define LCD_RS_1 GPIOE- BSRR=GPIO_Pin_0 //PE.0--(LCD)RS #define LCD_RS_0 GPIOE- BRR =GPIO_Pin_0 #define LCD_RW_1 GPIOE- BSRR=GPIO_Pin_1  //PE.1--(LCD)RW #define LCD_RW_0 GPIOE- BRR =GPIO_Pin_1 #define LCD_EN_1 GPIOE- BSRR=GPIO_Pin_2 //PE.2--(LCD)E #define LCD_EN
[Microcontroller]
"Energy Saving Star" EFM32 Application Solution - Handheld Laser Distance Meter
Overview With the development of modern technology and the improvement of people's living standards, portable laser rangefinders are widely used in various industries, such as construction, golf, driving speed and distance measurement. Laser is an electromagnetic wave with strong directionality, good mo
[Test Measurement]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号