Our main objective in this book is to write firmware code that interacts directly with the registers of our microcontroller. This means there’s no abstraction or intermediary library between our code and the target microcontroller. To achieve this, it’s important to grasp the internal architecture of the microcontroller, understand the addresses of each register we interact with, and know the functions of relevant bits within those registers. This is where datasheets and manuals come in. Manufacturers provide these documents for users to understand their products, which in our case refers to the microcontroller core architecture, the microcontroller, and the development board.
Two distinct companies play roles in the making of our development board. The first is ARM Holdings, which licenses processor and microcontroller core architecture designs to semiconductor manufacturing firms such as STMicroelectronics, Texas Instruments, and Renesas. These manufacturers then produce the physical microcontroller or processor based on the licensed designs from ARM, often with their custom additions. This explains why two different microcontrollers from separate manufacturers might share the same microcontroller core. For instance, both the TM4C123 from Texas Instruments and STM32F4 from STMicroelectronics are based on the ARM Cortex-M4 core.
Since our chosen development board, the NUCLEO-F411 from STMicroelectronics, is based on the ARM Cortex-M4 microcontroller core, in the following sections, we’ll delve into the documentation for the board, its integrated microcontroller, and the underlying core.
Understanding STMicroelectronics’ documentation
A significant reason for the popularity of STM32 microcontrollers is STMicroelectronics’ continued commitment to providing comprehensive support. This includes well-organized documentation and various firmware development resources.
STMicroelectronics has a range of documents, each following a specific naming convention. Let’s discuss those relevant to our work:
- Reference Manual (RM): All RMs start with the letters
RM
, followed by a number. For instance, the RM for our microcontroller is RM0383
. This document details every register in our microcontroller, clarifying each bit’s role and providing insights on register configurations.
- Datasheet: The datasheet is named after the microcontroller, so for the STM32F411 microcontroller, the datasheet is simply called
STM32F411
. This document provides a functional overview of the microcontroller, a complete memory map, a block diagram showcasing the microcontroller’s peripherals and connecting buses, as well as the pinout and electrical characteristics of the microcontroller.
- UM (User Manual): Starting with the letters
UM
and followed by a number, such as UM1724
for our NUCLEO-F411, this document focuses on the development board. It describes how components on our board, such as LEDs and buttons, are connected to specific ports and pins of the microcontroller.
The generic user guide by ARM
ARM provides documents for every microcontroller and processor core they design. Important to our discussion is the generic user guide for our microcontroller core. As we’re using the STM32F411, which is based on the ARM Cortex-M4 core, we’ll refer to the Cortex-M4 generic user guide.
This means that if we were using an STM32F7 microcontroller, which is based on the ARM Cortex-M7 core, then we would need to get the Cortex-M7 generic user guide. The naming convention of this document is simply the name of the microcontroller core + the phrase generic
user guide
.
As the name implies, this document provides information generic to the specific microcontroller core. This means that the information provided in the Cortex-M4 generic user guide applies to all microcontrollers based on the Cortex-M4 core, irrespective of the manufacturers of those microcontrollers. In contrast, the information provided in the STMicroelectronics documentation applies to only STMicroelectronics’ microcontrollers.
Figure 1.14: The relationship between the development board, microcontroller, and microcontroller core
Why do we need the generic user guide?
The generic user guide provides information on the core peripherals of the processor core. As the term suggests, these core peripherals are consistent across all microcontrollers, based on a specific core. The Cortex-M4 core has five core peripherals – the System Timer, Floating-Point Unit, System Control Block, Memory Protection Unit, and the Nested Vectored Interrupt Controller. When developing bare-metal drivers for these peripherals, the generic user guide is the definitive source for the essential details.
Additionally, the guide provides information on the microcontroller core’s Instruction Set, as well as the Programmer’s Model, Exception Model, fault handling, and power management.
Getting the documents
To obtain the aforementioned documents, you can use the following search phrases on Google:
- RM: Either
STM32F11 Reference Manual
or RM0383
.
- Datasheet:
STM32F411 Datasheet
.
- UM:
Nucleo-F11 User Manual
or UM1724
.
- Generic user guide:
Cortex-M4 Generic
User Guide
Direct links to these documents are also available, in the Technical requirements section of this chapter.
Before analyzing the key areas of the various documents to program our development board, let’s first take a closer look at the STM32CubeIDE we installed earlier. We will familiarize ourselves with its features and functionalities in the next section.