Embedded Systems in Electronic Engineering

Embedded Systems in Electronic Engineering

Author | Sensor Technology (WW_CGQJS)

With the acceleration of the upgrade of traditional industrial structures in our country, the increasing application demands for equipment can no longer meet the current and future high-performance application and development needs. At the same time, fierce market competition and technological competition require shorter product development cycles. Clearly, the software and hardware technologies and development methods of embedded systems are increasingly valued and have become an important foundation for technological innovation in various fields.

Embedded Systems in Electronic Engineering

Embedded Systems

According to the definition by IEEE (Institute of Electrical and Electronics Engineers), an embedded system is a device that “controls, monitors, or assists the operation of equipment, machines, and workshops.”

A commonly accepted definition in China is: an application-centered, computer technology-based, software and hardware customizable, dedicated computer system that meets the strict requirements of application systems for functionality, reliability, cost, size, and power consumption.

Unlike general computer systems, embedded systems are a type of computer system that does not appear in the physical form of an independent device. The components of embedded systems are embedded within the main device according to the needs of the main device and its applications, performing computation, processing, storage, and control functions. They are “devices used to control, monitor, or assist in the operation of machines and equipment.”

It can be understood that an embedded system is a dedicated computer system that is part of a device or equipment. An embedded system generally consists of four parts: an embedded microprocessor, peripheral hardware devices, an embedded operating system, and user application programs. The three basic elements of embedded systems are “embeddedness,” “dedicated nature,” and “computer system,” while the object system refers to the host system into which the embedded system is embedded.

Components of Embedded Systems

Embedded systems typically consist of an embedded computer system that includes an embedded processor, embedded operating system, application software, and peripheral device interfaces, along with execution devices (controlled objects). The embedded computer system is the core of the entire embedded system and can be divided into hardware layer, intermediate layer, system software layer, and application software layer. The execution device receives control commands issued by the embedded computer system and performs the specified operations or tasks.

Embedded Systems in Electronic Engineering

1. Hardware Layer of Embedded Computer Systems

The hardware layer includes embedded microprocessors, memory (SDRAM, ROM, Flash, etc.), general device interfaces, and I/O interfaces (A/D, D/A, I/O, etc.). The hardware layer is typically a circuit module centered around the embedded processor, containing power circuits, clock circuits, and memory circuits, where the operating system and application programs are stored in the module’s ROM.

1.1 Embedded Microprocessor

Embedded Systems in Electronic Engineering

The embedded microprocessor is the core of the hardware layer of embedded systems. It integrates many tasks that would typically be handled by circuit boards into the chip, facilitating system design towards miniaturization, high efficiency, and high reliability. Most embedded microprocessors operate in systems specifically designed for particular user groups. The architecture of embedded microprocessors can adopt either the Von Neumann architecture or the Harvard architecture, and the instruction set can be either Reduced Instruction Set Computer (RISC) or Complex Instruction Set Computer (CISC).

There are various architectures for embedded microprocessors, with over 1000 types available worldwide, and more than 30 series of architectures, including mainstream architectures like ARM, MIPS, PowerPC, and X86. Even within the same architecture, there can be different clock frequencies, data bus widths, interfaces, and peripherals. Currently, no single embedded microprocessor dominates the market; the choice of embedded microprocessor is determined by specific applications.

1.2 Memory

The memory of embedded systems includes Cache, main memory, and auxiliary storage, used to store and execute code.

Embedded Systems in Electronic Engineering

① Cache is a fast memory array located between the main memory and the embedded microprocessor core, storing the program code and data that the microprocessor has used most frequently in recent times.

Cache is generally integrated within the embedded microprocessor and can be divided into data Cache, instruction Cache, or mixed Cache, with the storage capacity varying depending on the processor.

② Main memory is used to store system and user programs and data, and is the memory that the embedded microprocessor can access directly. Main memory includes ROM and RAM, which can be located either inside or outside the microprocessor. Common types of ROM include NOR Flash, EPROM, and PROM, while RAM types include SRAM, DRAM, and SDRAM, with capacities ranging from 256KB to 1GB.

③ Auxiliary storage typically refers to hard drives, NAND Flash, CF cards, MMC, and SD cards, used to store large amounts of program code or information, generally with larger capacities but slower read speeds compared to main memory.

1.3 General Device Interfaces and I/O Interfaces

Embedded systems typically have general device interfaces required for interaction with the outside world, such as GPIO, A/D (analog-to-digital conversion interface), D/A (digital-to-analog conversion interface), RS-232 interface (serial communication interface), Ethernet (network interface), USB (universal serial bus interface), audio interfaces, VGA video output interfaces, I2C (field bus), SPI (serial peripheral interface), and IrDA (infrared interface), etc.

2. Intermediate Layer

The intermediate layer, also known as the Hardware Abstract Layer (HAL) or Board Support Package (BSP), is located between the hardware layer and the software layer, separating the upper software from the lower hardware.

BSP serves as the interface between upper software and hardware platforms, providing methods for the operating system to operate and control specific hardware. Different operating systems have their own software hierarchy, and BSP needs to provide specific hardware interface forms for different operating systems. BSP allows upper software developers to develop without concerning themselves with the specifics of the lower hardware, using the interfaces provided by the BSP layer.

BSP is a software layer that exists between the operating system and the underlying hardware, including most software modules closely related to hardware in the system. BSP generally includes functions such as initialization of related lower-level hardware, input/output operations, and configuration of hardware devices.

2.1 Hardware Initialization of Embedded Systems

The system initialization process can be divided into three main stages: chip-level initialization, board-level initialization, and system-level initialization, in a bottom-up order from hardware to software.

① Chip-level initialization is a purely hardware initialization process, including setting the core registers and control registers of the embedded microprocessor, the core operating mode of the embedded microprocessor, and the local bus mode of the embedded microprocessor.

② Board-level initialization is an initialization process that includes both software and hardware, completing the initialization of other hardware devices outside the embedded microprocessor, setting certain software data structures and parameters, and establishing the hardware and software environment for subsequent system-level initialization and application program execution.

③ System-level initialization mainly involves the initialization of the operating system. BSP transfers control of the embedded microprocessor to the embedded operating system, which completes the remaining initialization operations. Finally, the operating system creates the application program environment and hands over control to the entry point of the application program.

2.2 Hardware-Related Device Drivers

BSP includes hardware-related device drivers, but these device drivers are usually not directly used by BSP. Instead, during the system initialization process, BSP associates them with the general device drivers in the operating system, which are then called by the general device drivers in subsequent applications to operate the hardware devices.

3. System Software Layer

The system software layer typically includes an Embedded Operating System (EOS), file system, network system, and general component modules.

3.1 Embedded Operating System

EOS not only possesses the basic functions of general operating systems such as task scheduling, synchronization mechanisms, interrupt handling, and file processing, but also has the following characteristics:

  • Strong real-time performance;

  • Support for open and scalable architecture, with customizability;

  • Provides a unified device driver interface;

  • Supports TCP/IP and other protocols, providing TCP/UDP/IP/PPP protocol support and a unified MAC access layer interface, offering powerful network functionality;

  • The user interface of the embedded operating system provides services to user programs through system call commands;

  • Once the embedded system starts running, it does not require excessive user intervention;

  • The embedded operating system and application software are stored in the ROM of the embedded system computer;

  • Good hardware adaptability (portability).

3.2 File System

The embedded file system mainly provides functions for file storage, retrieval, and updating. It typically supports several standard file systems such as FAT32, JFFS2, and YAFFS, and some embedded file systems also support custom real-time file systems.

The embedded file system provides various file operations through system calls and commands, such as setting and modifying access permissions for files and directories, providing services for creating, modifying, changing, and deleting directories, and creating, opening, reading, writing, closing, and revoking files.

4. Application Software Layer

The application software layer is used to implement control functions for the controlled objects, consisting of developed application programs aimed at controlled objects and users.

Embedded Real-Time Operating Systems

RTOS differs from general computer systems in that it requires tasks in the system not only to produce correct results but also to complete them within certain time constraints (Deadlines). In an RTOS, a logically correct computation result is considered incorrect if it is produced later than a specified time.

Embedded Systems in Electronic Engineering

1. Definition of Real-Time Systems (RTOS)

RTOS refers to systems that can complete system functions and respond to external or internal, synchronous or asynchronous events within specified or determined times, capable of processing and storing large amounts of data required by control systems. The correctness of RTOS depends not only on the logical results of system calculations but also on the timing of producing those results.

2. Characteristics of RTOS

2.1 Constraints

RTOS tasks have constraints including time constraints, resource constraints, execution order constraints, and performance constraints.

RTOS tasks have time constraints, which can be divided into “hard real-time” and “soft real-time.”

Resource constraints refer to the need for multiple real-time tasks sharing limited resources to synchronize according to certain resource access control protocols to avoid deadlocks and unpredictable priority inversion times (i.e., the time when high-priority tasks are blocked by low-priority tasks).

Performance constraints refer to the need to meet performance indicators such as reliability, availability, predictability, and Quality of Service (QoS).

2.2 Predictability

Predictability means that the execution time required for RTOS to complete real-time tasks should be known.

2.3 Reliability

Most RTOS require high reliability, ensuring that the system can operate normally or avoid losses even in the worst-case scenarios. Reliability is an important performance indicator for RTOS.

4. Interactivity

The external environment is an indispensable component of RTOS, often being the controlled subsystems, and their interaction forms a complete real-time system.

3. RTOS Scheduling

The entire process of determining when and where each task is executed, given a set of real-time tasks and system resources, is called scheduling. The goal of scheduling in RTOS is to ensure that each task meets its time constraints and responds promptly to external requests.

4. Classification of RTOS

RTOS is mainly divided into two categories: hard real-time systems and soft real-time systems. Hard real-time systems are used in fields such as aerospace, military, and nuclear industries, while soft real-time systems are used in applications like video-on-demand systems and information collection and retrieval systems.

Architecture of Embedded Microprocessors

1. Von Neumann Architecture and Harvard Architecture

1.1 Von Neumann Architecture

A computer based on Von Neumann architecture consists of a CPU and memory, where programs and data share a common storage space. The addresses for program instructions and data point to different physical locations in the same memory; it uses a single address and data bus, with the same width for program instructions and data. The program counter (PC) is a register within the CPU that indicates the storage locations of instructions and data.

The CPU addresses memory using the address information provided by the program counter to find the required instructions or data, then decodes the instructions and finally executes the operations specified by the instructions. Even a single instruction can take several or even dozens of cycles to execute, leading to bottlenecks in the transmission channel during high-speed computations.

CPUs and microcontrollers using Von Neumann architecture include Intel’s 8086 series and other CPUs, ARM’s ARM7, MIPS’s MIPS processors, etc.

1.2 Harvard Architecture

The main feature of Harvard architecture is that programs and data are stored in separate storage spaces, meaning that program memory and data memory are two independent memories, each with its own addressing and access. The system has separate data and address buses for programs and data.

This separation of program and data buses allows for simultaneous fetching of instruction words (from program memory) and operands (from data memory) within a single machine cycle, thereby improving execution speed and data throughput. Since program and data memories are in two separate physical spaces, instruction fetching and execution can completely overlap, resulting in higher execution efficiency.

Currently, many CPUs and microcontrollers use Harvard architecture, including Motorola’s MC68 series, Zilog’s Z8 series, ATMEL’s AVR series, and ARM’s ARM9, ARM10, and ARM11.

2. Reduced Instruction Set Computer (RISC)

Early computers used Complex Instruction Set Computer (CISC) architecture. In CISC, many complex instructions were added to support optimization of target programs, high-level languages, and compilers, leading to very irregular control logic and significant difficulties for VLSI technology.

RISC architecture was developed based on CISC, focusing not just on simplifying the instruction set but on making the computer’s structure simpler and more rational, thereby improving computational efficiency.

RISC uses Load/Store instructions to access memory, with other operations performed between registers; it increases the number of general-purpose registers, with operands for arithmetic logic operations stored in general-purpose registers; most instructions are controlled to complete in one or fewer machine cycles; it primarily uses hardwired control logic, minimizing or eliminating microcode control; and it emphasizes high-level language programming and compiler optimization to reduce program execution time.

3. Pipelining Technology

Pipelining technology is applied in various aspects of computer system architecture, breaking down a repetitive timing sequence into several subprocesses, each of which can effectively execute simultaneously with other subprocesses in its dedicated functional segment. The time required to achieve the functionality of subprocesses should be as equal as possible. Forming a pipeline requires a preparation time. If the instruction flow cannot be executed sequentially, it will interrupt the pipeline process, and re-establishing the pipeline will take time.

4. Byte Order of Information Storage

4.1 Big-endian and Little-endian Storage Methods

For multi-byte data types, there are two storage methods in memory. Little-endian storage method stores low-byte data at lower memory addresses and high-byte data at higher memory addresses;

Big-endian storage method stores high-byte data at lower memory addresses and low-byte data at higher memory addresses.

4.2 Portability Issues

When porting programs between microprocessors with different storage orders, special attention must be paid to the impact of storage patterns. Writing binary data obtained from software into a general data format often involves issues related to storage order.

4.3 Storage Order Issues in Communication

In network communication, the Internet Protocol (IP) defines a standard network byte order. This byte order is used for all data packets, high-level protocols, and file formats designed to use the IP protocol. Many network devices also have storage order issues: bits within bytes may be sent using big-endian (most significant bit first) or little-endian (least significant bit first) methods, depending on the data link layer of the OSI model.

4.4 Storage Order of Data Formats

Types of Embedded Processors

1. Embedded Microcontrollers (MCU)

Also known as microcontrollers, these chips integrate ROM, EPROM, RAM, buses, bus logic, timers/counters, watchdogs, I/O, serial ports, PWM outputs, A/D, D/A, Flash, EEPROM, and other necessary functions and peripherals.

Embedded microcontrollers are characterized by their single-chip design, small size, low power consumption, low cost, and high reliability, accounting for about 70% of the embedded systems market share.

Embedded Systems in Electronic Engineering

2. Embedded Microprocessors (MPU)

Developed from CPUs in general computers, embedded microprocessors retain only the hardware functions closely related to embedded applications, removing other redundant functional parts to meet the special requirements of embedded applications with minimal power consumption and resources.

Embedded Systems in Electronic Engineering

3. Embedded DSP

Embedded DSPs are processors specifically designed for signal processing, with special designs in system architecture and instruction algorithms, offering high compilation efficiency and instruction execution speed.

Embedded Systems in Electronic Engineering

4. Embedded System on Chip (SoC)

SoC, or System on Chip, is defined as a complete computer system integrated on a single chip based on intellectual property cores, including processors, memory, various interfaces, and other components to perform specific application functions.

Currently, most 32-bit embedded processor chips are SoCs. Embedded SoCs aim to be the most inclusive integrated devices, with the vast majority of system components contained within a single system chip.

5. Multi-core Processors

Multi-core processors package two or more CPU cores within a single chip, saving a significant amount of transistors and packaging costs while significantly improving processor performance. They enable coordination between two or more cores.

Embedded Systems in Electronic Engineering

History of Embedded Systems

1. Systems based on single-chip programmable controllers. Generally, these systems do not have operating system support and are directly controlled through assembly language.

In the 1970s, the first microprocessor, Intel 4004, was released in November 1971, marking a significant milestone in the development of embedded applications.

2. Embedded systems based on embedded CPUs with simple operating systems.

These systems have support from simple operating systems but are less versatile.

In the 1980s, microcontrollers emerged—Intel further improved the 8048 and developed the 8051 microcontroller based on it, leading to faster advancements in DSP products and the technology level of embedded systems.

In 1981, the first commercial embedded real-time kernel (VTRX32) was introduced, followed by the emergence of several embedded operating systems.

3. Embedded systems characterized by embedded operating systems.

These systems have good compatibility.

From the 1990s to the present, developments in hardware, especially in chips, have shown three characteristics:

In software, embedded operating systems have further diversified, giving rise to several families of embedded operating systems.

Cross-platform software development technology has extended from general computers to embedded devices.

4. Embedded systems characterized by the Internet.

These systems are integrated with the Internet.

Embedded controllers are ubiquitous in applications: mobile phones, home appliances, automobiles… Their small size, high reliability, strong functionality, and flexibility have led to their deep integration into various fields such as industry, agriculture, education, national defense, scientific research, and daily life, playing an extremely important role in technological transformation, product upgrades, accelerating automation processes, and improving productivity across various industries. Since the 1990s, embedded technology has fully unfolded, becoming a common development direction for communication products and consumer products, widely applied in communication and broadcasting fields. In the personal domain, embedded products are primarily for personal commercial use, becoming popular as personal mobile data processing and communication software. The development space for embedded system technology is immense.

Further Reading:

  1. Comprehensive Collection of Sensor Principles

  2. Comprehensive Collection of Sensor Application Scenarios

Click the blue text link above to read the article.

Embedded Systems in Electronic Engineering

Embedded Systems in Electronic Engineering

Embedded Systems in Electronic Engineering

Leave a Comment