Es Lecture Notes
Es Lecture Notes
UNIT - I
EMBEDDED SYSTEM: AN INTRODUCTION
OBJECTIVES
To understand what is an Embedded System and then define it
Look at embedded systems from a historical point of view
Classify embedded systems
Look at certain applications & purposes of embedded systems
Understand the characteristics of Embedded system
Understand the attributes related to quality of embedded system
INTRODUCTION
This chapter introduces the reader to the world of embedded systems. Everything that we
look around us today is electronic. The days are gone where almost everything was manual. Now
even the food that we eat is cooked with the assistance of a microchip (oven) and the ease at
which we wash our clothes is due to the washing machine. This world of electronic items is
made up of embedded system. In this chapter we will understand the basics of embedded system
right from its definition.
DEFINITION OF AN EMBEDDED SYSTEM
An embedded system is a combination of 3 things:
a. Hardware
b. Software
c. Mechanical Components
and it is supposed to do one specific task only.
Example 1: Washing Machine
A washing machine from an embedded systems point of view has:
a. Hardware: Buttons, Display & buzzer, electronic circuitry.
b. Software: It has a chip on the circuit that holds the software which drives controls &
monitors the various operations possible.
c. Mechanical Components: the internals of a washing machine which actually wash the
clothes control the input and output of water, the chassis itself.
Example 2: Air Conditioner
An Air Conditioner from an embedded systems point of view has:
Following are certain specific points of difference between embedded systems and
general purpose computers:
Sensors are connected to the input port for capturing the changes in environmental
variable and the actuators connected to the output port are controlled according to the
changes in the input variable.
Air conditioner system used to control the room temperature to a specified limit is a
typical example for CONTROL purpose.
6. Application specific user interface
Buttons, switches, keypad, lights, bells, display units etc are application specific user
interfaces.
Mobile phone is an example of application specific user interface.
In mobile phone the user interface is provided through the keypad, system speaker,
vibration alert etc.
CHARACTERISTICS & QUALITY ATTRIBUTES OF EMBEDDED SYSTEMS
The characteristics of embedded system are different from those of a general purpose
computer and so are its Quality metrics. This chapter gives a brief introduction on the
characteristics of an embedded system and the attributes that are associated with its quality.
CHARACTERISTICS OF EMBEDDED SYSTEM
Following are some of the characteristics of an embedded system that make it different
from a general purpose computer:
1. Application and Domain specific
An embedded system is designed for a specific purpose only. It will not do any other
task.
o Ex. A washing machine can only wash, it cannot cook
Certain embedded systems are specific to a domain
o Ex. A hearing aid is an application that belongs to the domain of signal
processing.
2. Reactive and Real time
Certain Embedded systems are designed to react to the events that occur in the nearby
environment. These events also occur real-time.
o Ex. An air conditioner adjusts its mechanical parts as soon as it gets a signal from
its sensors to increase or decrease the temperature when the user operates it using
a remote control.
An embedded system uses Sensors to take inputs and has actuators to bring out the
required functionality.
3. Operation in harsh environment
Certain embedded systems are designed to operate in harsh environments like very high
temperature of the deserts or very low temperature of the mountains or extreme rains.
These embedded systems have to be capable of sustaining the environmental conditions it
is designed to operate in.
4. Distributed
Certain embedded systems are part of a larger system and thus form components of a
distributed system.
These components are independent of each other but have to work together for the larger
system to function properly.
o Ex. A car has many embedded systems controlled to its dash board. Each one is
an independent embedded system yet the entire car can be said to function
properly only if all the systems work together.
5. Small size and weight
An embedded system that is compact in size and has light weight will be desirable or
more popular than one that is bulky and heavy.
o Ex. Currently available cell phones. The cell phones that have the maximum
features are popular but also their size and weight is an important characteristic.
For convenience users prefer mobile phones than phablets. (phone + tablet pc)
6. Power concerns
It is desirable that the power utilization and heat dissipation of any embedded system be
low.
If more heat is dissipated then additional units like heat sinks or cooling fans need to be
added to the circuit.
If more power is required then a battery of higher power or more batteries need to be
accommodated in the embedded system.
QUALITY ATTRIBUTES OF EMBEDDED SYSTEM
These are the attributes that together form the deciding factor about the quality of an
embedded system.
Maintainability deals with support and maintenance to the end user or a client in case of
technical issues and product failures or on the basis of a routine system check-up
It can be classified into two types :-
1. Scheduled or Periodic Maintenance
This is the maintenance that is required regularly after a periodic time interval.
Example: Periodic Cleaning of Air Conditioners, Refilling of printer cartridges.
2. Maintenance to unexpected failure
This involves the maintenance due to a sudden breakdown in the functioning of the
system.
Example: Air conditioner not powering on, Printer not taking paper in spite of a full
paper stack
e) Security
Confidentiality, Integrity and Availability are three corner stones of information
security. Confidentiality deals with protection data from unauthorized disclosure.
Integrity gives protection from unauthorized modification. Availability gives protection
from unauthorized use.
Certain Embedded systems have to make sure they conform to the security measures.
Ex. An Electronic Safety Deposit Locker can be used only with a pin number like a
password.
f) Safety
Safety deals with the possible damage that can happen to the operating person and
environment due to the breakdown of an embedded system or due to the emission of
hazardous materials from the embedded products.
A safety analysis is a must in product engineering to evaluate the anticipated damage and
determine the best course of action to bring down the consequence of damages to an
acceptable level.
Non Operational Attributes
a) Testability and Debug-ability
It deals with how easily one can test his/her design, application and by which mean
he/she can test it.
In hardware testing the peripherals and total hardware function in designed manner
UNIT - II
ELEMENTS OF EMBEDDED SYSTEMS
OBJECTIVES
Define and describe the elements of an embedded system
Understand how embedded system works with the help of two case studies:
o Washing Machine
o Microwave Owen
Understand the different types of core i.e processor
Understand difference between microprocessor & microcontroller
Understand the classification of processors based on Bus Architecture, Instruction set
Architecture and Endianness.
Have an overview of processors from most simple and cheap to most expensive and
complex, powerful
Understand what are sensors and actuators, communication interfaces
INTRODUCTION
The previous chapter was an introduction to the world of embedded systems and
helped us define what an embedded system is. This chapter introduces us to the elements
of an embedded system and explains how embedded system works with the help of two
case studies.
ELEMENTS OF EMBEDDED SYSTEMS
As defined earlier, 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:
3) Tub: There are two types of tubs in the washing washing machine: inner and outer. The
clothes are loaded in the inner tub, where the clothes are washed, rinsed and dried. The inner tub
has small holes for draining the water. The external tub covers theinner tub and supports it
during various cycles of clothes washing.
4) Agitator or rotating disc: The agitator is located inside the tub of the washing machine. It is
the important part of the washing machine that actually performs the cleaning operation of the
clothes. During the wash cycle the agitator rotates continuously and produces strong rotating
currents within the water due to which the clothes also rotate inside the tub. The rotation of the
clothes within water containing the detergent enables the removal of the dirt particles from the
fabric of the clothes. Thus the agitator produces most important function of rubbing the clothes
with each other as well as with water.
In some washing machines, instead of the long agitator, there is a disc that contains blades on its
upper side. The rotation of the disc and the blades produce strong currents within the water and
the rubbing of clothes that helps in removing the dirt from clothes.
5) Motor of the washing machine: The motor is coupled to the agitator or the disc and
produces it rotator motion. These are multispeed motors, whose speed can be changed as per the
requirement. In the fully automatic washing machine the speed of the motor i.e. the agitator
changes automatically as per the load on the washing machine.
A waveguide, and
A cooking chamber
1. A Transformer transfers electrical energy through a circuit by magnetic coupling without
using motion between parts. These are used for supplying power to the magnetron.
2. Cavity magnetron is a microwave antenna placed in a vacuum tube and oscillated in an
electromagnetic field in order to produce high GHz microwaves. Magnetrons are used in
microwave ovens and radar systems.
3. A control circuit with a microcontroller is integrated on a circuit board. The microcontroller
controls the waveguide and the entire unit so the microwaves are emitted at a constant rate.
4. A Waveguide is any linear structure that guides electromagnetic waves for the
purpose of transmitting power or signals. Generally constructed of a hollow metal pipe.
Placing a waveguide into a vacuum causes radio waves to scatter.
5. A Cooking Chamber is a microwave safe container the prevents microwaves
from escaping. The door has a microwave proof mesh with holes that are just small
enough that microwaves can't pass through but lightwaves can. The cooking chamber
itself is a Faraday cage enclosure which prevents the microwaves from escaping into the
environment. The oven door is usually a glass panel for easy viewing, but has a layer of
conductive mesh to maintain the shielding.
CORE THE OF EMBEDDED SYSTEM
Embedded systems are domain and application specific and are built around a
central core. The core of the embedded system falls into any of the following categories:
General purpose and Domain Specific Processors
o Microprocessors and Microcontrollers
o Digital Signal Processors
Application Specific Integrated Circuits. (ASIC)
Programmable logic devices(PLD’s)
Commercial off-the-shelf components (COTs)
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.
MICROPROCESSORS
A microprocessor is a silicon chip representing a central processing unit.
A microprocessor is a dependent unit and it requires the combination of other hardware
like memory, timer unit, and interrupt controller, etc. for proper functioning.
Developers of microprocessors.
o Intel – Intel 4004 – November 1971(4-bit). o Intel – Intel 4040.
o Intel – Intel 8008 – April 1972.
o Intel – Intel 8080 – April 1974(8-bit). o Motorola – Motorola 6800.
o Intel – Intel 8085 – 1976.
o Zilog - Z80 – July 1976.
Architectures used for processor design are Harvard or Von-Neumann.
RISC and CISC are the two common Instruction Set Architectures (ISA)
available for processor design.
Endiannes
Endianness specifies the order which the data is stored in the memory by
processor operations in a multi byte system.
Based on Endiannes processors can be of two types:
o Little Endian Processors
o Big Endian Processors
1. Little-endian means lower order data byte is stored in memory at the lowest
address and the higher order data byte at the highest address. For e.g, 4 byte long
integer Byte3, Byte2, Byte1, Byte0 will be store in the memory as follows:
2. Big-endian means the higher order data byte is stored in memory at the
lowest and the lower order data byte at the highest address. For e.g. a 4 byte integer
Byte3, Byte2, Byte1, Byte0 will be stored in the memory as follows:
Microcontrollers
A microcontroller is a highly integrated chip that contains 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.
Texas Instrument’s TMS 1000 Is considered as the world’s first microcontroller.
Some embedded system application require only 8 bit controllers whereas some
requiring superior performance and computational needs demand 16/32 bit controllers.
The instruction set of a microcontroller can be RISC or CISC.
Most of the ASICs are proprietary (which having some trade name) products, it is
referred as Application Specific Standard Products (ASSP).
As a single chip ASIC consumes a very small area in the total system. Thereby helps in
the design of smaller system with high capabilities or functionalities.
The developers of such chips may not be interested in revealing the internal detail of it .
Programmable Logic Devices (PLD’s)
A PLD is an electronic component. It used to build digital circuits which are
reconfigurable.
A logic gate has a fixed function but a PLD does not have a defined function at the time
of manufacture. PLDs offer customers a wide range of logic capacity, features, speed,
voltage characteristics.
PLDs can be reconfigured to perform any number of functions at any time.
A variety of tools are available for the designers of PLDs which are inexpensive and help
to develop, simulate and test the designs.
PLDs having following two major types.
o CPLD (Complex Programmable Logic Device): CPLDs offer much smaller
amount of logic up to 1000 gates.
o FPGA (Field Programmable Gate Array): It offers highest amount of
performance as well as highest logic density, the most features.
Advantages of PLDs:-
1. PLDs offer customer much more flexibility during the design cycle.
2. PLDs do not require long lead times for prototypes or production parts because PLDs are
already on a distributors shelf and ready for shipment.
3. PLDs can be reprogrammed even after a piece of equipment is shipped to a customer
Commercial off-the-shelf components (COTs)
A Commercial off the Shelf product is one which is used 'as-is'.
The COTS components itself may be develop around a general purpose or domain
specific processor or an ASICs or a PLDs.
The major advantage of using COTS is that they are readily available in the market, are
chip and a developer can cut down his/her development time to a great extent
The major drawback of using COTS components in embedded design is that the
manufacturer of the COTS component may withdraw the product or discontinue the
production of the COTS at any time if rapid change in technology occurs.
Advantages of COTS:
1. Ready to use
2. Easy to integrate
3. Reduces development time
Disadvantages of COTS:
1. No operational or manufacturing standard (all proprietary)
2. Vendor or manufacturer may discontinue production of a particular COTS product
SENSORS & ACTUATORS
Sensor
A Sensor is used for taking Input.
It is a transducer that converts energy from one form to another for any measurement or
control purpose
Ex. A Temperature sensor
Actuator
Actuator is used for output.
It is a transducer that may be either mechanical or electrical which converts signals to
corresponding physical actions.
Ex. LED (Light Emitting Diode)
LED (Light Emitting Diode)
LED is a p-n junction diode and contains a Cathode and Anode
For functioning the anode is connected to +ve end of power supply and cathode is
connected to –ve end of power supply.
The maximum current flowing through the LED is limited by connecting a RESISTOR in
series between the power supply and LED as shown in the figure below
It is synchronous
Bi-directional, half duplex , two wire serial interface bus
Developed by Phillips semiconductors in 1980
It comprises of two buses :
o Serial clock –SCL
o Serial Data – SDA
SCL generates synchronization clock pulses & SDA transmits data serially across devices
I2C is a shared bus system to which many devices can be connected
Devices connected by I2C can act as either master or slave
The master device is responsible for controlling communication by initiating/ terminating
data transfer. Devices acting as slave wait for commands from the master and respond to
those commands.
RS 232 interface is a point to point communication interface and the devices involved are
called as Data Terminating Equipment (DTE) And Data Communications Terminating
Equipment (DCE)
Embedded devices contain UART for serial transmission and generate signal levels as per
TTL/CMOS logic.
A level translator IC (like Max 232) is used for converting the signal lines from UART to
RS 232 signal lines for communication. The vice versa is performed on the receiving
side.
Converter chips contain converters for both transmitters and receivers
RS 232 is used only for point to point connections
It is susceptible to noise and hence is limited to short distances only
RS 422 is another serial interface from EIA.
It supports multipoint connections with 1 transmitter and 10 receivers.
It supports data rates up to 100Kbps and distance up to 400 ft
RS 485 is enhanced version of RS 422 and supports up to 32 transmitters and 32
receivers
REVIEW QUESTIONS
1. What is an embedded system? What are the working elements of an embedded
system?
2. What do you mean by core of the embedded system? What is its significance? What
are the possible options that can be used as a core?
3. Distinguish between Microprocessor & Microcontroller.
4. Explain the different types of processors according to their system bus
architecture.
5. Explain the different types of processors according to Instruction set
Architecture.
6. Explain the different types of processors according to Endianness.
7. Write short note on :
a. DSP
b. PLD
c. ASIC
d. COTS
8. Explain Communication Interfaces with respect to embedded system
9. Explain the following with example:
a. Onboard communication interface
b. Peripheral communication interface
10. Find out information and write case studies on the following communication interfaces:
Infrared, Wi-Fi, Zigbee and UART.
TYPES OF RAM
There are two important memory devices in the RAM family.
SRAM (Static RAM)
DRAM (Dynamic RAM)
SRAM (Static RAM)
It retains the content as long as the power is applied to the chip.
If the power is turned off then its contents will be lost forever.
DRAM (Dynamic RAM)
DRAM has extremely short Data lifetime (usually less than a quarter of second). This is
true even when power is applied constantly.
A DRAM controller is used to make DRAM behave more like SRAM.
The DRAM controller periodically refreshes the data stored in the DRAM. By refreshing
the data several times a second, the DRAM controller keeps the contents of memory alive
for a long time.
TYPES OF ROM
There are three types of ROM described as follows:
Masked ROM
These are hardwired memory devices found on system.
It contains pre-programmed set of instruction and data and it cannot be modified or
appended in any way. (It is just like an Audio CD that contains songs pre-written on it
and does not allow to write any other data)
The main advantage of masked ROM is low cost of production.
PROM (PROGRAMMABLE ROM )
This memory device comes in an un- programmed state i.e. at the time of purchased it is
in an un -programmed state and it allows the user to write his/her own program or code
into this ROM.
In the un-programmed state the data is entirely made up of 1’s.
PROMs are also known as one-time-programmable (OTP) device because any data can
be written on it only once. If the data on the chip has some error and needs to be
modified this memory chip has to be discarded and the modified data has to be written to
another new PROM.
In the absence of DMA the processor must read the data from one device and write it to
the other one byte or word at a time.
DMA Absence Disadvantage: If the amount of data to be transferred is large or frequency
of transfer is high the rest of the software might never get a chance to run.
DMA Presence Advantage: The DMA Controller performs entire transfer with little help
from the Processor.
Working of DMA
The Processor provides the DMA Controller with source and destination address & total
number of bytes of the block of data which needs transfer.
After copying each byte each address is incremented & remaining bytes are reduced by
one.
When number of bytes reaches zeros the block transfer ends & DMA Controller sends an
Interrupt to Processor.
The information about a task is recorded in a data structure called the task context. When
a task is executing, it uses the processor and the registers available for all sorts of
processing. When a task leaves the processor for another task to execute before it has
finished its own, it should resume at a later time from where it stopped and not from the
first instruction. This requires the information about the task with respect to the registers
of the processor to be stored somewhere. This information is recorded in the task context.
A C++ version of a Task that holds all information needed by operating system is as
follows:
class Task
{ public:
Task(void (*function)(), Priority p, int stackSize);
TaskId id;
Context context;
TaskState state;
Priority priority;
int * pStack; Task * pNext;
void (*entryPoint)();
private:
static TaskId nextId; };
Task States
In an operation system there are always multiple tasks. At a time only one task can be
executed. This means that there are other tasks which are waiting their turn to be
executed.
Depending upon execution or not a task may be classified into the following three states:
o Running state - Only one task can actually be using the processor at a given time
that task is said to be the “running” task and its state is “running state”. No other
task can be in that same state at the same time
o Ready state - Tasks that are are not currently using the processor but are ready to
run are in the “ready” state. There may be a queue of tasks in the ready state.
o Waiting state - Tasks that are neither in running nor ready state but that are
waiting for some event external to themselves to occur before that can go for
execution on are in the “waiting” state.
Round Robin
Round robin scheduling uses algorithms that allow every task to execute for a fixed
amount to time.
A running task is interrupted an put to a waiting state if its execution time expires.
Scheduling Points
The scheduling points are the set of operating system events that result in an invocation
of the scheduler.
There are three such events: task creation and task deletion. During each of these
events a method is called to select the next task to be run.
A third scheduling point called the clock tick is a periodic event that is triggered by a
timer interrupt. When a timer expires, all of the tasks that are waiting for it to complete
are changed from the waiting state to the ready state.
Ready List
The scheduler uses a data structure called the ready list to track the tasks that are in the
ready state.
The ready list is implemented as an ordinary linked list, ordered by priority.
So the head of this list is always the highest priority task that is ready to run.
Idle task
If there are no tasks in the ready state when the scheduler is called, the idle task will be
executed.
The idle task looks the same in every operating system.
The idle task is always considered to be in the ready state.
CONTEXT SWITCH
The actual process of changing from one task to another is called Context Switch.
Since contexts are processor-specific, so is the code that implements the context
switches, hence, it must always be written in assembly language.
TASK SYNCHRONIZATION
All the tasks in the multitasking operating systems work together to solve a larger
problem and to synchronize their activities, they occasionally communicate with one
another.
For example, in the printer sharing device the printer task doesn’t have any work to do
until new data is supplied to it by one of the computer tasks.
So the printer and the computer tasks must communicate with one another to coordinate
their access to common data buffers.
One way to do this is to use a data structure called a mutex.
Mutexes are mechanisms provided by many operating systems to assist with task
synchronization.
A mutex is a multitasking-aware binary flag. It is because the processes of setting and
clearing the binary flag are atomic (i.e. these operations cannot be interrupted).
When this binary flag is set, the shared data buffer is assumed to be in use by one of the
tasks. All other tasks must wait until that flag is cleared before reading or writing any of
the data within that buffer.
The atomicity of the mutex set and clear operations is enforced by the operating system,
which disables interrupts before reading or modifying the state of the binary flag.
REAL TIME CHARACTERISTIC
An Operating system is called “Real-Time Operating System” (RTOS) only if it has
following characteristics:
i. Deterministic
An OS is said to be deterministic if the worst case execution time of each of the system
calls is calculable. The data sheet of an OS should publish the real-time behavior of its
RTOS provides average, minimum and maximum number of clock cycles required by
each system call.
ii. Interrupt Latency
Interrupt Latency is the total length of time from an interrupt signal’s arrival at the
processor to the start of the associated interrupt service routine.
iii. Context Switch
Context Switch is important because it represents overhead across your entire system.
SELECTION PROCESS
The process of selecting the best commercial operating system that best fits the needs of
one’s project depends on various factors. Commercial operating systems form a
continuum of functionality, performance and price.
Operating Systems that offer only a basic scheduler and a few other system calls are
inexpensive and come with the source code that one can modify and do not require
payment of royalties.
While on the other hand operating systems that include a lot of useful functionality
beyond just the scheduler are quite expensive and royalties due on every copy shipped in
ROM and they might also make a stronger guarantees about real-time performance.
Two important points to be considered while selecting an operating system :-
Put your processor, real time performance and budgetary requirements first.
Contact all of the vendors of the remaining operating systems for more detailed technical
information.
REVIEW QUESTIONS
1. Explain the embedded Operating system with respect to
i) Tasks
ii) Task States
2. Explain Scheduler with respect to:
i) Scheduling Points
ii) Ready List
iii) Idle task
3. Write a short note on Context Switch and Task Synchronization
4. Explain the Real Time Characteristic of embedded operating system.