0% found this document useful (0 votes)
13 views

Embedded System Module 1

Uploaded by

Rohan s
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Embedded System Module 1

Uploaded by

Rohan s
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

EMBEDDED SYSTEMS

(ECE3040)

MR. SYED ABRAR AHMED


ASSISTANT PROFESSOR
DEPARTMENT OF ELECTRONICS AND
COMMUNICATION ENGINEERING (ECE)
Course Organization
 Module 1: Fundamentals of Embedded Systems
 Module 2: ARM Architecture
 Module 3: ARM Programming and Interfacing
 Module 4: Real Time Operating Systems (RTOS)
Text Books
 Andrew N. Sloss, Dominic Symes, Chris Wright, “ARM System
Developer's Guide, Designing and Optimizing System
Software”, Morgan Kaufmann Publishers, 2nd Edition.
 Alexander G. Dean, “Embedded Systems Fundamentals with
Arm Cortex M Based Microcontrollers: A Practical Approach”,
ARM Education Media, 2nd Edition
 K.V.K.K.Prasad, “Embedded Real-Time Systems: Concepts,
Design & Programming”, Dream Tech Press, 2010, 3rd Edition
 Steve Heath, “Embedded System Design”, Elsevier India, 2nd
Edition.
Outline
 Introduction to Embedded System
 Elements of Embedded System
 Embedded Processors
 Memory Systems
 Basic Peripherals
 Interfacing to the Analogue world
 Interrupts and Exceptions
Introduction
An Embedded System is an electronic/electro-mechanical system
designed to perform a specific function and is a combination of both
hardware and firmware(software). Examples: Electronic Toys, Mobile
Handsets, Washing Machines, Air Conditioners, Automotive Control
Units, Set Top Box, DVD Player etc.
 Unique in character and behavior
 With specialized hardware and software
EMBEDDED SYSTEMS VS GENERAL COMPUTING SYSTEM
EMBEDDED SYSTEMS GENERAL COMPUTING SYSTEM
A system which is a combination of a
A system which is a combination of special
generic hardware and General purpose
purpose hardware and embedded OS for
Operating System(OS) for executing a
executing set of applications.
variety of applications.
May or may not contain an operating system Contains a General Purpose Operating
for functioning. System.
Applications are alterable
The firmware of the embedded system is pre- (programmable) by the user. (It is
programmed and it is non alterable by the possible for the end user to re-install the
end user. (There may be exceptions for operating system, and also add or
systems supporting OS kernel image flashing remove user applications).
through special hardware settings).

Application-specific requirements (like Performance is the key deciding factor in


performance, power requirements, memory the selection of the system. Always
For certain category of embedded systems Response requirements are not time
like mission critical systems, the response critical.
time requirement is highly critical.
Execution behavior is deterministic for Need not be deterministic in execution
certain types of embedded systems like ‘Hard behavior.
Real Time Systems’.
MAJOR APPLICATION AREAS OF EMBEDDED SYSTEMS
 Consumer Electronics:
Camcorders, cameras, mobile phones, etc.
 Household Appliances:
Television, DVD Players, Washing Machine, etc.
 Home Automation and Security Systems:
Air Conditioners, Sprinklers, Fire Alarms, etc.
 Automotive Industry:
Anti-lock Breaking System(ABS), Engine Control, Ignition Systems, etc.
 Telecom:
Cellular Telephones, Telephone switches, etc.
 Computer Peripherals:
Printers, Scanners, Fax Machines, etc.
 Computer Networking Systems:
Network Routers, Switches, Hubs, firewalls, etc.
 Healthcare:
Different kinds of Scanners, EEG, ECG Machines, etc.
 Measurement and Instrumentation:
Digital Multi-Meters, Digital CROs, Logic Analyzers PLC Systems, etc.
 Banking and Retail:
Automatic Teller Machines(ATM) & Currency Counters, Point of Sales(POS)
 Card Readers:
Barcode, Smart Card Readers, Hand Held Devices, etc.
Reduced Instruction Sets Computers VS Complex Instruction Sets Computers
RISC CISC
Lesser number of instructions. Greater number of Instructions.
Instruction Pipelining and increased execution Generally no instruction pipelining
speed. feature.
Non Orthogonal Instruction Set (All
Orthogonal Instruction Set (Allows each
instructions are not allowed to operate on
instruction to operate on any register and use
any register and use any addressing mode. It
any addressing mode).
is instruction specific).
Operations are performed on registers only, the Operations are performed on registers or
only memory operations are load and store. memory depending on the instruction.
Limited number of general purpose
A Large number of registers are available.
registers.
Can be Harvard or Von-Neumann
With Harvard Architecture
Architecture
A programmer can achieve the desired
Programmer needs to write more code to
functionality with a single instruction
execute a task since the instructions are
which in turn provides the effect of using
simpler ones.
more simpler single instructions in RISC.
Single, Fixed length Instructions. Variable length Instructions.
More silicon usage since more additional
Less Silicon usage and pin count decoder logic is required to implement the
complex instruction decoding.
CHARACTERISTICS OF AN EMBEDDED SYSTEM
Embedded systems possess certain specific characteristics and these
are unique to each Embedded system.
1. Application and domain specific
 Each Embedded System has certain functions to perform and they are
developed in such a manner to do the intended functions only.
 They cannot be used for any other purpose.
 Example: The embedded control units of the microwave oven cannot be
replaced with AC‟S embedded control unit because the embedded control
units of microwave oven and AC are specifically designed to perform
certain specific tasks.
2. Reactive and Real Time
 Embedded System produce changes in output in response to the changes
in the input, so they are referred as reactive systems.
 Real Time system operation means the timing behavior of the system
should be deterministic i.e. the system should respond to requests in a
known amount of time.
3. Operates in harsh environments
 The design of Embedded System should take care of the operating
conditions of the area where the system is going to implement.
 Example: If the system needs to be deployed in a high temperature zone,
then all the components used in the system should be of high
temperature grade.
 Also proper shock absorption techniques should be provided to systems
which are going to be commissioned in places subject to high shock.
4. Distributed
 It means that embedded systems may be a part of a larger system.
 Many numbers of such distributed embedded systems form a single large
embedded control unit.
 Example: Automatic vending machine. It contains a card reader, a vending
unit etc. Each of them are independent embedded units but they work
together to perform the overall vending function.
5. Small Size and weight
 Product aesthetics (size, weight, shape, style, etc.) is an important factor in
choosing a product.
 It is convenient to handle a compact device than a bulky product.
6. Power concerns
 Power management is another important factor that needs to be
considered in designing embedded systems to minimize the heat
dissipation by the system.
QUALITY ATTRIBUTES OF EMBEDDED SYSTEM
Quality attributes are the non-functional requirements that need to
be documented properly in any system design.
Quality attributes can be classified as
1.Operational quality attributes
2.Non-operational quality attributes.

Operational quality attributes


 Response: It is the measure of quickness of the system.
 Throughput: It deals with the efficiency of a system. It can be defined as
the rate of production or operation of a defined process over a stated
period of time.
 Reliability: It is a measure of how much we can rely upon the proper
functioning of the system. Mean Time Between Failure (MTBF) and Mean
Time To Repair (MTTR) are the terms used in determining system reliability.
 Maintainability:- It deals with support and maintenance to the end user or
client in case of technical issues and product failure or on the basis of a
routine system checkup.
 Security: Confidentiality, Integrity and availability are the three major
measures of information security. Confidentiality deals with 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.
 Safety : Safety deals with the possible damages that can happen to the
operator, public and the environment due to the breakdown of an
Embedded System.
Elements of Embedded
System
An embedded system is a
combination of 3 things,
Hardware Software
Mechanical Components
and it is supposed to do
one specific task only.
Diagrammatically an
embedded system can be
represented as follows:
Elements of Embedded System
 A typical embedded system contains a single chip controller which
acts as the master brain of the system. Embedded systems are
basically designed to regulate a physical variable (such Microwave
Oven) or to manipulate the state of some devices by sending
some signals to the actuators or devices connected to the output
port system (such as temperature in Air Conditioner), in response
to the input signal provided by the end users or sensors which are
connected to the input ports. Hence the embedded systems can
be viewed as a reactive system.
 The control is achieved by processing the information coming
from the sensors and user interfaces and controlling some
actuators that regulate the physical variable.
 Keyboards, push button, switches, etc. are Examples of common
user interface input devices and LEDs, LCDs, Piezoelectric buzzers,
etc. examples for common user interface output devices for a
typical embedded system. The requirement of type of user
interface changes from application to application based on
domain.
 The memory of the system is responsible for holding the code
(control algorithm and other important configuration details).
Embedded Processors/The Core of the Embedded Systems
The core of the embedded system falls into any one of the following
categories.
 General Purpose and Domain Specific Processors
 Microprocessors
 Microcontrollers
 Digital Signal Processors
 Programmable Logic Devices (PLDs)
 Application Specific Integrated Circuits (ASICs)
 Commercial off the shelf Components (COTS)
1. GENERAL PURPOSE AND DOMAIN SPECIFIC PROCESSOR
Almost 80% of the embedded systems are processor/ controller
based. The processor may be microprocessor or a microcontroller or
digital signal processor, depending on the domain and application.
 Microprocessor
 A silicon chip representing a Central Processing Unit (CPU), which is
capable of performing arithmetic as well as logical operations according
to a pre-defined set of Instructions, which is specific to the
manufacturer.
 In general the CPU contains the Arithmetic and Logic Unit (ALU), Control
Unit and Working registers.
 Microprocessor is a dependent unit and it requires the combination of
other hardware like Memory, Timer Unit, and Interrupt Controller etc.
for proper functioning.
 Microcontroller
 A highly integrated silicon chip containing a CPU, scratch pad RAM, Special and
General purpose Register Arrays, On Chip ROM/FLASH memory for program
storage, Timer and Interrupt control units and dedicated I/O ports
 They are cheap, cost effective and are readily available in the market.
 Texas Instruments TMS 1000 is considered as the world’s first microcontroller.
 Digital Signal Processors (DSPs)
 Powerful special purpose 8/16/32 bit microprocessors designed specifically
to meet the computational demands and power constraints of today's
embedded audio, video, and communications applications.
 Digital Signal Processors are 2 to 3 times faster than the general purpose
microprocessors in signal processing applications.
 DSP can be viewed as a microchip designed for performing high speed
computational operations for addition, subtraction, multiplication & division.
 Big-endian V/s Little-endian processors
Endianness specifies the order in which the data is stored in the
memory by processor operations in a multi byte system (Processors
whose word size is greater than one byte).
 Little-endian means the lower-order byte of the data is stored in memory
at the lowest address, and the higher-order byte at the highest address.
(The little end comes first)
 Big-endian means the higher-
order byte of the data is
stored in memory at the
lowest address, and the
lower-order byte at the
highest address. (The big end
comes first.)
2. Application Specific Integrated Circuit (ASIC)
 A microchip designed to perform a specific or unique application. It is used
as replacement to conventional general purpose logic chips.
 ASIC integrates several functions into a single chip and thereby reduces the
system development cost.
 Most of the ASICs are proprietary products. As a single chip, ASIC consumes
very small area in the total system and thereby helps in the design of smaller
systems with high capabilities/functionalities.
 ASICs can be pre-fabricated for a special application or it can be custom
fabricated by using the components from a re-usable „building block‟ library
of components for a particular customer application.
 Fabrication of ASICs requires a non-refundable initial investment (Non
Recurring Engineering (NRE) charges) for the process technology and
configuration expenses.
3. Programmable Logic Devices (PLDs)
 Logic devices provide specific functions, including device-to-device
interfacing, data communication, signal processing, data display, timing and
control operations, and almost every other function a system must perform.
 Logic devices can be classified into two broad categories - Fixed and
Programmable. The circuits in a fixed logic device are permanent, they
perform one function or set of functions - once manufactured, they cannot
be changed.
 Field Programmable Gate Arrays (FPGAs) and Complex Programmable Logic
Devices (CPLDs) are the two major types of programmable logic devices
 FPGA:
FPGA is an IC designed to be configured by a designer after manufacturing.
FPGAs offer the highest amount of logic density, the most features, and
the highest performance. Logic gate is Medium to high density ranging
from 1K to 500K system gates.
 CPLD:
 A complex programmable logic device (CPLD) is a programmable logic
device with complexity between that of PALs and FPGAs, and architectural
features of both.
 CPLDs, by contrast, offer much smaller amounts of logic - up to about
10,000 gates.
 Programmable logic devices (PLDs),which are purely combinational, and
field programmable gate arrays (FPGAs),which provide both combinational
logic and flip-flops.
PROGRAMMABLE LOGIC DEVICES (PLDs)
Commercial off the Shelf Component (COTS)
 A Commercial off-the-shelf (COTS) product is one which is used “as-is”
 COTS products are designed in such a way to provide easy integration and
interoperability with existing system components.
 A COTS component in turn contains a General Purpose Processor (GPP) or
Application Specific Instruction Set Processor (ASIP) or Application Specific
Integrated Chip (ASIC)/Application Specific Standard Product (ASSP) or
Programmable Logic Device (PLD).
 Typical examples for the COTS hardware unit are Remote Controlled Toy Car
control unit including the RF Circuitry part, High performance, high
frequency microwave electronics (2 to 200 GHz), High bandwidth analog-
to-digital converters, Devices and components for operation at very high
temperatures, Electro-optic IR imaging arrays, UV/IR Detectors etc.
 The major advantage of using COTS is that they are readily available in the
market, cheap and a developer can cut down his/her development time to a
great extend.
 The major problem faced by the end-user is that there are no operational
and manufacturing standards and the manufacturer may withdraw the
product or discontinue the production of the COTs at any time if rapid
change in technology.
Memory Systems
 Memory is an important part of an embedded system. The memory used in
embedded system can be either Program Storage Memory (ROM) or Data
memory (RAM).
 Certain Embedded
processors/control
lers contain built in
program memory
and data memory
and this memory is
known as on-chip
memory.
1. Masked ROM (MROM)
 One-time programmable memory.
 Uses hardwired technology for storing data.
 The device is factory programmed by masking and metallization process
according to the data provided by the end user.
 The primary advantage of MROM is low cost for high volume production.
 The limitation with MROM based firmware storage is the inability to
modify the device firmware against firmware upgrades.

2. Programmable Read Only Memory (PROM) / (OTP)


 It is not pre-programmed by the manufacturer
 The end user is responsible for Programming these devices.
 PROM/OTP has nichrome or polysilicon wires arranged in a matrix, these
wires can be functionally viewed as fuses.
 It is programmed by a PROM programmer which selectively burns the fuses
according to the bit pattern to be stored.
 Fuses which are not blown/burned represents a logic “1” where as fuses
which are blown/burned represents a logic “0”.The default state is logic “1”.
 OTP is widely used for commercial production of embedded systems whose
proto-typed versions are proven and the code is finalized.
 It is a low cost solution for commercial production.
 OTPs cannot be reprogrammed.
3. Erasable Programmable Read Only Memory (EPROM)
 Erasable Programmable Read Only (EPROM) memory gives the flexibility to
re-program the same chip.
 During development phase , code is subject to continuous changes and
using an OTP is not economical.
 Bit information is stored by using an EPROM Programmer, which applies
high voltage to charge the floating gate.
 EPROM contains a quartz crystal window for erasing the stored information.
If the window is exposed to Ultra violet rays for a fixed duration, the entire
memory will be erased.
 Even though the EPROM chip is flexible in terms of re-programmability, it
needs to be taken out of the circuit board and needs to be put in a UV
eraser device for 20 to 30 minutes.
4. Electrically Erasable Programmable Read Only Memory (EEPROM)
 Erasable Programmable Read Only (EPROM) memory gives the flexibility to
re-program the same chip using electrical signals.
 The information contained in the EEPROM memory can be altered by using
electrical signals at the register/Byte level.
 They can be erased and reprogrammed within the circuit.
 These chips include a chip erase mode and in this mode they can be erased
in a few milliseconds.
 It provides greater flexibility for system design.
5. Program Storage Memory – FLASH
 FLASH memory is a variation of EEPROM technology.
 FALSH is the latest ROM technology and is the most popular ROM technology
used in today’s embedded designs
 It combines the re-programmability of EEPROM and the high capacity of
standard ROMs
 FLASH memory is organized as sectors (blocks) or pages

6. Read-Write Memory/Random Access Memory (RAM)


 RAM is the data memory or working memory of the controller/processor
 RAM is volatile, meaning when the power is turned off, all the contents are
destroyed.
 RAM is a direct access memory,
meaning we can access the desired
memory location directly without
the need for traversing through the
entire memory locations to reach
the desired memory position (i.e.
RAM location).
Static RAM SRAM Dynamic RAM (DRAM)
Made up of 6 CMOS transistors (MOSFET) Made up of a MOSFET and a capacitor
Doesn’t Require refreshing. Requires refreshing
Low capacity (Less dense). High Capacity (Highly dense)
More expensive. Less Expensive
Slow in operation due to refresh requirements.
Fast in operation. Typical access time is
Typical access time is 60ns.Write operation is
10ns.
faster than read operation.
7. Non Volatile RAM (NVRAM
 Random access memory with battery backup.
 It contains Static RAM based memory and a minute battery for providing
supply to the memory in the absence of external power supply.
 The memory and battery are packed together in a single package.
 The life span of NVRAM is expected to be around 10 years.
 DS1744 from Maxim/Dallas is an example for 32KB NVRAM.

Memory selection for Embedded Systems


 Selection of suitable memory is very much essential step in high
performance applications, because the challenges and limitations of the
system performance are often decided upon the type of memory
architecture.
 Systems memory requirement depend primarily on the nature of the
application that is planned to run on the system.
 Memory performance and capacity requirement for low cost systems are
small, whereas memory throughput can be the most critical requirement in
a complex, high performance system.
 Following are the factors that are to be considered while selecting the
memory devices.
 Speed
 Data storage size and capacity
 Bus width
 Power consumption
 Cost
Basic Peripherals-Sensors & Actuators
SENSORS
 A transducer device which converts energy from one form to another for
any measurement or control purpose. Sensors acts as input device
 Example: Hall Effect Sensor which measures the distance between the
cushion and magnet in the Smart Running shoes from Adidas.
ACTUATORS
 A form of transducer device (mechanical or electrical) which converts
signals to corresponding physical action (motion). Actuator acts as an
output device
 Example: Micro motor actuator which adjusts the position of the
cushioning element in the Smart Running shoes from Adidas.
The I/O Subsystem
 The I/O subsystem of the embedded system facilitates the interaction of the
embedded system with external world.
 The interaction happens through the sensors and actuators connected to the
Input and output ports respectively of the embedded system.

1. Light Emitting Diode (LED)


 Light Emitting Diode (LED) is an output device for visual
indication in any embedded system.
 LED can be used as an indicator for the status of various
signals or situations.
 Typical examples are indicating the presence of power
conditions Like Device ON, Battery low or Charging of
battery for a battery operated handheld embedded devices.
2. Seven Segment
 The LED segments are named A to G and the decimal point LED segment is
named as DP
 The LED Segments A to G and DP should be lit accordingly to display
numbers and characters
 The 7 – segment LED displays are available in two different configurations,
namely; Common anode and Common cathode
3. Optocoupler
 Optocoupler is a solid state device to isolate two parts of a circuit.
 Optocoupler combines an LED and a photo-transistor in a single housing
(package).
 In electronic circuits, Opto-coupler is used for suppressing interference in
data communication, circuit isolation, High voltage separation, simultaneous
separation and intensification signal etc.
4. Stepper Motor
 Stepper motor is an electro mechanical device which generates discrete
displacement (motion) in response to dc electrical signals
 It differs from the normal dc motor in its operation. The dc motor produces
continuous rotation on applying dc voltage whereas a stepper motor
produces discrete rotation in response to the dc voltage applied to it
 Stepper motors are widely used in industrial embedded applications,
consumer electronic products and robotics control systems
 Based on the coil winding arrangements, a two phase stepper motor is
classified into
 Unipolar
 A unipolar stepper motor contains two windings per phase. The direction
of rotation (clockwise or anticlockwise) of a stepper motor is controlled by
changing the direction of current flow.
 Current in one direction flows
through one coil and in the opposite
direction flows through the other coil.
It is easy to shift the direction of
rotation by just switching the
terminals to which the coils are
connected.
 Bipolar:
 A bipolar stepper motor contains
single winding per phase. For
reversing the motor rotation the
current flow through the windings is
reversed dynamically. It requires
complex circuitry for current flow
reversal
5. Relay
 An electro mechanical device which acts as dynamic path selectors for
signals and power.
 The Relay unit contains a relay coil made up of insulated wire on a metal
core and a metal armature with one or more contacts.
 Relay works on electromagnetic principle
 When a voltage is applied to the relay coil, current flows through the coil,
which in turn generates a magnetic field.
 The magnetic field attracts the armature core and moves the contact point.
6. Piezo Buzzer
 It is a piezoelectric device for generating audio
indications in embedded applications.
 A Piezo buzzer contains a piezoelectric
diaphragm which produces audible sound in
response to the voltage applied to it.
 Piezoelectric buzzers are available in two types
1.Self-driving 2.External driving
 Self-driving contains are the necessary
components to generate sound at a
predefined tone.
 External driving piezo Buzzers supports the
generation of different tones.
7. Push button switch
 Push Button switch is an input device.
 Push button switch comes in two configurations, namely “Push to Make”
and “Push to Break”.
 The switch is normally in the open state and it makes a circuit contact when
it is pushed or pressed in the “Push to Make” configuration.
 In the Push to Break configuration, the switch normally in the closed state
and it breaks the circuit contact when it is pushed or pressed.
Interfacing to the Analogue world
 The techniques used to interface to the
outside world which unfortunately is
largely analogue in nature as

Analogue to digital conversion


techniques
 The analogue signal is sampled at a
regular interval and each sample is
divided or quantized by a given value to
determine the number of given units of
value that approximate to the analogue
value. This number is the digital
equivalent of the analogue signal.
 The combination graph shows the general principle. The grey curve
represents an analogue signal which, in this case, is a sine wave. For each
cycle of the sine wave, 13 digital samples are taken which encode the digital
representation of the signal.
Quantization errors
 Careful examination of the combination chart reveals that all is not well.
Note the samples at time points 7 and 13. These should be zero — however,
the conversion process does not convert them to zero but to a slightly
higher value. The other points show similar errors; this is the first type of
error that the conversion process can cause. These errors are known as
quantization errors.
Nyquist’s Theorem
 Nyquist’s theorem states that the minimum sampling rate frequency should
be twice the maximum frequency of the analogue signal.
A 4 kHz analogue signal would need to be sampled at twice that frequency to
convert it digitally. For example, a hi-fi audio signal with a frequency range of 20
to 20 kHz would need a minimum sampling rate of 40 kHz.
Codecs
 Where both A to D and D to A conversion is supported, they can also be called
codecs.
Linear
 A linear codec is one that is the same as the standard A to D and D to A
converters so far described, i.e. the relationship between the analogue input
signal and the digital representation is linear. The quantization step is the same
throughout the range and thus the increase in the analogue value necessary to
increment the digital value by one is the same, irrespective of the analogue or
digital values. Linear codecs are frequently used for digital audio.
A-law and -law
 For telecommunications applications with a limited bandwidth of 300 to
3100 Hz, logarithmic codecs are used to help improve quality. These codecs,
which provide an 8 bit sample at 8 kHz, are used in telephones and related
equipment. Two types are in common use: the a-law codec in the UK and
the μ-law codec in the US. By using a logarithmic curve for the quantization,
where the analogue increase to increment the digital value varies
depending on the size of the analogue signal, more digital bits can be
allocated to the more important parts of the analogue signal and thus
improve their resolution. The less important areas are given less bits and,
despite having coarser resolution, the quality reduction is not really
noticeable because of the small part they contribute to the signal.
PCM
 The linear codecs that have been so far described are also known as PCM —
pulse code modulation codecs. This comes from the technique used to
reconstitute the analogue signal by supplying a series of pulses whose
amplitude is determined by the digital value. This term is frequently used
within the telecommunications industry.
DPCM
 Differential pulse coded modulation (DPCM) is similar to PCM, except that
the value encoded is the difference between the current sample and the
previous sample. This can improve the accuracy and resolution by having a
16 bit digital dynamic range without having to encode 16 bit samples.
ADPCM
 Encoded as in DPCM but instead of using all the bits to encode the
difference, some bits are used to encode the quantization value that was
used to encode the data.
 This means that the resolution of the difference can be adjusted —adapted
— as needed and, by using non-linear quantization values, better resolution
can be achieved and a larger dynamic range supported.
Interrupts and Exceptions
 Exceptions and Interrupts are critical tools for making an embedded system
responsive while supporting concurrent operation of hardware and
software.
 Events such as hardware signals or anomalous program conditions can
trigger exceptions.
 A peripheral or external device sends a hardware signal to the exception
controller hardware to indicate that an event has occurred.
 The processor then serves(handles) the exception with these steps.
1. Pauses the current execution of program.
2. Saves context information such as registers and which instruction to
execute next in the current program.
3. Determine which handler(also called a service routine) to run. Each type
of exception or interrupt can have a separate handler.
4. Runs the code for the handler.
5. Restores the context information that was saved previously.
 The CPU performs most of this work automatically in hardware, making the
system more responsive. The only work performed in software is running
the handler.
 They enable many multitasking embedded systems to be responsive
without needing to use a task scheduler or kernel.
 Even by using software programs an exception or Interrupt is triggered.
Interrupt sources
 Internal interrupts
Internal interrupts are those that are generated by on-chip peripherals such
as serial and parallel ports.
 External interrupts
External interrupts are the common method of connecting external
peripherals to the processor. They are usually provided through external
pins that are connected to peripherals and are asserted by the peripheral.
 Software interrupts
The advantage of an interrupt is that it includes a mechanism to change the
program flow and in some processor architectures, to change into a more
protected state. This means that an interrupt could be used to provide an
interface to other software such as an operating system. This is the function
that is provided by the software interrupt. It is typically an instruction or set
of instructions that allows a currently executing software sequence to
change flow and return using the more normal interrupt mechanism.
 Non-maskable interrupts
A non-maskable interrupt (NMI) is as its name suggests an external interrupt
that cannot be masked out. It is by default at the highest priority of any
interrupt and will always be recognized and processed.

Recognizing an interrupt
The start of the whole process is the recognition of an interrupt. Internal
interrupts are normally defined by the manufacturer and are already hardwired.
External interrupts, however, are not and can use a variety of mechanisms.
 Edge triggered
With the edge triggered interrupt, it is the clock edge that is used to generate
the interrupt. The transition can either be from a logical high to low or vice
versa.
 Level triggered
With a level triggered interrupt, the trigger is dependent on the logic level.
 Maintaining the interrupt
So far, the recognition of an interrupt has concentrated on simply asserting
the interrupt pin. This implies that provided the minimum conditions have
been met, the interrupt source can be removed. Many microprocessor
manufacturers recommend that this is not done and that the interrupt
should be maintained until it has been explicitly serviced and the source told
to remove it.
 Internal queuing
The first interrupt would be recognized and, until it is serviced, all other
interrupts generated using the pin are ignored. This is one reason why many
processors insist on the maintain until serviced approach with interrupts. Any
subsequent interrupts that have the same level will be maintained after the
first one has been serviced and its signal removed. When the exception
processing is completed, the remaining interrupts will be recognized and
processed one by one until they are all serviced.

You might also like