Home » knowledge » STM32-F2 series microcontrollers are high-speed Cortex-M3 microcontrollers capable of meeting the demanding requirements of factory automation

STM32-F2 series microcontrollers are high-speed Cortex-M3 microcontrollers capable of meeting the demanding requirements of factory automation


The industrial environment is posing increasingly severe challenges to embedded control system developers. The main reason is that current systems and communication protocol stacks are becoming more and more complex, and system real-time and security requirements are becoming more and more stringent. At the same time, this trend It directly affects the characteristics and technical specifications of semiconductor components.

To overcome these challenges, STMicroelectronics released the STM32-F2 series of microcontrollers earlier this year to help developers implement demanding industrial applications. The new series is born from the popular STM32 product family, with higher performance, larger storage capacity and peripherals optimized for industrial applications. The F2 series products integrate multiple functions on a single chip, such as control/adjustment functions and complex communication protocol stacks. The high level of integration has the advantage of reducing printed circuit board space, avoiding connection circuits between different controllers that are susceptible to electromagnetic compatibility, and optimizing application costs.

The industrial automation market is characterized by the coexistence of multiple communication protocols, and real-time applications require efficient operating systems. Therefore, the software stack and operating system become the primary parameters for choosing a microcontroller. STM32 microcontrollers are based on the Cortex M3 core, which is widely supported in the market, so there are more than 20 real-time operating system and communication protocol providers for users to choose from. To complement the STM32 microcontroller, ST has also added a CMSIS-compatible hardware abstraction layer and other firmware libraries, such as Field Oriented Control (FOC) for Permanent Magnet Synchronous Motors (PMSM). This article will introduce two third-party factory automation software specially developed for STM32F-2: the IEEE1588 protocol software package supporting PTP developed by IXXAT and the Profinet communication protocol stack developed by PORT.

STM32-F2Improved performance for factory automation

Compared with the previous generation product STM32-F1, the STM32-F2 has been improved in many aspects, especially the performance is better and the peripheral interface is more abundant. STM32-F2 adopts 90nm lithography technology, processing speed reaches 120MHz, and keeps operating power consumption at a reasonable level (300uA/MHz). Another benefit of this lithography is the higher level of integration, which helps reduce the system-level cost of the application.

In order to take full advantage of the excellent performance of the Cortex-M3 core, STMicroelectronics re-evaluated the product architecture. The new product released the strong performance of 150DMIP at 120MHz (Dhrystone 2.1), and achieved a high score of 254 in the CoreMark™ test (2.120 CoreMark/MHz was certified by EEMBC), and the STM32F-2 entered the first camp of Cortex-M microcontrollers. Achievement thanks to Adaptive Real-Time Memory Accelerator (ARTTM), with this flash access management technology, application code execution is no longer affected by the inherent wait states of flash memory. Although the flash is three times slower than the core itself, there are no wait states during code execution, even at 120MHz processing speed with zero wait states. As a result, the new family of products can significantly reduce design size, reduce power consumption and the EMC impact of flash memory, and ensure the highest product performance.

The main features of STM32-F2 are as follows: Flash memory up to 1MB, 128kB RAM, 6 UARTs (7.5Mbps), 3 SPI interfaces (30Mbps), Ethernet Media Access Controller (MAC) supporting IEE1588 PTP V2, 4kB spare RAM, 512 bytes of one-time programmable memory (OTP).

bus matrix

In addition to the pure core computing power, microcontroller designers must also consider bus design to achieve parallel memory access and data transfer between different units of the microcontroller, for example, the core and communication peripherals need to access different memories at the same time. Therefore, the main bus was finally designed as a multi-layer AHB bus matrix, supporting up to 6 simultaneous data streams.

STM32-F2 series microcontrollers are high-speed Cortex-M3 microcontrollers capable of meeting the demanding requirements of factory automation

The STM32-F2 series microcontrollers have a total of 5 bus masters:

· ARM Cortex-M3 core with 3 core buses

2 DMA controllers

· Hi-Speed ​​USB Host Controller

10/100 Ethernet MAC Controller

The black dots in the above figure represent all the interfaces between the bus master controller and the slave controller in this 7-layer bus structure. In order to improve the energy efficiency of the system, the SRAM memory is divided into two storage areas, SRAM1 and SRAM2. SRAM1 is used to save the basic protocol stack and variables, while SRAM2 is used as a frame buffer for communication peripherals. Both the Ethernet and USB peripherals take up several kilobytes of FIFO storage, and each has a dedicated DMA controller for each.

In addition to multiple SRAM partitions, the system has two AHB bus slave controllers. Likewise, such a configuration allows different bus masters to process and synchronize access to different high-speed peripherals in parallel, such as cryptographic processors and general purpose input and output ports. Both the AHB slave controller and the DMA controller are dual-ported, this design allows direct connection of the DMA controller and high-speed peripherals on the AHB bus, avoiding performance degradation due to latency on the bus matrix and secondary high-speed-to-low-speed bridges.

The external memory interface, also known as “static memory controller”, can directly connect different asynchronous and synchronous memories, NOR/NAND flash memory, SRAM, pseudo SRAM, and even a Liquid Crystal Display controller. The bus frequency of the external memory interface is up to 60MHz. CPU core instructions can also be obtained through the instruction bus (I-bus).

memory accelerator

STM32-F2 series microcontrollers are high-speed Cortex-M3 microcontrollers capable of meeting the demanding requirements of factory automation

ST’s Adaptive Real-Time (ART) memory accelerator (shown above) allows the Cortex-M3 core to unleash the highest processing performance. Although the flash memory itself requires wait states, with the introduction of this technology, the STM32-F2 can perform at 120 Execute code from flash memory at MHz speed without wait states.

The memory interface is 128 bits wide and can take 4-8 THUMB2 instructions at a time. If you execute linear code, because of the prefetch function, even if the flash memory is only one-fourth the speed of the core, the code executes without waiting states.

However, if a branch or jump instruction is executed, the data at the target address of the branch or jump needs to be fetched immediately, so the memory wait states add overhead, which is where the ART and its 64-entry instruction cache come into play. If an out-of-sequence instruction occurs for the first time, the instruction is fetched from memory and stored in an entry in the 64-entry cache. On the next occurrence, the instruction will be fetched directly from the cache, with no wait states.

The instruction cache also has an LRU, which is not used recently. Therefore, if an application has more than 64 branch instructions, the new instructions that are used recently will replace the ones that are not used recently. The advantage of this architecture is that even if the interrupt service handler is overridden by the accelerator, this mechanism can still support various branch instructions.

The most commonly used 8-line data items are like the instruction cache, but are used to temporarily store the most commonly used databases, which can instantly fill the D-bus with data.

STM32-F2 series microcontrollers are high-speed Cortex-M3 microcontrollers capable of meeting the demanding requirements of factory automation

Industrial Stacks and Firmware

IEEE 1588 PTP protocol developed by IXXAT for STM32

Distributed applications such as measurement systems, telecommunication equipment, automation systems or automotive systems require more and more precise timing mechanisms. The Precision Timing Protocol (PTP) of IEEE 1588 enables the timing synchronization precision of distributed devices to reach nanosecond level through Ethernet, so as to meet the requirements of distributed application systems.

The IEEE 1588 protocol software developed by IXXAT Automation Technology Co., Ltd. enables equipment manufacturers to easily and quickly develop IEEE 1588-compliant equipment. The source code of this software uses C language and can be implemented on any platform.

To implement the IEEE 1588 protocol on STMicroelectronics’ STM32-F2 series of microcontrollers, IXXAT provides STM32-F2 users with a customized version of the protocol software, a solution that greatly simplifies and speeds up the implementation of the protocol. The STM32-F2 special protocol software needs to be used in conjunction with a TCP/IP protocol stack with multicast function, with or without an operating system.

Because of its rich functions, continuous upgrades and high market share, IXXAT’s IEEE 1588 protocol software has become the main reference standard in the 1588 protocol software market. The latest version 1.03 of IEEE 1588 has supported the new IPv6 standard, which will be gradually adopted by the new system. The solution’s modular software structure consists of basic packages and optional extension files, eg for IPv6, IEEE 802.3 and Unicast, allowing packages to be optimally matched to specific applications and their resources.

Users can dynamically set various functions, such as latency mechanisms (peer/end-to-end) and communication technologies (IPv4, IPv6, 802.3), so designers do not need to consider the network structure when developing the device, and users do not need to modify the firmware when using the device , this design can reduce development costs and allow customers to make more attractive value propositions.

The STM32-F2 series microcontrollers integrate hardware supporting IEEE 1588 (PTP V2) within the Ethernet Media Access Controller MAC, with all the resources required to implement a high-precision timing synchronization protocol. We did a long-term back-to-back connection synchronization test, using an accurate master controller (2ppm crystal oscillator), the test condition is a synchronization interval of 0.125 seconds, the test results show that the maximum synchronization deviation of the platform is ±70 nanoseconds, the standard The synchronization skew is about 15 nanoseconds. After power-up, the IXXAT’s IEEE 1588 protocol software synchronization requires an average of about 20 synchronization intervals.

IEEE 1588 software implemented on an STM32 microcontroller, achieves a typical function of a common normal clock with IPv4, end-to-end (E2E) and peer-to-peer (P2P) delay mechanisms and master controller, requires 47KB of space to save the program Code, 7KB space saves read-only data, 23KB space saves read and write data.

In addition to IEEE 1588 protocol software, IXXAT’s services include custom software and hardware development and system design, as well as technical seminars and code presentation services. STM3210C-EVAL evaluation board users can download a free version of the IEEE 1588 software developed by IXXAT in cooperation with STMicroelectronics from http://www.ixxat.de/evaluation_kit_stm3210c_de.html.

PORT Profinet software stack

Port Corporation, a market-leading provider of CAN/CANopen, DeviceNet fieldbus solutions, has strengthened its hardware and firmware development capabilities, expanded its business portfolio, and strengthened its protocol stacks and portfolio of POWERLINK, PROFINET, EtherNet/IP and EtherCAT development tools .

PROFINET is the industrial Ethernet version of PROFIBUS, and this technology is recognized by the industry as being extremely resource-intensive. STMicroelectronics and Port have developed a PROFINET software for the STM32 F-2 series with only 128KB of SRAM storage capacity, bringing STMicroelectronics microcontrollers into a new field of application. The STM32 F-2 in combination with Port PROFINET is suitable not only for industrial automation applications such as industrial encoders (positioning), industrial drive accessories, but also for safety systems with built-in Ethernet control functions. PROFINET’s STM32 F-2 version protocol stack provides users with all the service functions required for PROFINET IO-compatible communication in accordance with IEC 61158 and IEC 61784 standards, helping users develop PROFINET IO devices easily and quickly. The solution is to access the hardware through a hardware abstraction layer and provide the user with drivers capable of connecting to different microcontrollers from STMicroelectronics, with or without an operating system. In order to quickly obtain the right to use the bus and comply with the technical specifications of PROFINET, the solution optimizes the underlying Ethernet driver software. STM32 F-2 supports PROFINET Conformance Class A and can also support PROFINET Realtime Class 1. To help designers develop projects quickly and easily, Port also provides a PROFINET design tool.

ST’s Motor Vector Control Library

Because of the integration of two advanced timer peripherals, 3 fast digital-to-analog converters (0.5MSps) and DMA direct memory access, the STM32F2x is particularly suitable for applications requiring 1 or 2 motor control drivers. Even when driving two motors, the performance of 150DMIPS allows the STM32F2x to have sufficient backup power to drive other complex application tasks.

The STM32F-2 is equipped with the STM32 PMSM FOC software development tool, which enables Field Oriented Control (FOC) to drive 3-phase permanent magnet synchronous surface mount motors (SM-PMSM) and internal mount motors (I-PMSM), the latest version 3.1 of STM32 PMSM FOC The development kit includes the STM32F-2 microcontroller and is expected to be available in July 2011.

The STM32 PMSM FOC development tool kit can be used to quickly evaluate various applications and a complete application platform for STM32 microcontrollers. development cycle. The source code of the PMSM FOC firmware is in C language, which implements the motor control kernel algorithm (reference frame conversion, current adjustment, speed adjustment, space vector modulation, energy efficiency optimization), sensor detection algorithm, decoding algorithm (3 parallel resistors, STMicroelectronics Patented single DC link shunt resistor, isolated current sensor, incremental encoder, Hall sensor) and sensorless algorithm for rotor position reconstruction.

In order to let everyone understand the excellent computing performance of STM32F-2, we did a performance test. In a sensorless configuration using two parallel resistors to sense motor current, one STM32F-2 driving two PMSM motors, tested against standard dual vector control performance (running the FOC algorithm at 10kHz), with CPU load in the range of 35%; The CPU load is in the 50% range as tested for advanced dual vector control performance (running the FOC algorithm at 16kHz). These properties open up a wide range of applications for STM32F-2 series microcontrollers in the field of factory automation.


The demanding industrial communication protocol software stack is clearly able to take full advantage of the superior performance of the STM32F-2 family of microcontrollers. When executing high-performance application software and algorithms, the execution speed of STM32F-2 is more than double that of the previous generation STM32F-1.

STM32-F2 series products have been verified by customers and are currently increasing production. Most of the firmware and protocol stacks are already available, and the unlisted ones are ready for release this summer. Upgrades to the STM32-F2 series are currently in the design phase, and the new generation includes microcontrollers based on the Cortex-M4 core, which can better support applications that require digital signal processors.


The Links:   1DI400MN-120 CC1200RHBR