Chapter 3

The ARM Microcontrollers

Abstract

ARM architecture is currently one of the most commonly used CPU architectures, especially in mobile devices such as in mobile phones, tablets, and games consoles. ARM has been designing 32-bit processors for over 20 years and in the last few years they have also started to offer 64-bit designs. In actual fact ARM is a company specialized in designing the processor architecture and they do not manufacture or sell processor chips. ARM makes money by licensing their designs to chip manufacturers. The manufacturers use the core ARM processors (e.g., the core CPU) and integrate with their own peripherals to end up in a complete microcontroller chip. ARM is then given royalty fees for each chip manufactured by the third-party companies. Companies that use ARM core processors include Apple, Atmel, Broadcom, Cypress Semiconductors, Freescale Semiconductors, Analog Devices, Nvidia, NXP, Samsung Electronics, Texas Instruments, Qualcomm, Renesas, and many others. This chapter describes the basic architecture of the Cortex ARM processors and gives an example of microcontroller hardware development platforms that use the ARM architecture.

Keywords

ARM; ARM processor; ARM architecture; Thumb; CISC; RISC; Cortex-M; Cortex-R; Cortex-A; ARM performance

3.1 Overview

In this chapter we shall be looking briefly at the history and architecture of the ARM processors and ARM processor-based development boards.

3.2 Brief History of ARM Processors

The history of ARM processor is interesting. In 1981, the British Broadcasting Corporation (BBC) invited the computer firms to supply a computer to be used in educational projects. The Acorn Computers Ltd. was the winner and they developed a home computer based on the 8-bit microcontroller 6502, manufactured by the company MOS Technology. Although the 6502 was not a powerful microprocessor with today's standards, it was fast enough in those days and became very successful in the early 1980s.

The founders of the Acorn Computers Ltd. were Christopher Curry and Herman Hauser. Christopher used to work closely with Clive Sinclair of Sinclair Radionics Ltd. for over a decade. Sinclair had some financial troubles and later formed a new company called Sinclair Research Ltd. where Christopher was one of the main people in this new company. After a disagreement with Sinclair, Christopher left the company and formed the Acorn Computers Ltd with the Austrian physicist Herman Hauser.

During the early and late 1980s IBM produced their first PC based on the 16-bit microprocessor 8088. During these years IBM became very popular in the PC market with the early MSDOS operating system and many small competitors faded. The Acorn 6502 was only 8 bits and it was not powerful enough for graphics-based applications. During this time Acorn decided that they needed a new architecture with faster processor and they considered designing their own processor.

In 1990s Acorn came to the conclusion that their future lied not only in selling computers, but also in developing new computer architectures. Therefore, in 1990 Acorn Computers Ltd. established a new company called Advanced Reduced Instruction Set Computer (RISC) Machines Ltd. (ARM for short) as a joint venture with Apple Computer and VLSI Technology. In this venture, Apple invested by providing the cash, VLSI provided the necessary technology tools, and Acorn provided the experienced design engineers. By the year ARM became a £26.6 million company with net income of £2.9 million. In 1998 ARM, currently called ARM Holdings, was listed on the London Stock Exchange and NASDAQ. In later years ARM designed new processor architectures and sold the intellectual property rights as licenses to the firms who wished to incorporate ARM designs in their own products. In 2016 SoftBank bought ARM for $31 billion.

ARM has been designing 32-bit processors for over 20 years and in the last few years they have also started to offer 64-bit designs. In actual fact ARM is a company specialized in designing the processor architecture and they do not manufacture or sell processor chips. ARM makes money by licensing their designs to chip manufacturers. The manufacturers use the core ARM processors (e.g., the core CPU) and integrate with their own peripherals to end up in a complete microcontroller chip. ARM is then given royalty fees for each chip manufactured by the third-party companies. Companies that use ARM core processors include Apple, Atmel, Broadcom, Cypress Semiconductors, Freescale Semiconductors, Analog Devices, Nvidia, NXP, Samsung Electronics, Texas Instruments, Qualcomm, Renesas, and many others.

The ARM concept became so popular that in mobile applications in 2005, about 98% of all mobile phones sold used at least one ARM processor. In 2011, the 32-bit ARM architecture was the most widely used and most popular architecture used in mobile devices. Over 10 billion units were produces in 2013. The ARM architecture is known to offer the best MIPS to Watts ratio as well as MIPS to $ ratio in the industry, and the smallest CPU size.

Many ARM cores have been designed over the years, such as the ARMv1, ARMv2, …, ARMv8 and so on, ranging from 32-bits to 64-bits. The 32-bit ARMv7-A was the most widely used architecture in mobile devices in 2011. This includes architectures such as Cortex-A5, Cortex-A7, Cortex-A8, and so on. Lower performing cores have lower license fees than higher performing cores. The ARMv6-M and ARMv7E-M are used in lower performance microcontroller-based control and monitoring applications and these architectures include Cortex-M0, Cortex-M0 +, Cortex-M1, Cortex-M3, Cortex-M4, and Cortex-M7.

3.3 The ARM Processor Architecture

3.3.1 CICS and RISC

Basically there are two types computer designs as far as the CPU design is considered: Complex Instruction Set Computer (CISC) and RISC. Traditionally all CPU designs were based on CISC where the instruction set of these computers had many instructions. Many microprocessors, including the 6502 were based on CISC where some instructions were executed in one cycle and some others required several processor cycles to execute.

Most present day CPUs have limited instructions in their instructions sets and are therefore called RISC. ARM processors use RISC-based designs and this is one of the reasons that they are used widely, especially in mobile devices. Because of simpler designs the RISC processors use less number of transistors and therefore reduced power consumption. These processors execute one instruction per cycle and as a result these CPUs are fast, but they may need to execute more instructions for a given task. Normally, each instruction in a RISC-based design occupies one memory location. These instructions are fetched from the memory and are executed in one cycle each as fast as possible. RISC-based CPU designs also allow for several levels of pipelining where the next instructions are fetched from the memory while the current instruction is being executed, thus resulting in higher throughput. Also, because the RISC-based designs are simpler, they consume less power which is extremely important in battery operated mobile applications, such as in mobile phones, tablets, GPS systems, or games consoles. This is perhaps the major reason why the ARM architecture is widely used in mobile devices requiring very fast processing times as well as low power consumptions.

3.3.2 Why ARM?

The choice of a microcontroller for a particular application depends on many factors such as the following:

  •  cost
  •  speed
  •  power consumption
  •  size
  •  number of digital and analog input-output ports
  •  digital input-output port current capacity
  •  analog port resolution and accuracy
  •  program and data memory sizes
  •  interrupt support
  •  timer support
  •  USART support
  •  special bus support (e.g., USB, CAN, SPI, I2C, and so on)
  •  ease of system development (e.g., programming)
  •  working voltage

For example, if we need to develop a battery powered portable device such as a mobile phone, a tablet, or a games console then high clock speed as well as long battery life are the main requirements. But if on the other hand, for example, we wish to develop a liquid level control system or a heating control system then high speed or low power consumption are not among the desired requirements. In general, as the clock speed goes up so does the power consumption and as a result a trade-off should be made in choosing a microcontroller for a specific application.

ARM processors are based on an instruction set called Thumb. With clever design this instruction set takes 32-bit instructions and compresses them down to 16-bits, thus reduces the hardware size, which also reduces the overall cost and the power consumption. The processor makes use of multistage pipelined architecture that is easier to learn, build, and program.

ARM's core architecture is only a processor and it does not include graphics, input-output ports, USB, serial communication, wireless connectivity, or any other form of peripheral modules. Chip manufacturers build their systems around the ARM core design and this is why different manufacturers offer different types of ARM-based microcontrollers.

Over the last 20 years or so ARM had developed many 32-bit processors. Fig. 3.1 shows some of the popular members of the ARM processor family. Around 2003 ARM decided to improve their market share by developing new series of high-performance processors mainly for microcontroller-based applications, such as in embedded control and monitoring applications. As a result, the Cortex family or processors were created. The Cortex family consists of three processor families: Cortex-M, Cortex-R, and Cortex-A. We shall now briefly look at these families.

Fig. 3.1
Fig. 3.1 Overview of the ARM processor family.

Cortex-M

Cortex-M series are built around the ARMv6-M architecture (Cortex-M0 and Cortex-M0 +) and the ARMv7-M architecture (Cortex-M3 and Cortex-M4). These processors are specifically designed for the microcontroller market, offering quick and deterministic interrupt responses, low power consumption, low cost, fairly high performance, and ease of use. The Cortex-M3 and Cortex-M4 are very similar in architecture and have the same instruction sets (Thumb 2) with the difference that the Cortex-M4 offers digital signal processing (DSP) capabilities and has optional floating point unit (FPU). Cortex-M4 with its DSP and floating point capability is an ideal processor for the IoT and wearable applications. For cost sensitive and lower performance applications the Cortex-M0 or the Cortex-M0 + can be used. The Cortex-M0 processor has small gate count (12K gates) and consumes only 12.5 μW/MHz. The Cortex-M0 + consumes only 9.85 μW/MHz and is based on a subset of the Thumb 2 instruction set and its performance is slightly above that of Cortex-M0 and below that of the Cortex-M3 and Cortex-M4. Cortex-M7 is a high-performance processor that can handle fast DSP and single or double precision floating point operations and is mainly used in applications where higher performance than the Cortex-M4 is required. In this book we will be using a microcontroller development board based on the Cortex-M4 architecture.

Cortex-R

Cortex-R series are real-time higher performance processors than the Cortex-M and some members are designed to operate at high clock rates in excess of 1 GHz. These processors are commonly used in hard-disk controllers, network devices, automotive applications, and specialized in high-speed microcontroller applications. Cortex-R4 and Cortex-R5 are the early members and can be used at clock speeds of up to 600 MHz. Cortex-R7 is a newer member that incorporates 11-stage pipeline for high performance and it can operate in excess of 1 GHz. Although the Cortex-R processors are high performance, their architecture is complex and these processors consume high power, making them unsuitable for use in mobile battery powered devices.

Cortex-A

Cortex-A are the highest performance ARM processors designed for use with real-time operating systems in mobile applications such as in mobile phones, tablets, GPS devices, games consoles, and so on. These processors support advanced features for operating systems such as Android, ioS, Linux, Windows, etc. In addition, advanced memory management is supported with virtual memory. Early members of the family included processors such as Cortex-A5 to Cortex-A17, based on the ARMv7-A architecture. Latest members of the family are the Cortex-A50 and Cortex-A72 series designed for low-power and very high-performance mobile applications. These processors are built using the ARMv8-A architecture which offers 64-bit energy-efficient operation with the capabilities of more than 4 GB of physical memory.

3.3.3 Cortex-M Processor Comparison

A comparison of the various Cortex-M series processors is given in Table 3.1. As can be seen from this table, Cortex-M0 and Cortex-M0 + are used at low speed and low power consumption applications. Cortex-M1 is optimized for use in programmable gate array applications. Cortex-M3 and Cortex-M4 are medium-power processors used in microcontroller applications with the Cortex-M4 supporting DSP and floating point arithmetic operations. Cortex-M7 is a high-performance member of the family which is used in applications requiring higher performance than the Cortex-M4.

Table 3.1

Cortex-M Processor Comparison
ProcessorDescription
Cortex-M7High-performance processor, used in applications where Cortex-M4 is not fast enough, supports DSP and single and double precision arithmetic
Cortex-M4Similar architecture as the Cortex-M3 but includes DSP and floating point arithmetic, used in high-end microcontroller-type applications
Cortex-M3Very popular, low power consumption, medium performance, debug features, used in microcontroller-type applications
Cortex-M1Designed mainly for programmable gate array applications
Cortex-M0 +Lower power consumption and higher performance than the Cortex-M0
Cortex-M0Low power consumption, low to medium performance, smallest ARM processor

3.3.4 Processor Performance Measurement

Processor performance is usually measured using benchmark programs. There are many benchmark programs available and one should exercise care when comparing the performance of various processors as the performance depends on many external factors such as the efficiency of the compiler used and the type of operation performed for the measurement.

Many attempts were made in the past to measure the performance of a processor and quote it as a single number. For example, MOPS, MFLOPS, Dhrystone, DMIPS, BogoMIPS, and so on. Nowadays, CoreMark is one of the most commonly used benchmark programs used to indicate the processor performance. CoreMark is developed by Embedded Microprocessor Benchmark Consortium (EEMBC, www.eembc.org/coremark) and is one of the most reliable performance measurement tools available.

Table 3.2 shows the CoreMark results for some of the commonly used microcontrollers. As can be seen from this table, Cortex-M7 achieves 5.01 CoreMark/MHz, while the PIC18 microcontroller achieves only 0.04 CoreMark/MHz.

Table 3.2

CoreMark/MHz for Some Commonly Used Microcontrollers
ProcessorCoreMark/MHz
Cortex-M75.01
Cortex-A94.15
Cortex-M43.40
Cortex-M33.32
Cortex-M0 +2.49
Cortex-M02.33
dsPIC331.89
MSP4301.11
PIC241.88
PIC180.04

3.3.5 Cortex-M Compatibility

Processors in the Cortex family are upward compatible with each other. Cortex-M0 and Cortex-M0 + processors are based on the ARMv6-M architecture, using the Thumb instruction set. On the other hand, Cortex-M3, Cortex-M4, and Cortex-M7 are based on the ARMv7-M architecture, using the Thumb 2 instruction set which is a superset of the Thumb instruction set. Although the architectures are different, software developed on the Cortex-M0 and Cortex-M0 + processors can run on the Cortex-M3, Cortex-M4, and Cortex-M7 processors without any modifications provided the required memory and input-output ports are available.

3.3.6 The Cortex Core Architecture

Fig. 3.2 shows a simplified block diagram of the Cortex-M4 core architecture. Near the top left-hand side we can see the CPU which includes the ALU, register banks, instruction decoder, DSP module, and the memory interface. The DSP module is not available in the Cortex-M0 or Cortex-M3 cores. Notice that the memory is not part of the Cortex core and it is supplied by the company building the processor. The nested vectored interrupt controller is included at the top left corner of the figure. These are external interrupt inputs that can be used in interrupt-driven real-time applications. The core includes a FPU used to accelerate the floating point mathematical operations. The test and debug interface is shown at the bottom right-hand side of the figure. The bus matrix, memory protection unit, and peripheral interfaces are located at the bottom right hand-side of the figure. Notice that the core does not include the input-output ports.

Fig. 3.2
Fig. 3.2 Simplified block diagram of the Cortex core.

Fig. 3.3 shows a microcontroller built around the Cortex core. Notice that this figure includes input-output ports, memory, and so on.

Fig. 3.3
Fig. 3.3 Microcontroller built around Cortex core. Used with permission of Arm Holdings.

3.4 ARM Processor-Based Microcontroller Development Boards

There are many ARM processor-based development boards. In this section we are only interested in the Cortex-M-based development boards which are used in microcontroller-based control and monitoring applications and which are also mbed compatible. Some popular development boards are described in this section. Details of mbed compatible ARM boards can be obtained from the following web site:https://os.mbed.com/platforms/

3.4.1 LPC11U24

This is a 32-bit Cortex-M0-based development board (Fig. 3.4) having the following features:

  •  48 MHz clock
  •  8 KB RAM, 32 KB flash memory
  •  2 × SPI, I2C, UART, 6 × ADC, GPIO
  •  40-pin 0.1″ DIP package
  •  built-in USB flash programmer
Fig. 3.4
Fig. 3.4 LPC11U24 development board.

The development board is packaged in a small DIP form factor that can be used with a breadboard for quick development and testing.

3.4.2 LPC1768

This is a high-performance Cortex-M3-based development board (Fig. 3.5) having the following features:

  •  Cortex-M3 core
  •  96 MHz clock
  •  32 KB RAM, 512 KB flash memory
  •  Ethernet, 3 × SPI, 2 × I2C, 3 × UART, CAN, 6 × PWM, 6 × ADC, GPIO
  •  40-pin 0.1″ DIP package
  •  5 V USB supply
  •  Built-in USB flash programmer
Fig. 3.5
Fig. 3.5 LPC1768 development board.

This development board is similar to LPC11U24 but it is based on the high-performance Cortex-M3 core and includes more program and data memories.

3.4.3 EFM32 Zero Gecko Starter Kit

This is an ultralow-power 32-bit Cortex-M0 + core-based development board (Fig. 3.6). The board is ideal in applications requiring high performance and low-energy consumption. The basic features of this board are as follows:

  •  Cortex-M0 + core
  •  24 MHz clock
  •  4  KB RAM, 32 KB flash memory
  •  37 GPIO
  •  1.98–3.8 V power supply
  •  Ultralow current consumption (48 μA/MHz sleep mode)
  •  SPI, I2C, 2 × 16-bit timers
  •  2 × user buttons, 2 × LEDs
  •  2 × capacitive touch pads
Fig. 3.6
Fig. 3.6 EFM32 Zero Gecko starter kit.

3.4.4 Arch Pro

Arch Pro is based on a variant of the LPC1768 Cortex-M3 core. This development board (Fig. 3.7) has the following features:

  •  Cortex-M3 core
  •  100 MHz clock
  •  64 KB RAM, 512 KB flash memory
  •  4 × UART, 3 × I2C, 2 × SPI, Ethernet
  •  USB host/device
  •  Grove connectors
  •  Arduino form factor
Fig. 3.7
Fig. 3.7 Arch Pro development board.

The advantage of this development board is that it supports Grove connectors and Arduino form factor and therefore large number of Grove modules and Arduino shields can be connected to the board.

3.4.5 LPC4088

This is a 44-pin development board based on the high-performance Cortex-M4 core (Fig. 3.8). The features of this board are as follows:

  •  Cortex-M4 core
  •  120 MHz clock
  •  8 MB QSPI + 512 KB on-chip, 32 MB SDRAM, 96 KB SRAM, 4 KB E2PROM
  •  10/100 Mbps ethernet
  •  USB host/device interface
  •  XBee compatible connector
  •  2 × 22 pin edge connector
  •  4.5–5.5 V power supply, or power via micro-USB socket
Fig. 3.8
Fig. 3.8 LPC4088 development board.

3.4.6 LPC1769 LPCXpresso

This development board (Fig. 3.9) is based on 32-bit Cortex-M3 core and has the following features:

  •  120 MHz clock
  •  4 MHz internal RC oscillator
  •  64 KB RAM, 512 KB flash memory
  •  Ethernet
  •  USB device/host controller
  •  8-channel DMA
  •  4 × UART, 2 × CAN, 3 × SPI, 3 × I2C, I2S, 8 × ADC, DAC
  •  4 × timers, 6 × PWM, RTC, 70 GPIO
  •  Quadrature encoder interface
  •  Power management unit
  •  Reduced power modes
  •  Code read protection
  •  On board SWD/JTAG debugger
  •  3.15–3.3 V external power or power via USB port
Fig. 3.9
Fig. 3.9 LPC1769 LPCXpresso development board.

3.4.7 LPC1347 LPCXpresso

This development board (Fig. 3.10) is based on 32-bit Cortex-M3 core and has the following features:

  •  Cortex-M3 core
  •  72 MHz clock
  •  Low cost
  •  12 KB SRAM, 64 KB flash memory
  •  ADC, 4 × timers, 2 × SPI, I2C, USART
  •  USB bootloader
Fig. 3.10
Fig. 3.10 LPC1347 LPCXpresso development board.

The LPCXpresso boards are actually two separate boards, and the debugger (called the LPC-Link) can actually be separated from the LPC1347 MCU half. This is useful if you plan to use the debugger with other boards inside the LPCXpresso IDE.

3.4.8 u-blox C027

This development board (Fig. 3.11) is based on Cortex-M3 core and has the following features:

  •  Cortex-M3 core
  •  96 MHz clock
  •  32 KB SRAM, 512 KB flash memory
  •  6 × analog inputs
  •  9 × PWM capable outputs
  •  22 × GPIOs
  •  1 × SPI
  •  1 × I2C
  •  1 × UART
  •  1 × I2S
  •  Ethernet, CAN
  •  SIM card holder
  •  GNSS antenna SMA connector
  •  Cellular antenna SMA connector
  •  MAX-M8Q GPS/GNSS receiver
  •  LISA or SARA cellular module
Fig. 3.11
Fig. 3.11 u-blox C027 development board.

3.4.9 Teensy 3.1

This development board (Fig. 3.12) is based on Cortex-M4 and has the following features:

  •  Cortex-M4 core
  •  96 MHz clock
  •  64 KB RAM, 256 KB flash, 2 KB EEPROM memory
  •  34 × GPIO
  •  21 × analog inputs, 1 × analog output
  •  2 × converters, 3 × comparators
  •  12 × timers
  •  3 × UART, SPI, 2 × I2C, CAN, I2S
  •  USB host
  •  RTC
Fig. 3.12
Fig. 3.12 Teensy 3.1 development board.

3.4.10 DISCO-F334C8

This development board (Fig. 3.13) is based on Cortex-M4 core and has the following features:

  •  Cortex-M4 core
  •  72 MHz clock
  •  16 KB SRAM, 64 KB flash memory
  •  37 × GPIO
  •  2 × analog inputs
  •  3 × analog outputs
  •  3 × USART, I2C, SPI, CAN
  •  9 × timers
  •  2 × watchdog timers, 3 × analog comparators, operational amplifier
  •  On board debugger/programmer
  •  4 × user LEDs, 2 × push-buttons
Fig. 3.13
Fig. 3.13 DISCO-F334C8 development board.

3.4.11 STM32 Nucleo Board Family

STM32 Nucleo boards are high-performance mbed compatible ARM core-based development boards manufactured by STMicroelectronics. The family includes large number of low-cost development boards with different processing powers and power consumption levels to suit all types of applications. In this book, we shall be using the Nucleo-F411RE development board in our projects. We shall be looking at the details of this development board in great detail in the next chapter. It is worthwhile to look at the features of this board here briefly. Fig. 3.14 shows the Nucleo-F411RE development board. Its basic features are:

  •  Cortex-M4 core
  •  STM32 microcontroller in LQFP64 package
  •  1 user LED
  •  1 user and 1 reset push-buttons
  •  32.768 kHz LSE crystal oscillator
  •  Board expansion connectors:
    •  Arduino Uno V3
    •  ST morpho extension pin headers
  •  Flexible power-supply options: ST-LINK USB VBUS or external sources
  •  On-board ST-LINK/V2-1 debugger/programmer
  •  Support for Mbed
Fig. 3.14
Fig. 3.14 Nucleo-F411RE development board.

3.5 Summary

In this chapter we have learned about the following:

  •  History of the ARM processors
  •  CISC and RISC-type computers
  •  The architecture of the ARM processors
  •  Some popular Cortex-M development boards

3.6 Exercises

  1. 1. Describe the differences between the CISC- and RISC-type computers.
  2. 2. Which company gives licenses for the ARM core processors?
  3. 3. Explain the differences between Cortex-M and Cortex-A-type core processors.
  4. 4. What type of ARM core processors are commonly used in mobile phones?
  5. 5. Which Cortex processors have built-in DSP modules? Where can the DSP modules be used?
  6. 6. What type of ARM core processor will be used in the projects in this book?
  7. 7. Which ARM-based development board will be used in the projects in this book?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
44.200.77.92