Embedded Computer Architecture

What a computer is used for, what tasks it must perform, and how it interacts with humans and other systems determine the functionality of the machine, and therefore its architecture, memory, and I/O.

An arbitrary desktop computer (not necessarily a PC) is shown in Figure 1-13. It has a large main memory to hold the operating system, applications, and data and an interface to mass storage devices (disks and DVD/CD-ROMs). It will have a variety of I/O devices for user input (keyboard, mouse, and audio), user output (display interface and audio), and connectivity (networking and peripherals). The fast processor requires a system manager to monitor its core temperature and supply voltages and to generate a system reset.

Large-scale embedded computers may also take the same form. For example, they may act as a network router or gateway and so will require one or more network interfaces, large memory, and fast operation. They may also require some form of user interface as part of their embedded application and, in many ways, may simply be a conventional computer dedicated to a specific task. Thus, in terms of hardware, many high-performance embedded systems are not that much different from a conventional desktop machine.

Block diagram of a generic computer

Figure 1-13. Block diagram of a generic computer

Smaller embedded systems use microcontrollers as their processor, with the advantage that this processor will incorporate much of the computer’s functionality on a single chip. An arbitrary embedded system, based on a generic microcontroller, is shown in Figure 1-14.

Block diagram of an embedded computer

Figure 1-14. Block diagram of an embedded computer

The microcontroller has, at a minimum, a CPU, a small amount of internal memory (ROM and/or RAM), and some form of I/O, which is implemented within a microcontroller as subsystem blocks. These subsystems provide the additional functionality for the processor and are common across many processors. The subsystems that you will typically find in microcontrollers will be discussed in the coming chapters. For the moment though, let’s take a quick tour and see the purposes for which they can be used.

The most common I/O is that of digital I/O. These are ports that may be configured by software, on a pin-by-pin basis, as either a digital input or digital output. As digital inputs, they may be used to read the state of switches or push buttons or to read the digital status of another device. As outputs, they may be used to turn external devices on or off or to convey status to an external device. For example, a digital output may be used to activate the control circuitry for a motor, to turn a light on or off, or perhaps to activate some other device such as a water valve for a garden-watering system. Used in combination, the digital inputs and outputs may be used to synthesize an interface and protocol to another chip. Most microcontrollers have other subsystems besides digital I/O but provide the ability to convert the other subsystems to general-purpose digital I/O, if the functionality of the other subsystems is not required. As a system designer, this gives you great versatility in how you use your microcontroller within your application.

Many microcontrollers also have analog inputs, allowing sensors to be sampled for monitoring or recording purposes. Thus, an embedded computer may measure light levels, temperature, vibration or acceleration, air or water pressure, humidity, or magnetic field, to name just some. Alternatively, the analog inputs may be used to monitor simple voltages, perhaps to ensure the reliable operation of a larger system.

Some microcontrollers have serial ports (covered in Chapter 10), which enable the embedded computer to be interfaced to a host computer, another embedded system, or perhaps a simple network. Specialized forms of serial interface, such as SPI and I2C (Chapter 9), provide a simple way of expanding the microcontroller’s functionality. They allow peripherals to be interfaced to the microcontroller, providing access to such devices as off-chip memories (for data or parameter storage), clock/calendar chips (for timekeeping), sensors with digital interfaces, external analog input or output, and even audio chips and other processors.

Most microcontrollers have timers and counters. These may be used to generate internal interrupts at regular intervals, for multitasking, to generate external triggers for off-chip systems, or to provide control pulses for motors. Alternatively, they may be used to count external triggers (pulses) from another system.

A few microcontrollers also include network interfaces such as USB (Chapter 10), Ethernet (Chapter 11), or CAN (Chapter 11).

Some of the larger microcontrollers also provide a bus interface, bringing the internal address, data, and control buses to the outside world. This allows the processor to be interfaced to a huge variety of possible peripherals, in very much the same way as a conventional processor. All of the possible devices and interfaces described previously may also be implemented through the bus interface and the appropriately chosen peripheral. A bus interface provides enormous potential.

The mix of I/O subsystems that microcontrollers may have varies considerably. Some microcontrollers are intended for simple digital control and may have only digital I/O. Others may be intended for industrial applications and may have digital I/O, analog input, motor control, and networking. The choice of microcontroller (and there are literally thousands of subspecies available from dozens of manufacturers) depends upon your processing needs and your interfacing requirements. Choose the one that best suits.

Chapter 2 covers the introductory electronics you need to know to start designing hardware. If you’re already comfortable with basic electronics, you can skip straight through to Chapter 3 and Chapter 4, where we’ll look at powering your embedded computers and the techniques used in designing microprocessor-based hardware.

Get Designing Embedded Hardware now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.