MCU typical application design: Application of STM32-F2 in factory automation

Publisher:PositiveVibesLatest update time:2013-09-30 Keywords:MCU  STM32-F2 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The industrial environment is posing an increasingly severe challenge to embedded control system developers. The main reason is that the current system and communication protocol stack are becoming more and more complex, and the system real-time and safety requirements are becoming more and more stringent. At the same time, this trend 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 realize demanding industrial applications. The new series of products was born from the popular STM32 product family, with higher performance, larger storage capacity and peripherals optimized for industrial applications. The F2 series integrates multiple functions on a single chip, such as control/adjustment functions and complex communication protocol stacks. The advantage of high integration is that it reduces the space of printed circuit boards, avoids the existence of connection circuits between different controllers that are susceptible to electromagnetic compatibility, and optimizes application costs.

MCU typical application design: Application of STM32-F2 in factory automation

  The industrial automation market is characterized by the coexistence of multiple communication protocols, and real-time applications require efficient operating systems. Therefore, software stacks and operating systems have become the primary parameters for selecting microcontrollers. STM32 microcontrollers are based on the widely supported Cortex M3 core, so there are more than 20 real-time operating system and communication protocol providers for users to choose from. To make the STM32 microcontroller more perfect, STMicroelectronics has also added a CMSIS-compatible hardware abstraction layer and other firmware libraries, for example, supporting field-oriented control (FOC) of permanent magnet synchronous motors (PMSM). This article will introduce two third-party factory automation software developed specifically for STM32F-2: the IEEE1588 protocol software package supporting PTP developed by IXXAT and the Profinet communication protocol stack developed by PORT.

  STM32-F2 improved performance for factory automation

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

  In order to give full play to the excellent performance of the Cortex-M3 core, STMicroelectronics re-evaluated the product architecture. The new product releases a strong performance of 150DMIP at 120MHz (Dhrystone 2.1), and the CoreMark test score is 254 (2.120 CoreMark/MHz passed EEMBC certification). STM32F-2 has thus entered the first camp of Cortex-M microcontrollers. This achievement is attributed to the Adaptive Real-Time Memory Accelerator (ARTTM). After adopting this flash memory access management technology, the application code execution is no longer affected by the inherent wait state of the flash memory itself. Although the speed of the flash memory is three times slower than the core itself, there will be no wait state during the code execution process, even when the processing speed reaches 120MHz, there is zero wait state. Therefore, the new series of products can significantly reduce the 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: up to 1MB of flash memory, 128kB RAM, 6 UARTs (7.5Mbps), 3 SPI interfaces (30Mbps), Ethernet media access controller (MAC) supporting IEE1588 PTP V2, 4kB backup RAM, and 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 transmission 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 is finally designed as a multi-layer AHB bus matrix that supports up to 6 simultaneous data streams.

  

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

  ●ARM Cortex-M3 core with 3 core buses

  ●2 DMA controllers

  ●High-speed USB host controller

  ●10/100 Ethernet MAC controller

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

  In addition to multiple SRAM partitions, the system has two AHB bus slave controllers. Again, this configuration allows different bus masters to process in parallel and access different high-speed peripherals simultaneously, such as cryptographic processors and general purpose input and output ports. Both the AHB slave controller and the DMA controller are dual-ported, which allows the DMA controller to connect high-speed peripherals directly on the AHB bus, avoiding performance degradation due to delays in the bus matrix and the secondary high-speed to low-speed bridge.

  The external memory interface, also known as the "static memory controller", can directly connect to different asynchronous and synchronous memories, NOR/NAND flash memory, SRAM, pseudo-SRAM, and even a LCD display controller. The external memory interface bus frequency is up to 60MHz, and it can also obtain CPU core instructions through the instruction bus (I-bus).

  Memory Accelerator

  STMicroelectronics’ Adaptive Real-Time (ART) memory accelerator (shown below) allows the Cortex-M3 core to unleash the highest processing performance. Although the flash memory itself requires wait states, after the introduction of this technology, the STM32-F2 can execute code from flash memory at a speed of 120 MHz without wait states.

  

  The memory interface is 128 bits wide and can fetch 4-8 THUMB2 instructions at a time. If linear code is executed, due to the prefetch function, even if the flash speed is only one-fourth of the core, the code execution will not have a wait state.

  However, if a branch or jump instruction is executed, the data for the branch or jump target address needs to be fetched immediately, so the memory wait state adds overhead to the system. This is where the ART and its 64-entry instruction cache come into play. If a non-sequential instruction appears for the first time, the instruction is fetched from memory and stored in a storage entry of the 64-entry cache. The next time it appears, the instruction is fetched directly from the cache without a wait state.

  This instruction cache also has a LRU (least recently used) mechanism, so if an application software has more than 64 branch instructions, the most recently used new instructions will replace the least recently used instructions. The advantage of this architecture is that even if the interrupt service handler is overwritten by the accelerator, this mechanism can still support various branch instructions.

  The 8 most frequently used data lines act like a high-speed instruction cache, but are used to temporarily store the most frequently used databases, allowing the D-bus to be filled with data immediately.

  Industrial Protocol Stacks and Firmware

  IEEE 1588 PTP protocol developed by IXXAT for STM32

  Distributed application devices such as measurement systems, telecommunications equipment, automation systems or automotive systems have increasingly higher requirements for precise timing mechanisms. The IEEE 1588 Precision Timing Protocol (PTP) enables distributed devices to achieve nanosecond-level timing synchronization accuracy through Ethernet, thus meeting the requirements of distributed application systems.

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

  In order to implement the IEEE 1588 protocol on STMicroelectronics' STM32-F2 series microcontrollers, IXXAT provides STM32-F2 users with a customized version of the protocol software. This solution greatly simplifies and speeds up the protocol implementation process. The STM32-F2 dedicated protocol software needs to be used in conjunction with a TCP/IP protocol stack with multicast capabilities, 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 already supports the new IPv6 standard, which will gradually be adopted by new systems. The modular software structure of this solution includes basic packages and optional extension files, such as files for IPv6, IEEE 802.3 and Unicast, so that the package can be optimally matched with specialized applications and their resources.

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

  The STM32-F2 series microcontroller integrates hardware supporting IEEE 1588 (PTP V2) in the Ethernet media access controller MAC, and has all the resources required to implement a high-precision timing synchronization protocol. We conducted a long-term back-to-back connection synchronization test, using an accurate master controller (2ppm crystal oscillator) and a 0.125-second synchronization interval. The test results show that the maximum synchronization deviation of the platform is ±70 nanoseconds, and the standard synchronization deviation is about 15 nanoseconds. After power-on, IXXAT's IEEE 1588 protocol software synchronization requires an average of about 20 synchronization intervals.

  The IEEE 1588 software implemented on an STM32 microcontroller to achieve a typical function with IPv4, end-to-end (E2E) and peer-to-peer (P2P) delay mechanisms and a common clock for the host controller requires 47KB of space for program code, 7KB of space for read-only data, and 23KB of space for read-write data.

  In addition to IEEE 1588 protocol software, IXXAT's services include custom hardware and software development and system design, as well as technical seminars and code presentations.

PORT Profinet Software Stack

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

  

  PROFINET is the industrial Ethernet version of PROFIBUS, a technology that is widely acknowledged to be extremely resource-intensive. STMicroelectronics and Port have developed a PROFINET software for the STM32 F-2 series that requires only 128KB of SRAM, opening up a new application area for STMicroelectronics’ microcontrollers. The STM32 F-2 and Port PROFINET combination is not only suitable for industrial automation applications, such as industrial encoders (positioning), industrial drive accessories, but also for safety systems with built-in Ethernet control functions. The PROFINET STM32 F-2 version of the protocol stack provides users with all the service functions required for PROFINET IO-compatible communication in accordance with the IEC 61158 and IEC 61784 standards, helping users to easily and quickly develop PROFINET IO devices. The solution accesses the hardware through a hardware abstraction layer and provides users with drivers that can connect to different STMicroelectronics microcontrollers, with or without an operating system. The solution optimizes the underlying Ethernet driver software to quickly obtain bus access rights and comply with the PROFINET technical specifications. STM32 F-2 supports PROFINET Conformance Class A and can also support PROFINET Realtime Class 1. To help designers develop projects easily and quickly, Port also provides a PROFINET design tool.

  STMicroelectronics Motor Vector Control Library

  Because it integrates two advanced timer peripherals, three fast digital-to-analog converters (0.5MSps) and DMA direct memory access, the STM32F2x is particularly suitable for applications that require 1 or 2 motor control drivers. Even when driving two motors, the performance of 150DMIPS gives the STM32F2x enough backup power to drive other complex application tasks.

  The STM32F-2 is equipped with the STM32 PMSM FOC software development tool, which implements field-oriented control (FOC) to drive 3-phase permanent magnet synchronous surface-mounted motors (SM-PMSM) and internally mounted motors (I-PMSM). The latest version 3.1 of the STM32 PMSM FOC development tool 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 complete application platforms of STM32 microcontrollers. When developing motor control algorithms running on ST microcontrollers, this set of development tools helps to shorten the application development cycle. The source code of the PMSM FOC firmware is in C language, which implements the motor control core algorithm (reference frame conversion, current adjustment, speed adjustment, space vector modulation, energy efficiency optimization) as well as sensor detection algorithm, decoding algorithm (3 parallel resistors, ST patented single DC link parallel resistor, isolated current sensor, incremental encoder, Hall sensor) and rotor position reconstruction sensorless algorithm.

  In order to let everyone understand the excellent computing performance of STM32F-2, we have done a performance test. In a sensorless configuration using two parallel resistors to detect motor current, one STM32F-2 is used to drive two PMSM motors. According to the standard dual vector control performance (running the FOC algorithm at 10kHz), the CPU load is within 35%; according to the advanced dual vector control performance (running the FOC algorithm at 16kHz), the CPU load is within 50%. These performances open up a wide range of application space for the STM32F-2 series microcontrollers in the field of factory automation.

  Conclusion

  The demanding industrial communication protocol software stack can obviously make full use of the superior performance of the STM32F-2 series microcontrollers over its peers. When executing high-performance application software and algorithms, the STM32F-2 performs more than twice as fast as the previous generation STM32F-1.

  The STM32-F2 series has been verified by customers and is currently increasing production. Most firmware and protocol stacks are already available, and those that are not available are also ready for release this summer. The upgraded products of the STM32-F2 series are currently in the design stage. The new generation of products includes microcontrollers based on the Cortex-M4 core, which can better support applications that require digital signal processors.

Keywords:MCU  STM32-F2 Reference address:MCU typical application design: Application of STM32-F2 in factory automation

Previous article:Using AndesCore N1033A-S processor to realize μC/OS-II migration
Next article:Software and hardware design of elevator main control system based on CAN bus

Latest Analog Electronics Articles
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号