Introduction to the Ultra High-Performance STM32H7 32-bit Microcontroller
The STM32H7 is the most powerful member of the popular STM32 family of 32-bit microcontrollers based on ARM Cortex-M cores, and offered by ST Microelectronics. Learn why its many advanced features blur the line between microcontroller and microprocessor.
The STM32H7 can be clocked at speeds up to 480 MHz with a benchmark performance greater than 1,000 DMIPS. This is one of the fastest, most powerful microcontrollers currently available on the market.
Cortex-M Microcontroller Cores
The STM32 family of microcontrollers is based on the ARM Cortex-M computing cores. So, before getting into the STM32 family it is worthwhile to briefly look at the ARM Cortex-M computing core.
For articles on less advanced members of the STM32 family of microcontrollers check out this article on the relatively simple STM32F0 and this one on the moderately complex STM32F4. Finally, for a general introduction to programming STM32 microcontrollers see this article.
The Cortex-M core comes in the form of silicon IP (Intellectual Property). It is licensed, by a company named ARM Holdings, to various silicon vendors that incorporate it into their own products. Companies that have licensed such cores in one form or another, include ST Microelectronics, TI, Microchip, NXP, Nordic, Qualcomm and many others.
The IP itself consists of such blocks as the main computing core, the memory protection unit and memory interfaces, caches, internal bus matrix system and others.
In particular, the Cortex-M cores are 32-bit Reduced Instruction Set Computer (RISC) cores that come in many versions such as the M0, M0+, M1, M3, M4, M7 and others. Each has differing hardware capabilities such as floating point units (FPU), Digital Signal Processing (DSP), hardware multipliers and others.
The STM32 family is broadly classed into four general categories, each targeted to a different market segment. These are: High Performance, Mainstream, Ultra-low Power and Wireless. Links to the entire family can be found here.
The STM32H7 is at the top of the High Performance category. It is a single or dual-core microcontroller, consisting of a 480MHz Cortex M7 and an additional 240MHz Cortex M4 core for the dual core versions. The High Performance category offers the highest performance in code execution and data transfers.
It also has the highest performance and most advanced peripherals in the STM32 family. Figure 1 summarizes the main features of the various members of the STM32H7 offerings. Figure 2 shows the internal block diagram of the high-end dual core STM32H757.
Figure 1 – Current members of the STM32H7 family and their salient features
Figure 2 – Internal block diagram of the dual core SMT32H757 microcontroller
Because this line of STM32 microcontrollers has quite a few members, and each one has a varying number of features, here is a link to a product selection guide specifically related to the STM32H7 variants.
Hardware Development with the STM32H7
The STM32H7 sub-family consists of many members, some with single Cortex M7 cores and some with dual Cortex M7 and Cortex M4 cores. The different variants sport different numbers and combinations of the usual peripherals such as GPIO’s, I2C’s, I2S’s, SPI, Timers, USARTS.
Some more advanced peripherals, that are not usually found in less performant microcontrollers, are also available. These include peripherals such as USB OTG, Ethernet and CAN controllers, Serial Audio Interfaces (SAI), Camera interface, TFT LCD interfaces and hardware graphics accelerators.
The family also supports cryptographic encryption engines in hardware, and also has features to ensure secure booting and code upgrade. There are no hard and fast rules for choosing the right microcontroller for a given application.
However, it should be quite obvious that the STM32H series is a candidate for applications that require high-end peripherals plus intense processing.
One of the best ways to learn about this family of processors is to spend some hands-on time with the hardware, running through some example development processes.
Toward this end, ST Microelectronics has many different evaluation boards, and the software development tools that go with them. Practicing with pre-defined examples will help you learn how to custom design applications.
I recommend the STM32H7x3I-EVAL boards to evaluate the full set of features for the STM32H7 series.
Figure 3 shows a picture of an actual STM32H753I-EVAL board. The TFT screen and Ethernet RJ-45 sockets can be clearly seen on the top right hand side of the picture. They can be purchased from the regular distributors such as Digikey.
This board provides an evaluation platform for some of the more advanced peripherals of the STM32H7 family of devices.
Figure 3 – Picture of an STM32H7531 evaluation board
A somewhat intermediate level board is the Discovery board for a given STM32 microcontroller. It doesn’t have all the options of the evaluation board, but it does incorporate some on-board sensors.
The least expensive alternative to the STM32H7x3I-EVAL board is the Nucleo board (Figure 3). It is basically a bare-bones module with minimal additional hardware besides the microcontroller itself. It’s a good introduction to getting familiar with a particular microcontroller.
Also, since the pins of the microcontroller are available on the headers on the left and right sides of the board, it is possible to interface this board to external hardware for additional prototyping.
Also, be aware that at the time of this writing, Discovery and Nucleo boards are not available for all STM32H7 devices. But STMicro is usually quite good at supporting their microcontrollers, so this should not be considered a blocking issue.
Figure 4 – Nucleo board for one of the STM32H7 microcontrollers
All of the boards mentioned allow downloading example code, or user-written code, from a cross-development platform like Windows, Mac or Linux machines where the code is actually written, complied, and debugged first.
The actual hardware connection from the development platform to the board is USB. On the other hand, the actual microcontroller on the target board is programmed in-circuit through a Serial Wire Debug, or SWD, interface.
The SWD Interface is an alternative to the JTAG (Joint Test Action Group) industry standard for debugging and flashing microcontrollers. ST Microelectronics uses it to program its STM32 line of microcontrollers.
The HW interface that allows the cross-development platform to download code to the microcontroller is the STLink-V3. It is built into all the boards mentioned previously.
Also, please note that the STLink-V3 is only found in boards sporting the latest STM32 microcontrollers such as the STM32H7 family. Older STM32 evaluation boards had STLINK-V2 interfaces, which are much slower, among other things, at about 12Mbits/s download speed compared to the STLINK-V3 at 480 Mbits/s.
The STLINK-V3 has other improvements over the V2 as well. It is also available as a standalone product for use in user-developed hardware from the usual distributors.
Application Development for the STM32H7
As previously mentioned, the STM32H7 family is a complex, single-core, or dual-core, high performance microcontroller with advanced peripherals. Developing applications from scratch, as is usually done with smaller microcontrollers, is not going to be a viable approach in most cases.
Fortunately, this need not be the case here. This section looks at the various tools available to help with application development.
All that it takes for most people to develop applications from the SYM32H7 family is to install a suitable Integrated Development Environment, or IDE, on a cross-development platform.
Then, develop the code. Compile, link in the appropriate libraries, and download to the target through a suitable programmer such as the STLink-V2 or STLink-V3. Although the STLINK-V2 will work, it is recommended to use the V3 if for nothing other than the higher download speed.
However, the STLink-V3 offers much more than that. This short clip shows some of its capabilities. As for the IDE, one such example is TrueStudio from Atollic. It, of course, features an Atollic compiler.
Other major compilers are available for STM32H7 family from Keil and IAR Systems. To go totally freeware, choose the Eclipse IDE.
This IDE can accommodate many add-on compilers such as the GCC, GNU Compiler Collection, tool chain for the STM32. Just be aware that while they are mostly compatible with each other in terms of supporting regular C language, they still have differences in the way some things are accomplished.
Assuming that everything is fine so far, it’s time to focus on the application software. It isn’t possible to cover all user applications.
However, embedded applications typically require setting up the core hardware and the various built-in peripherals, such as timers or IO pins. This is in order to control external hardware, whether these are LED’s, relays, I2C devices, or others.
As I mentioned earlier, manufacturers such as ST Micro license Cortex cores from ARM Holdings, and then integrate their own set of peripherals such as UARTs, CAN, I2C, Ethernet or SPI on single chips that they then offer as their microcontrollers. So, some of the setup will be for the ARM core itself, and some will be directed to the peripherals.
Configuring the core, or any peripherals, involves writing configuration values to internal registers. Determining what values to actually write to these multiple registers involves two things:
- Understanding what a particular hardware block does, and how it should behave in a particular application.
- Determining which registers to setup for that particular hardware block, and what values to set the registers to.
The first one requires reading, and understanding, the device specifications. There is simply no way around it. For example, the ARM core can have many system clock sources, with Phase-Locked Loops (PLL’s) to multiply these up and divisors to divide them down.
The reason for that is because various blocks such as the memories and the peripheral bus can run at different clock speeds.
As another example concerning peripherals, each of the multiple timers require a suitably scaled clock input source. They can operate in many modes such as Input Capture, Output Compare, Pulse Width Modulation (PWM), with or without interrupt, or automatic reload.
The same applies to the USARTs, SPI, I2C, USB, and other peripherals. Each one of these is a separate section in the datasheet.
While there are no shortcuts for the first part, there is help on the second part. Setting up the hardware involves writing the appropriate values to certain registers.
Most of these registers are further segmented into bit fields, where only some bits of a given register affect some part of a given hardware block, while other groups of bits affect other parts.
Worse, sometimes the settings of one register can affect how the bits of other registers are interpreted. So, it is usually a very time consuming exercise that involves a fully detailed understanding of each of these registers.
Fortunately, both ARM and STMicro have made life simpler by providing their own Hardware Abstraction Layers, or HAL’s. HAL, as the name implies, is a firmware layer that abstracts the hardware below it, and presents a more uniform way to access this hardware to all FW above it.
For instance, registers that are used to configure a particular block of HW are given appropriate names. There are pre-defined functions that are then used to configure a particular aspect of the HW such as IO port, clock sources, or timers.
The ARM Cortex HAL is called CMSIS for Cortex Microcontroller Software Interface Standard. The STM peripherals are simply called STM HAL.
As good as the HAL is, the user still needs to call the appropriate functions from all the available HAL functions, with the appropriate values to configure the underlying hardware. So, ST has provided a tool to dispense with even this part.
It is called STMCubeMx. This tool provides a GUI that allows the user to essentially configure the HW without writing much code. The configuration C code is automatically generated by this tool, with some sections where the user can insert the actual application code.
Again, STMCubeMx is a nice tool, but it still requires that the user knows how the device needs to be configured to match the application. Here are some examples specifically targeted to the STM32H7.
The STM32H7 blurs the line between the world of microcontrollers and the world of high-performance microprocessors. It’s one of the fastest, most advanced, microcontrollers currently on the market.
For many products the STM32H7 would be overkill, but for products that require fast processing speeds it can be a fantastic solution that is much easier to implement than a custom microprocessor design.
Other content you may like:
- How to Select the Microcontroller for Your New Product
- ATmega versus STM32: Which Microcontroller is Best for Your Application
- Introduction to the ESP32 WiFi / Bluetooth Wireless Microcontroller
- How to Select the Best Electronic Development Board to Prototype Your New Product
- Introduction to Embedded Firmware Development