Overview of Embedded Systems
Overview of Embedded Systems
A system is a way of working, organizing or doing one or many tasks according to a fixed plan,
program, or set of rules. A system is also an arrangement in which all its units assemble and work
together according to the plan or program.
Consider a watch. It is a time-display system. Its parts are its hardware, needles and battery with
the beautiful dial, chassis and strap. These parts organize to show the real-time every second and
continuously update the time every second. The system-program updates the display using three
needles after each second. It follows a set of rules. Some of these rules are as follows: (i) All
needles move only clockwise. (ii) A thin and long needle rotates every second such that it returns
to the same position after a minute. (iii) A long needle rotates every minute such that it returns to
the same position after an hour. (iv) A short needle rotates every hour such that it returns to the
same position after twelve hours. (v) All three needles return to the same inclination after twelve
hours each day.
Embedded System
Embedded systems have been defined in books published recently in several ways. Given below
is a series of definitions from others in the field:
Wayne Wolf, author of Computers as Components - Principles of Embedded Computing System
Design:
"What is an embedded computing system? Loosely defined, it is any device that includes a
programmable computer but is not intended to be a general-purpose computer" and a fax machine
or a clock built from a microprocessor in an embedded system computing”.
Tim Wilmshurst, author of An Introduction to the Design of Small-Scale Embedded Systems, with
examples from PIC, 80C51, and 68HC05/08 microcontrollers:
1. “An embedded system is a system whose principal function is not computational, but which
is controlled by a computer embedded within it. The computer is likely to be a
microprocessor or microcontroller. The word embedded implies that it lies inside the
overall system, hidden from view, forming an integral part of {the} greater whole.”
2. “An embedded system is a microcontroller-based, software-driven, reliable, real-time
control system, autonomous, or human- or network-interactive, operating on diverse
physical variables and in diverse environments, and sold into a competitive and cost-
conscious market.”
1. A microprocessor
2. A large memory of the following two kinds:
o (a) Primary memory (semiconductor memories: Random Access Memory (RAM),
Read Only Memory (ROM), and fast-accessible caches)
o (b) Secondary memory (magnetic memory located in hard disks, diskettes, and
cartridge tapes; optical memory in CD-ROMs or memory sticks in mobile
computers) used for loading different user programs into the primary memory and
running them.
3. I/O units such as touch screens, modems, fax-modems, etc.
4. Input units such as keyboards, mice, digitizers, scanners, etc.
5. Output units such as LCD screens, video monitors, printers, etc.
6. Networking units such as Ethernet cards, front-end processor-based servers, bus drivers,
etc.
7. An operating system (OS) that has general-purpose user and application software in the
secondary memory.
An embedded system is a system that has three main components embedded into it:
1. It embeds hardware similar to a computer. (Figure 1.1 shows the hardware units of an
embedded system.) Its software is usually embedded in the ROM or flash memory, so it
does not typically need a secondary hard disk or CD memory as in a computer.
2. It embeds main application software, which may concurrently perform a series of tasks,
processes, or threads.
3. It embeds a real-time operating system (RTOS), which supervises the application
software running on hardware and organizes resource access based on the priorities of tasks
in the system. It provides mechanisms for the processor to run processes as scheduled and
to context-switch between various processes. A small-scale embedded system may not
include an RTOS.
Characteristics:
An embedded system is characterized by the following:
1. Real-time and multirate operations, which define how the system works, reacts to
events, and schedules its functions in real-time. It follows a plan to control latencies and
meet deadlines. (Latency refers to the waiting period between running the codes of a task
or interrupt service routine and the instance).
The different operations takes place at distinct rates. For example, audio, video, data, network
stream and events have different rates and time constraints. (2) Complex algorithms. (3)
Complex graphic user interfaces (GUIS) and other user interfaces. (4) Dedicated functions.
Constraints An embedded system is designed keeping in view three constraints: (1) available
system- memory, (2) available processor speed, (3) the need to limit power dissipation when
running the system continuously in cycles of 'wait for events', 'run', 'stop', 'wake-up' and 'sleep'.
The system design or an embedded system has constraints with regard to performance, power,
size and design and manufacturing costs.
A processor is an important unit in the embedded system hardware. It is the heart of the
embedded system. Knowledge of basic concept of microprocessors and microcontrollers is
must for an embedded system designer. A reader may refer to a standard text or the texts listed
in the 'References' at the end of this book for an in- depth understanding of microprocessors,
microcontrollers and DSPs that are incorporated in embedded system design. Chapter 2 will
explain 8051 and a few processors.
A processor has two essential units: Program Flow Control Unit (CU) and Execution Unit
(EU). The CU includes a fetch unit for fetching instructions from the memory. The EU has
circuits that implement the instructions pertaining to data transfer operations and data
conversion from one form to another. The EU includes the Arithmetic and Logical Unit (ALU)
and also the circuits that execute instructions for a program
control task, say, halt, interrupt, or jump to another set of instructions. It can also execute
instructions for a call or branch to another program and for a call to a function.
A processor runs the cycles of fetch-and-execute. The instructions, defined in the processor
instruction set, are executed in the sequence that they are fetched from the memory. A
processor is in the form of an IC chip; alternatively, it could be in core form in an Application
Specific Integrated Circuit (ASIC) or System on Chip (SoC). Core means a part of the
functional circuit on the Very Large Scale Integrated (VLSI) chip.
(a) Microprocessor.
(a) Microcontroller
4. GPP or ASIP cores integrated into either an ASIC or a VLSI circuit or a Field Programmable
Gate Array (FPGA) core integrated with processor units in a VLSI (ASIC) chip
For a system designer, the following are important considerations when selecting a processor:
1. Instruction set
3. Clock frequency in MHz and processing speed in Million Instructions Per Second (MIPS)
or in an alternate metric Dhrystone for measuring processing performance [Section 2.6]
4. Processor ability to solve complex algorithms while meeting deadlines for their processing
A microprocessor or GPP is used because: (i) processing based on the instructions available in
a predefined general-purpose instruction set results in quick system development. (ii) Once the
board and I/O interfaces are designed for a GPP, these can be used for a new system by just
changing the embedded software in the ROM. (iii) Ready availability of a compiler facilitates
embedded software development in high-level languages. (iv) Ready availability of well-tested
and debugged processor-specific APIs (Application Program Interfaces) and codes previously
designed for other applications results in new systems developed quickly.
Microprocessor
The CPU is a unit that centrally fetches and processes a set of general-purpose instructions.
The CPU instruction set includes instructions for data transfer operations, ALU operations,
stack operations, IO operations and program control, sequencing and supervising operations.
The general-purpose instruction set is always specific to a specific CPU. Any CPU must
possess the following basic functional units:
1. A control unit that fetches and controls the sequential processing of a given command or
instruction and communicates with the rest of the system.
2. An ALU that undertakes arithmetic and logical operations on bytes or words. It may be
capable of processing 8, 16, 32 or 64-bit words at an instant.
A microprocessor is a single VLSI chip that has a CPU and may also have some other units
(e.g., caches, floating point processing arithmetic unit, pipelining and superscaling units) that
are additionally present and that result in faster processing of instructions.
Intel 80x86 (also referred as x86) processors are the 32-bit successors of 8086. [The x here
refers to an 8086 extended for 32 bits.] Examples of 32-bit processors in 80x86 series are Intel
80386, 80486 and Pentiums (a new generation of 32- and 64-bit microprocessors is the classic
Pentium series). IBM PCs use 80x86 series and the embedded systems incorporated inside the
PC for specific tasks (like graphic accelerator, disk controllers, network interface card) use
these microprocessors.
High performance processors have pipeline and superscalar architecture, fast ALUS and
Floating-Point Processing Units (FLPUs). [A pipeline architecture means that the instructions
have between 3 and 9 stages. Different instructions are at different stages of the pipeline at any
given instance. A superscalar architecture refers to two or more sets of instructions executing
in parallel pipelines.]
The important microprocessors used in the embedded systems are ARM, 68HCxxx, 80x86 and
SPARC family of microprocessors.
Microcontroller
A microcontroller is an integrated chip that has processor, memory and several other hardware
units in it; these form the microcomputer part of the embedded system. Figure 1.2 shows the
functional circuits present (in solid boundary boxes) in a microcontroller. It also shows the
application-specific units (in dashed boundary boxes) in a specific version of a given
microcontroller family.
A few of the latest microcontrollers also have dual core and high computational and superscalar
processing capabilities. Important microcontroller chips for embedded systems are 8051,
8051MX, 68HC11xx, HC12xx, HC16xx, PIC 16F84 or 16C76, 16F876 and PIC18,
microcontroller enhancements of ARM9/ARM7 from ARM, Intel, Philips, Samsung and ST
microelectronics.
Figure 1.3 shows commonly used microcontrollers in small-, medium- and large-scale embedded
systems. Choosing a microcontroller as a processing unit depends upon the application-specific
features in it.
A microcontroller is used when a small or part of the embedded software has to be located in the
internal memory and when on-chip functional units such as the interrupt-handler, port, timer, ADC,
PWM and CAN controller are required.
Single Purpose Processors
Single purpose processors used in embedded systems include:
1. Coprocessor (for example, for floating point processing).
2. Graphics processor: An image consists of a number of pixels. For example, Quarter common
intermediate format-Quarter-CIF images have 144 x 176 (horizontal x-axis x vertical y-axis)
pixels. Video frames have 525 x 625 pixels. The video graphic adapter (VGA) format of e-mailing
and web pages has 640x480=307,200 pixels. A separate graphics processor is required for
functions such as, for example, gaming, display from graphics memory buffers and to move
(translate on screen) and rotate an image or its segments.
3. Pixel coprocessor: High-resolution pictures have formats: 2592 x 1944 pixels = 5,038,848
pixels; 2592 x 1728 3.2 M; 2048 x 1536 = 3 M and 1280 x 960 1 M. A pixel coprocessor is required
in digital cameras for displaying images directly or after operations such as rotate right, rotate-left,
rotate- up, rotate-down, shift to next, shift to previous.
4. Encryption engine: A suitable algorithm runs in this processor to encrypt data for secure
transmission.
5. Decryption engine: A suitable algorithm runs in this processor to decrypt the encrypted data at
receiver's end.
6. A discrete cosine transformation (DCT) and inverse transformation (DCIT) processor is required
in speech and video processing.
7. Protocol stack processor: A protocol stack, which has a number of header words, is prepared
before an application data is sent to a network. At the receiver's end, the protocol stack is received
and application data is accepted accordingly. A TCP/IP protocol stack processor processes TCP/IP
network data.
8. Network processor: A network processor's functions are to establish a connection, finish, send
and receive acknowledgements, send and receive retransmission requests and check and correct
received data frame errors. The network processor's functions include all protocol stack-processing
functions.
9. Accelerator (for example, Java codes accelerator). The accelerator is a coprocessor that
accelerates computations by taking advance actions that are just-in-time compilations of the next
object in Java programs.
10. CODEC (Coder and Decoder): A CODEC is a processor circuit that encodes input and decodes
the encoded information or bits or signals into a complete set of bits or original signal. Voice,
speech, image, video signals and bits are encoded for storing or transmission and decoded from
the stored or received bits or signal for display or playing. The CODEC functions as a compression
and decompression unit for voice, speech, image or video signals.
11. JPEG CODEC: This is a processor for jpg compression and decompression. The Joint
Photographic Experts Group (JPEG) is an International Telecommunication Union for Telecom
(ITU-T) and International Standards Organization (ISO) committee.
12. MPEG CODEC: The Motion Pictures Experts Group (MPEG) recommends CODEC standards
for video. MPEG3 CODEC is a processor for mp3 compression and decompression. MPEG 2 or
3 or 4 compression of audio/video data streams is done before storing or transmitting, and
decompression is done before retrieving or playing files. For MPEG compression and
decompression algorithms, if GPP-embedded software is run, then separate DSPs are required to
achieve real-time processing. 13. Controller (e.g., for peripheral, direct memory access or bus).
Single purpose processors are used for specific applications or computations or as controllers for
peripherals, direct memory accesses and buses.
EMBEDDED HARDWARE UNITS AND DEVICES IN A SYSTEM
Power Source
Most systems have a power supply of their own. The Network Interface Card (NIC) and Graphic
Accelerator are examples of embedded systems that do not have their own power supply and
connect to PC power- supply lines. The supply has a specific operation range or a range of voltages.
Various units in an embedded system operate in one of the following four power ranges: 5.0
V±0.25 V, 3.3 V±0.3 V, 2.0 V±0.2 V and 1.5 V+0.2 V. There is generally an inverse relationship
between propagation delay in the gates and operational voltage. Therefore, the 5 V system
processor and units are used in most high-performance systems.
Certain systems do not have a power source of their own: they connect to external power supply
or are powered by the use of charge pumps (made up of a circuit of diode and capacitor that
accumulate charge from the bus signals through which they connect or network to the host or from
wireless radiation).
Low voltage operations
1. In portable or hand-held devices such as a cellular phone [when compared to 5 V, a CMOS 2 V
circuit power dissipation reduces by one-sixth, ~ (2 V/5 V)2. This also increases the time intervals
needed for recharging a battery by a factor of six.].
2. In a system with smaller overall geometry, low voltage system processors and IO circuits
generate lesser heat and thus can be packed into a smaller space.
A power supply source or a charge pump is essential in every system.
Clock Oscillator Circuit and Clocking Units
The clock controls the time for executing an instruction. After the power supply, the clock is the
basic unit of a system. A processor needs a clock oscillator circuit. The clock controls the various
clocking requirements of the CPU, of the system timers and the CPU machine cycles. The machine
cycles are for fetching codes and data from memory and then decoding and executing them at the
processor and for transferring the results to memory.
For processing units, a highly stable oscillator is required and the processor clock-out signal
provides the clock for synchronizing all system units with the processor.
System Timers and Real-time Clocks
A timer circuit is suitably configured as the system-clock, which ticks and generates system
interrupts periodically; for example, 60 times in 1s. The interrupt service routines then perform the
required operation.
A timer circuit is suitably configured as the real-time clock (RTC) that generates system interrupts
periodically for the schedulers, real-time programs and for periodic saving of time and date in the
system.
The RTC or system timer is also used to obtain software-controlled delays and time-outs. An RTC
functions as driver for software timers (SWTS).
Microcontrollers also provide internal timer circuits for counting and timing devices.
To schedule the various tasks and for real-time programming, an RTC or system clock is needed.
The clock also drives the timers for various timing and counting needs in a system.
Reset Circuit, Power-up Reset and Watchdog-Timer Reset
The program counter (PC) holds the address from where the instruction is to be fetched for
execution. In 80x86 processors, the instruction pointer (IP) holds that address. A code segment
register (CS) holds the base address of the code memory segment. The CS address equals the code
starting address when the IP = 0 at the start of a code segment. The IP increments when the program
executes the codes.
Reset means that the processor begins the processing of instructions from a starting address. That
address is one that is set by default in the processor PC (or IP and CS in x86 processors) on a
power-up. From that address in memory, program-instructions are fetched following the reset of
the processor. A program that is reset and runs on a power-up can be one of the following: (i) A
system program that executes from the beginning. (ii) A system boot-up program. (iii) A system
initialization program.
In certain processors, for example, 68HC11 and HC12, there are two start-up addresses. One is
based on the power-up reset vector and the other on the reset vector after the reset instruction or
after a time-out (for example, from a watchdog timer). The processor fetches the bytes for the PC
from the first power-up reset vector on power-up. The processor fetches the bytes for the PC from
the second reset vector on the watchdog timer timing out or on executing the reset instruction.
The reset circuit activates for a fixed period (a few clock cycles) and then deactivates. The
processor circuit keeps the reset pin active and then deactivates to let the program proceed from a
default beginning address. The reset pin or the internal reset signal, if connected to the other units
(for example, the IO interface or the serial interface) in the system, is activated again by the
processor; it becomes an outgoing pin to enforce a reset state in other sister units of the system.
On deactivation of the reset that succeeds the processor activation, a program executes from a
start-up address.
Reset can be activated by an external reset circuit that activates on power-up, on switching-on reset
of the system or on detection of a low voltage (e.g. <4.5 V when what is required is 5 V on the
system supply rails). This circuit output connects to a pin called the reset pin of the processor. This
circuit may be a simple RC circuit, an external IC circuit or a custom-built IC. Examples of ICs
are MAX 6314 and Motorola MC 34064.
Alternatively, it can also be activated by any one of the following: (i) software instruction; (ii)
time-out by a programmed timer known as a watchdog timer (or on an internal signal called COP
in 68HC11 and 68HC12 families); (iii) a clock monitor detecting a slowdown below certain
frequency.
The watchdog timer is a timing device that resets the system after a predefined timeout. It is
activated within the first few clock cycles after power-up. It has a number of applications. In many
embedded systems reset by a watchdog timer is very essential because it helps in rescuing the
system if a fault develops and the program gets stuck. On restart, the system can function normally.
Most microcontrollers have on-chip watchdog timers. The watchdog timer device is described in
detail in Section 3.7.
Consider a system controlling temperature. Assume that when the program starts executing, the
sensor inputs work all right. However, before the desired temperature is achieved, the sensor circuit
develops some fault. The controller will continue delivering the current nonstop if the system is
not reset. Consider another example of a system for controlling a robot. Assume that the interfacing
motor control circuit in the robot arm develops a fault during the run. In such cases, the robot arm
may continue to move unless there is a watchdog timer control. Otherwise, the robot will break its
own arm!
When a program executes the program counter increments or changes. An important circuit that
associates a system is its reset circuit that can change the program counter to a power-up default
value. A program that is reset and runs on a power-up can be one of the following: (i) A system
program that executes from the beginning. (ii) A system boot-up program, (iii) A system
initialization program.
The watchdog timer reset is a required feature in control applications.
Memory
In a system, there are various types of memory. Figure 1.4 shows a chart for various forms of
memory that are present in systems. These are as follows:
1. Internal RAM of 256 or 512 bytes in a microcontroller for registers, temporary data and stack.
2. Internal ROM/PROM/E PROM for about 4 kB to 64 kB of program (in the case of
microcontrollers).
3. External RAM for the temporary data and stack (in most systems) or internal caches (in the case
of certain microprocessors).
4. Internal flash (in many systems the results of processing can be saved in nonvolatile memory:
for example, system status periodically and images, songs, or speeches after suitable format
compression).
5. Memory stick (or card): video, images, songs, or speeches and large storage in digital camera
and mobile systems. Sony memory stick Micro (M2) is of size 15x12.5x1.2 mm and has a flash
memory of 2 GB. It has a data transfer rate of 160 Mbps (mega bit per second) and PRO-HG 480
Mbps and 120 Mbps write [since Dec. 2006.]
6. External ROM or PROM for embedding software (in almost all systems other than
microcontroller- based systems).
7. RAM memory buffers at ports.
8. Caches (in pipelined and superscalar microprocessors).
Table 1.1 details the functions assigned in embedded systems to the memories. ROM or PROM or
EPROM embeds the software specific to the system.
Table 1.1 Functions assigned to the memories in a system
A system embeds (locates) the following either in the internal flash or ROM, PROM or in an
external flash or ROM or PROM of the microcontroller: boot-up program, initialization data,
strings or pictogram for screen-display or initial state of the system, programs for various tasks,
ISRs and operating system kernel. The system has RAMs for saving temporary data, stack and
buffers that are needed during a program run. The system uses flash for storing nonvolatile results.
Input, Output and IO Ports, IO Buses and IO Interfaces
The system gets inputs from physical devices through the input ports. Examples are as follows:
1. A system gets inputs from the touch screen, keys in a keypad or keyboard, sensors and transducer
circuits.
2. A controller circuit in a system gets inputs from the sensor and transducer circuits.
3. A receiver of signals or a network card gets the input from a communication system. [A
communication system could be a fax or modem, or a broadcasting service.]
4. Ports receives inputs from a network or peripheral.
Consider the system in an Automatic Chocolate Vending Machine. It gets inputs from a port that
collects the coins that a child inserts.
Consider the system in a mobile phone. A user inputs the mobile number through the buttons,
directly or indirectly (through recall of the number from its memory). Keypad keys connect to the
system through an input port.
A processor identifies each input port by its memory buffer addresses, called port addresses. Just
as a memory location holding a byte or word is identified by an address, each input port is also
identified by the address. The system gets the inputs by the read operations at the port addresses.
The system has output ports through which it sends output bytes to the real world. Examples are
as follows: 1. Output may be sent to an light emitting diode (LED), liquid crystal display (LCD)
or touch screen display panel. For example, a calculator or mobile phone system sends the output-
numbers or an SMS message to the LCD display.
2. A system may send the output to a printer.
3. Output may be sent to a communication system or network.
4. A control system sends the outputs to alarms, actuators, furnaces or boilers.
5. A robot is sent output for its various motors.
Each output port is identified by its memory-buffer addresses (called port addresses). The system
sends the output by a write operation to the port address.
There are also general-purpose ports for both the input and output (IO) operations. For example, a
mobile phone system sends output as well as gets input through a wireless communication channel.
A mobile computing system touch screen system sends output as well as gets input when a user
touches the menu displayed or key on the screen.
Each IO port is also identified by an address to which the read and write operations both take place.
Ports can have serial or parallel communication with the system address and data buses. In serial
communication a one-bit data line is used and bits are sent serially in successive time slots.
Universal Asynchronous Receiver and Transmitter (UART) is a popular communication protocol
for serial communication. In parallel communication, several data lines are used and bits are sent
in parallel.
A system port may have to send output to multiple channels. A demultiplexer or multiplexer circuit
is then used.
A demultiplexer is a digital circuit that sends digital outputs at any instance to one of the provided
channels. The channel to which the output is sent is the one that is addressed by the channel address
bits at the demultiplexer input. A demultiplexer takes the input and transfers it to a select channel
output among the multiple output channels.
A multiplexer is a digital circuit that receives digital inputs at any instance from multiple channels,
and sends data output only from a specific channel at an instance. The channel address bits are at
multiplexer input. A multiplexer takes the input from one among the multiple input channels and
transfers a selected channel input to the output.
A system unit (for example, memory unit or IO port or device) may have to be selected from
among the multiple units in the system and activated. A decoder circuit when used as an address
decoder decodes the input addresses and activates the selected output channel from among the
many outputs. For example, there are 8 units of which one has to be selected. An address-select
input of 3 bits is input to the decoder. Based on the input address, the output select line among the
8 activates. If the input address bit is 000, then the 0th output is active and the 0th unit activates.
If the input address bit is 111, then the 7th output is active and the 7th unit activates.
Bus A system might have to be connected to a number of other devices and systems. A bus consists
of a common set of lines to connect multiple devices, hardware units and systems for
communication between any two of these at any given instance. A bus communication protocol
specifies how signals communicate on the bus. A bus may be a serial or parallel bus that transfers
one or multiple data bits at an instance, respectively. The protocol also specifies the following: (i)
ways of arbitration when several devices need to communicate through the bus; (ii) ways of polling
bus requirement from each device at an instance; (iii) ways of daisy chaining the devices so that
bus is granted to a device according to the device-priority in the chain.
For networking the distributed units or systems, there are different types of serial and parallel bus
protocols: FC, CAN, USB, ISA, EISA and PCI. For wireless networking of systems there are
802.11, IrDA, Bluetooth and ZigBee protocols.
A system connects to external physical devices and systems through parallel or serial I/O ports.
Demultiplexers and multiplexers facilitate communication of signals from multiple channels
through a common path. A system often networks to the other devices and systems through an I/O
bus: for example, FC. CAN, USB, ISA, EISA and PCI bus.
DAC Using a PWM and an ADC
DAC is a circuit that converts digital 8 or 10 or 12 bits to the analog output. The analog output is
with respect to the reference voltage. When all input bits are equal to 1, then the analog output is
the difference between the positive and negative reference pin voltages; when all input bits equal
0, then the analog output equals -ve reference pin voltage (usually 0 V).
Suppose a system needs to give the analog output of a control circuit for automation. The analog
output may be to a power system for d.c. motor or furnace.
A pulse width modulator (PWM) with an integrator circuit is used for the DAC. A PWM unit in
the microcontroller operates as follows: Pulse width is made proportional to the analog-output
needed. PWM inputs are from 00000000 to 11111111 for an 8-bit DAC operation. The PWM unit
outputs to an external integrator, which provides the desired analog output. From this information,
the formula to obtain the analog output from the bits in a given PWM register with bits ranging
from 00000000 to 11111111 is as follows: Analog output V = K pw, where K is constant and pw
is the pulse width.
Suppose a circuit (external to the microcontroller) gives an output of 1.024 V when the pulse width
is 50% of the total pulse time period, and 2.047 V when the width is 100%. When the width is
made 25%, by reducing by half the value in the PWM output control-register, the integrator output
will become 0.512 V. The constant K depends on integrator amplifier gain.
Assume that the integrator operates with a dual (plus-minus) supply. The PWM unit in the
microcontroller operates by another method, which is as follows. Assume that when an integrator
circuit gives an output of 1.023 V, the pulse width is 100% of the total pulse time period and of -
1.024 V when the width is 0%. When the width is made 25% by reducing by half the value in an
output control register, the integrator output will be 0.512 V; at 50% the output will be 0.0 V. From
this information, the formula to obtain the analog output from the bits in a given PWM register
ranging from 00000000 to 11111111 in both situations is as follows: Analog output V = 0.01. K'.
(pw-50), where K' is constant and pw is pulse width time in percentage with respect to pulse time
period. K' depends on integrator amplifier gain.
Analog to Digital Converter ADC is a circuit that converts the analog input to digital 4, 8, 10 or
12 bits. The analog input is applied between the positive and negative pins and is converted with
respect to the reference voltage. When input is equal to difference of reference positive and
negative voltages, then all output bits equal 1; when equals negative reference voltage (usually 0
V), then all output bits equal 0.
The ADC in the system microcontroller can be used in many applications such as data acquisition
systems (DAS), digital cameras, analog control systems and voice digitizing systems. Suppose a
system gets the analog inputs from sensors of temperature, pressure, heart-beats and other sources
in a DAS. Suppose a system gets the analog inputs from a digital camera. It has CCD (Charge
Couple Device) which has tiny pixels that charge up on exposure to light. The charging of each
pixel depends upon the light intensity at that point in the image. The analog inputs to the system
generate from each pixel. Each pixel's analog input has to be converted into bits to enable
processing in the next stage.
Suppose a system needs to read an analog input from a sensor or transducer circuit. If converted
to bits by the ADC unit in the system, then these bits, after processing, can also give an output.
This provides a control for automation by a combined use of ADC and DAC features.
The converted bits can be given to the port meant for digital display. The bits may be transferred
to a memory address, a serial port or a parallel port.
A processor may process the converted bits and generate a Pulse Code Modulated (PCM) output.
PCM signals are used to digitize voice into a digital format.
Important points about the ADC are as follows.
1. Either a single or dual analog reference voltage-source is required in the ADC. It sets either the
analog input's upper limit or the lower and upper limits both. For a single reference source, the
lower limit is set to 0 V (ground potential). When the analog input equals the lower limit, the ADC
generates all bits as Os, and when it equals the upper limit it generates all bits as 1s. [As an
example, suppose in an ADC the upper limit or reference voltage is set to 2.255 V. Let the lower
limit reference voltage be 0.255 V. The difference in the limits is 2 V. Therefore, the resolution
will be 2/256 V. If the 8-bit ADC analog- input is 0.255 V, the converted 8 bits will be 00000000.
When the input is 0.255 V+ 1.000 V = 1.255 V, the bits will be 10000000. When the analog input
is 0.255 V+ 0.50 V, the converted bits will be 01000000. [From this information, finding a formula
to obtain converted bits for a given analog input = v volt is as follows: Binary number n bits after
conversion in an n-bit ADC corresponds to decimal number N. Then N = v. (Vreft - V ref-)/2".
Here, Vreft is the reference voltage that gives all the bits that are equal to 1 and Vrer is the reference
voltage that gives all the bits that are equal to 0.] 2. An ADC may be of 8, 10, 12, or 16 bits
depending upon the resolution needed for conversion. 3. The start of the conversion (STC) signal
or input initiates the conversion to 8 bits. In a system, an instruction or a timer signals the STC.
4. There is an end of conversion (EOC) signal. A flag in a register is set to indicate the end of
conversion and the ADC generates an interrupt; the ISR reads the ADC bits and saves them in the
memory buffer. 5. There is a conversion time limit in which the conversion is definite.
6. A Sample and Hold (S/H) unit is used to sample the input for a fixed time and hold till conversion
is over.
An ADC unit can be repeatedly used after the intervals equal to the conversion time. Therefore,
one can digitizes the DAS sensor signals, CCD signals, voice, music or video signals, or heart beat
sensor signals in different systems. An ADC unit in an embedded system microcontroller may
have multichannels. It can then take the inputs in succession from the various pins interconnected
to different analog sources.
For automatic control and signal processing applications, a system provides necessary interfacing
circuit and software for the Digital to Analog Conversion (DAC) unit and Analog to Digital
Conversion (ADC) unit. A DAC operation is done with the help of a combination of a PWM unit
in the microcontroller and an external integrator chip. ADC operations are required for data
acquisition, image processing, voice processing, video processing, instrumentation and automatic
control systems.
Actions at each step Research by software engineering experts have shown that on an average, a
designer needs to spend about 50% of the time for planning, analysis and design, 40% for testing,
validation and debugging and 10-15% on coding. Action required to be taken at each step in the
design process is listed in Table 1.10.
Challenges in Embedded System Design: Optimizing Design Metrics Following are the
challenges that arise during the design process.
Amount and type of hardware needed: Optimizing the requirement of microprocessors, ASIPs and
single purpose processors in the system on the basis of performance, power dissipation, cost and
other design metrics are the challenges in a system design. A designer also chooses the appropriate
hardware (memory RAM, ROM or internal and external flash or secondary memory, peripherals
and devices internal and external ports and buses and power source or battery) taking into account
the design metrics given in Table 1.8; for example, power dissipation, physical size, number of
gates and the engineering, prototype development and manufacturing costs.
Optimizing Power Dissipation and Consumption: Power, consumption during the operational and
idle state of system should be optimal. The following methods are used to meet the design
challenges.
Clock Rate Reduction Power dissipation typically reduces 2.5 μW per 100 kHz of reduced clock
rate. So reduction from 8000 kHz to 100 kHz reduces power dissipation by about 200 μW, which
is nearly similar to when the clock is nonfunctional. [Remember, total power dissipated (energy
required) may not reduce. This is because on reducing the clock rate, the computations will take a
longer time and total energy required equals the power dissipation per second multiplied by
computation time].
The power 25 μW is typically the residual dissipation needed to operate the timers and few other
units. By operating the clock at a lower frequency or during the power-down mode of the
processor, the advantages are as follows: (i) Power loss due to heat generation reduces. (ii) Radio
frequency interference also reduces due to the reduced power dissipation within the gates.
[Radiated RF (Radio Frequency) power depends on the RF current inside a gate, which reduces
due to increase in 'ON' state resistance between drain and channel of each MOSFET transistor and
that reduces heat generation.]
Voltage Reduction In portable or hand-held devices such as a cellular phone, compared to 5 V
operation, a CMOS circuit power dissipation reduces by one sixth, ~(2V/5V), in 2.0 V operation.
Thus the time intervals needed for recharging the battery increase by a factor of six.
Wait, Stop and Cache Disable instructions An embedded system may need to be run
continuously, without being switched off; the system design, therefore, is constrained by the need
to limit power dissipation while it is ON but is in idle state. Total power consumption by the system
while in running, waiting and idle states should be limited. A microcontroller must provide for
executing Wait and Stop instructions for the power-down mode. One way to reduce power
dissipation is to cleverly incorporate into software the Wait and Stop instructions. Another is to
operate the system at the lowest voltage levels in the idle state and selecting power-down mode in
that state. Yet another method is to disable use of certain structural units of the processor- for
example, caches-when not necessary and to keep in disconnected state those structure units that
are not needed during a particular software execution, for example timers or IO units.
Operations can be performed at low voltage or reduced clock rate in order to control power
dissipation. For embedded system software, performance analysis during its design phase must
also include the analysis of power dissipation during program execution and during standby. An
embedded system has to perform tasks continuously from power-up to power-off and may even
be kept 'ON' continuously. Clever real-time programming by using 'Wait' and 'Stop' instructions
and disabling certain units when not needed is one method of saving power during program
execution.
Process Deadlines Meeting the deadline of all processes in the system while keeping the memory,
power dissipation, processor clock rate and cost at minimum is a challenge.
Flexibility and Upgrade ability Flexibility and upgrade ability in design while keeping the cost
minimum and without any significant engineering cost is a challenge. Flexibility and upgrade
ability allow different and advanced versions of a product to be introduced in the market later on.
Reliability Designing a reliable product by appropriate design, testing and thorough verification,
is a challenge. The goal of testing is to find errors and to validate that the implemented software is
as per the specifications and requirements. Verification refers to an activity to ensure that specific
functions are correctly implemented. Validation refers to an activity to ensure that the system that
has been created is as per the requirements agreed upon at the analysis phase, and to ensure its
quality.
CLASSIFICATION OF EMBEDDED SYSTEMS
We can classify embedded systems into three types as follows.
1. Small scale embedded systems: These systems are designed with a single 8- or 16-bit
microcontroller; they have little hardware and software complexities and involve board-level
design. They may even be battery operated. When developing embedded software for these, an
editor, assembler and cross assembler, an integrated development environment (ISE) tool specific
to the microcontroller or processor used, are the main programming tools. Using 'C' language,
programs are compiled into the assembly and executable codes are appropriately located in the
system memory. The software has to fit within the memory available and keep in view the need to
limit power dissipation when the system is running continuously.
2. Medium scale embedded systems: These systems are usually designed with a single or a few
16- or 32-bit microcontrollers, DSPs or RISCs. These systems may also employ the readily
available single purpose processors and IPs (explained later) for the various functions-for example,
bus interfacing. [ASSPS and IPs may also have to be appropriately configured by the system
software before being integrated into the system-bus.] Medium scale embedded systems have both
hardware and software complexities. For complex software design, the following programming
tools are available: C/C++/Visual C++/Java, RTOS, source code engineering tool, simulator,
debugger and an integrated development environment. Software tools also provide solutions to
hardware complexities.
3. Sophisticated embedded systems: Sophisticated embedded systems have enormous hardware
and software complexities and may need several IPS, ASIPs, scalable processors or configurable
processors and programmable logic arrays. They are used for cutting edge applications that need
hardware and software co-design and components that have to be integrated in the final system.
They are constrained by the processing speeds available in their hardware units. Certain software
functions such as encryption and deciphering algorithms, discrete cosine transformation and
inverse transformation algorithms, TCP/ IP protocol stacking and network driver functions are
implemented in the hardware to obtain additional speeds. The software implements some of the
functions of the hardware resources in the system. Development tools for these systems may not
be readily available at a reasonable cost or may not be available at all. In some cases, a compiler
or retargetable compiler might have to be developed for these. [A retargetable compiler is one that
configures according to the given target configuration in a system.]
CHARACTERISTICS OF AN EMBEDDED SYSTEM
Unlike general purpose computing systems, embedded systems possess certain specific
characteristic and these characteristics are unique to each embedded system. Some of the important
characteristics o an embedded system are:
1. Application and domain specific
2. Reactive and Real Time
3. Operates in harsh environments
4. Distributed
5. Small size and weight
6. Power concerns
Response Response is a measure of quickness of the system. It gives you an idea about how fast
your system is tracking the changes in input variables. Most of the embedded systems demand fast
response which should be almost Real Time. For example, an embedded system deployed in flight
control application should respond in a Real Time manner. Any response delay in the system will
create potential damages to the safety of the flight as well as the passengers. It is not necessary
that all embedded systems should be Real Time in response. For example, the response time
requirement for an electronic toy is not at all time-critical. There is no specific deadline that this
system should respond within this particular timeline.
Throughput Throughput deals with the efficiency of a system. In general, it can be defined as the
rate of production or operation of a defined process over a stated period of time. The rates can be
expressed in terms of units of products, batches produced, or any other meaningful measurements.
In the case of a Card Reader, throughput means how many transactions the Reader can perform in
a minute or in an hour or in a day. Throughput is generally measured in terms of 'Benchmark'. A
'Benchmark' is a reference point by which something can be measured. Benchmark can be a set of
performance criteria that a product is expected to meet or a standard product that can be used for
comparing other products of the same product line.
Reliability Reliability is a measure of how much % you can rely upon the proper function- ing of
the system or what is the % susceptibility of the system to failures.
Mean Time Between Failures (MTBF) and Mean Time To Repair (MTTR) are the terms used in
de- fining system reliability. MTBF gives the frequency of failures in hours/weeks/months. MTTR
specifies how long the system is allowed to be out of order following a failure. For an embedded
system with critical application need, it should be of the order of minutes.
Maintainability Maintainability deals with support and maintenance to the end user or cli- ent in
case of technical issues and product failures or on the basis of a routine system checkup. Reliability
and maintainability are considered as two complementary disciplines. A more reliable system
means a system with less corrective maintainability requirements and vice versa. As the reliability
of the system increases, the chances of failure and non-functioning also reduces, thereby the need
for maintainability is also reduced. Maintainability is closely related to the system availability.
Maintainability can be broadly classified into two categories, namely, 'Scheduled or Periodic
Maintenance (preventive maintenance)' and 'Maintenance to unexpected failures (corrective
maintenance)'. Some embedded products may use consumable components or may contain
components which are subject to wear and tear and they should be replaced on a periodic basis.
The period may be based on the total hours of the system us- age or the total output the system
delivered. A printer is a typical example for illustrating the two types of maintainability. An inkjet
printer uses ink cartridges, which are consumable components and as per the printer manufacturer
the end user should replace the cartridge after each 'n' number of printouts to get quality prints.
This is an example for 'Scheduled or Periodic maintenance'. If the paper feeding part of the printer
fails the printer fails to print and it requires immediate repairs to rectify this problem. This is an
example of 'Maintenance to unexpected failure'. In both of the maintenances (scheduled and
repair), the printer needs to be brought offline and during this time it will not be available for the
user. Hence it is obvious that maintainability is simply an indication of the availability of the
product for use. In any embedded system design, the ideal value for availability is expressed as
Ai = MTBF/(MTBF + MTTR)
where Ai = Availability in the ideal condition, MTBF = Mean Time Between Failures, and MTTR
= Mean Time To Repair
Security Confidentiality, 'Integrity', and 'Availability' (The term 'Availability' mentioned here is
not related to the term 'Availability' mentioned under the 'Maintainability' section) are the three
major measures of information security. Confidentiality deals with the protection of data and
application from unauthorized disclosure. Integrity deals with the protection of data and
application from unauthorized modification. Availability deals with protection of data and
application from unauthorized users. A very good example of the 'Security' aspect in an embedded
product is a Personal Digital Assistant (PDA). The PDA can be either a shared resource (e.g. PDAs
used in LAB setups) or an individual one. If it is a shared one there should be some mechanism in
the form of a user name and password to access into a particular person's profile-This is an example
of 'Availability'. Also all data and applications present in the PDA need not be accessible to all
users. Some of them are specifically accessible to administrators only. For achieving this,
Administrator and user levels of security should be implemented -An example of Confidentiality.
Some data present in the PDA may be visible to all users but there may not be necessary
permissions to alter the data by the users. That is Read Only access is allocated to all users-An
example of Integrity.
Safety 'Safety' and 'Security' are two confusing terms. Sometimes you may feel both of them as a
single attribute. But they represent two unique aspects in quality attributes. Safety deals with the
possible damages that can happen to the operators, public and the environment due to the
breakdown of an embedded system or due to the emission of radioactive or hazardous materials
from the embedded products. The breakdown of an embedded system may occur due to a hardware
failure or a firmware failure. Safety analysis is a must in product engineering to evaluate the
anticipated damages and deter- mine the best course of action to bring down the consequences of
the damages to an acceptable level. As stated before, some of the safety threats are sudden (like
product breakdown) and some of them are gradual (like hazardous emissions from the product).
Non-Operational Quality Attributes
The quality attributes that needs to be addressed for the product 'not' on the basis of operational
aspects are grouped under this category. The important quality attributes coming under this
category are listed below.
1. Testability & Debug-ability
2. Evolvability
3. Portability
4. Time to prototype and market
5. Per unit and total cost.
Testability & Debug-ability Testability deals with how easily one can test his/her design,
application and by which means he/she can test it. For an embedded product, testability is
applicable to both the embedded hardware and firmware. Embedded hardware testing ensures that
the peripherals and the total hardware functions in the desired manner, whereas firmware testing
ensures that the firm- ware is functioning in the expected way. Debug-ability is a means of
debugging the product as such for figuring out the probable sources that create unexpected
behaviour in the total system. Debug-ability has two aspects in the embedded system development
context, namely, hardware level debugging and firmware level debugging. Hardware debugging
is used for figuring out the issues created by hardware problems whereas firmware debugging is
employed to figure out the probable errors that appear as a result of flaws in the firmware.
Evolvability Evolvability is a term which is closely related to Biology. Evolvability is referred as
the non-heritable variation. For an embedded system, the quality attribute 'Evolvability' refers to
the ease with which the embedded product (including firmware and hardware) can be modified to
take advantage of new firmware or hardware technologies.
Portability Portability is a measure of 'system independence'. An embedded product is said to be
portable if the product is capable of functioning 'as such' in various environments, target
processors/controllers and embedded operating systems. The ease with which an embedded
product can be ported on to a new platform is a direct measure of the re-work required. A standard
embedded product should always be flexible and portable. In embedded products, the term 'porting'
represents the migration of the embedded firmware written for one target processor (e.g. Intel x86)
to a different target processor (say Hitachi SH3 processor). If the firmware is written in a high
level language like 'C' with little target processor-specific functions (operating system extensions
or compiler specific utilities), it is very easy to port the firmware for the new processor by replacing
those 'target processor-specific functions' with the ones for the new target processor and re-
compiling the program for the new target processor- specific settings. Re-compiling the program
for the new target processor generates the new target processor-specific machine codes. If the
firmware is written in Assembly Language for a particular family. of processor (say x86 family),
it will be very difficult to translate the assembly language instructions to the new target processor
specific language and so the portability is poor.
If you look into various programming languages for application development for desktop
applications, you will see that certain applications developed on certain languages run only on
specific operating systems and some of them run independent of the desktop operating systems.
For example, applications developed using Microsoft technologies (e.g. Microsoft Visual C++
using Visual studio) is capable of running only on Microsoft platforms and will not function on
other operating systems; whereas applications developed using 'Java' from Sun Microsystems
works on any operating system that supports Java standards.
Time-to-Prototype and Market Time-to-market is the time elapsed between the concep-
tualisation of a product and the time at which the product is ready for selling (for commercial
product) or use (for non-commercial products). The commercial embedded product market is
highly competitive and time to market the product is a critical factor in the success of a commercial
embedded product. There may be multiple players in the embedded industry who develop products
of the same category (like mobile phone, portable media players, etc.). If you come up with a new
design and if it takes long time to develop and market it, the competitor product may take
advantage of it with their product. Also, embedded technology is one where rapid technology
change is happening. If you start your design by making use of a new technology and if it takes
long time to develop and market the product, by the time you market the product, the technology
might have superseded with a new technology. Product prototyping helps a lot in reducing time-
to-market. Whenever you have a product idea, you may not be certain about the feasibility of the
idea. Prototyping is an informal kind of rapid product development in which the important features
of the product under consideration are developed. The time to prototype is also another critical
factor. If the prototype is developed faster, the actual estimated development time can be brought
down significantly. In order to shorten the time to prototype, make use of all possible options like
the use of off-the-shelf components, re-usable assets, etc.
Per Unit Cost and Revenue Cost is a factor which is closely monitored by both end user (those
who buy the product) and product manufacturer (those who build the product). Cost is a highly
sensitive factor for commercial products. Any failure to position the cost of a commercial product
at a nominal rate, may lead to the failure of the product in the market. Proper market study and
cost benefit analysis should be carried out before taking a decision on the per-unit cost of the
embedded product. From a designer/product development company perspective the ultimate aim
of a product is to generate marginal profit. So, the budget and total system cost should be properly
balanced to provide a marginal profit. Every embedded product has a product life cycle which
starts with the design and development phase. The product idea generation, prototyping, Roadmap
definition, actual product design and development are the activities carried out during this phase.
During the design and development phase there is only investment and no returns. Once the
product is ready to sell, it is introduced to the market. This stage is known as the Product
Introduction stage. During the initial period the sales and revenue will be low. There won't be
much competition and the product sales and revenue increase with time. In the growth phase, the
product grabs high market share. During the maturity phase, the growth and sales will be steady
and the revenue reaches at its peak. The Product Retirement/Decline phase starts with the drop-in
sales volume, market share and revenue. The decline happens due to various reasons like
competition from similar product with enhanced features or technology changes, etc. At some
point of the decline stage, the manufacturer announces discontinuing of the product. The different
stages of the embedded products life cycle-revenue, unit cost and profit in each stage-are
represented in the following Product Life-cycle graph.
From the graph, it is clear that the total revenue increases from the product introduction stage to
the product maturity stage. The revenue peaks at the maturity stage and starts falling in the
decline/retirement stage. The unit cost is very high during the introductory stage (a typical example
is cell phone; if you buy a new model of cell phone during its launch time, the price will be high
and you will get the same model with a very reduced price after three or four months of its
launching). The profit increases. with increase in sales and attains a steady value and then falls
with a dip in sales. You can see a negative value for profit during the initial period. It is because
during the product development phase there is only investment and no returns. Profit occurs only
when the total returns exceed the investment and operating cost.
The time-to-market significantly impacts competitiveness in the commercial market, as companies that quickly bring products to market can capitalize on first-mover advantage. Prolonged development timelines can result in missed opportunities, especially in fast-paced technology sectors where rapid innovations can render products obsolete before release. Efficient prototyping and leveraging off-the-shelf components can reduce time-to-market .
Distributed embedded systems enhance the functionality and efficiency of larger systems by enabling individual embedded units to perform specific tasks within a larger framework. This modular approach allows for scalability, improves redundancy, and allows different tasks to be coordinated effectively. Examples like vending machines and ATMs showcase how independent units work together to achieve a common goal .
Operational quality attributes such as response, throughput, reliability, and maintainability directly influence the functionality of real-time embedded systems. In critical applications like flight control systems, fast response times are essential to prevent catastrophic failures. These attributes ensure that the system can handle input changes promptly and maintain high efficiency over time through consistent operational benchmarks and redundancy for reliability .
Embedded systems ensure reliability in harsh environments by using components that can withstand extreme conditions, such as high temperatures and vibrations. Appropriate materials and design considerations, like shock absorption techniques, help manage environmental stresses. Additionally, power supply modulation, corrosion resistance, and component aging are also considered to maintain system longevity and reliability under adverse conditions .
Using high-level languages for embedded system development enhances productivity by simplifying code syntax and reducing development time, allowing developers to focus on broader system architecture rather than low-level details. Maintenance is also improved due to better readability and structure, facilitating easier updates and debugging compared to assembly language .
The ROM image is significant as it represents the final, implementable form of embedded system software, containing all necessary instruction codes and data for execution. It ensures that the software is uniquely tailored to the hardware's memory map, enabling the same hardware platform to function under different applications or upgrades by simply changing the ROM image .
Power management is critical because it influences system efficiency, battery life, and thermal management. Effective power management minimizes heat dissipation and the need for bulky cooling solutions, thus maintaining system compactness. Low power consumption is pivotal, especially in battery-operated applications, to extend operational duration and reliability. Ultra-low power components are frequently utilized to achieve these objectives .
The location process addresses the implementation of linking object codes to specific memory addresses to create a functional ROM image. By using a locator during development, it ensures precise placement of codes and data among available addresses in memory, which is crucial for effectively executing embedded system operations on the target hardware .
Coding in assembly language provides benefits by allowing access to the processor-specific features and configuring physical devices with optimal precision. It is particularly useful for configuring ports and direct interactions with hardware components such as ADCs, DACs, and line-display interfaces, which can lead to more efficient and tailored device operations despite its complexity .
Coding in machine implementable codes is time-consuming due to the need for programmers to understand the processor's instruction set and memorize the instructions and their corresponding machine codes . This process demands significant resources and time, limiting its use to specific situations where precise control over hardware is necessary. The challenges impact development time, as programming at such a low level requires meticulous attention to detail and extensive knowledge, which can hinder rapid prototyping and development timelines .