You are on page 1of 110

Unit – I

Introduction to Embedded System


• Definition – “Embedded systems are
computing systems with tightly coupled
hardware and software integration, which are
designed to perform a dedicated function”.
• Explanation – An embedded system is a
combination of computer hardware along
with the mechanical or electrical parts, and
system software to perform some specific
task.
Embedded system and General
purpose computer system
• An embedded system refers to “A computer
which has been designed to do specialized
tasks. Example – Vending machine machine or
printer etc.
• General purpose computer system is a
combination of hardware and software which
performs different task by following the
instruction provided by the user .It is not
designed to solve any particular problem.
Difference b/w E.S and G.P.Computer
E.S
system
• An embedded system is designed to perform some special
task.
• It uses simplified circuit.
• Less memory is required.
• It uses slow processor.
• It is low in cost.
General Purpose computer system

• It is designed to perform a variety of task.


• The circuit is more complex.
• It requires more memory.
• It requires high speed processor.
• It is high in cost
Classification of Embedded System

Classification of E.S

Classification based on
Classification based on the
Hardware and
Function
software Complexity

Netw
Standalon ork Mobile Mediu
Real Sophis
e Appli Embedded Small m
Time ticated
embedded catio System Scale E.S scale
E.S E.S
system n E.S
Classification based on the Function
• Standalone E.S – It is built using a specialized
communication processor, memory a number
of network access interfaces and special
software that implements logic for sending
information from one device to another
decice.
• Real Time E.S – It monitors the
Purpose of E.S
• E.S are small, fast and very powerful tools.
• An E.S is a micro-processor based system that is built to
control a function or range of functions .
• E.S is designed to perform one or a few dedicated or
specific functions but with choices and different options.
• E.S are often required to provide Real-Time response.
• A Real-Time is defined as a system whose correctness
depends on the timeliness of its response. Example –
flight control system of an aircraft, sensor system in
nuclear reactors and power plants.
Why do we need E.S
• General purpose computers like PC’s would be too costly
for the majority of products that incorporate some form of
E.S technology.
• General purpose computers might fail to meet a number of
functional or performance requirements such as
constraints in power-consumption, size limitation etc.
• In todays digital world the life totally depends on at least
one piece of equipment which contains processor like a
phone, television, washing machine etc.
• The power requirement of E.S like cell phone , cameras are
very less as compared to the other general purpose
computer system.
Application of E.S
Some applications of E.S are as follows:
Automobile Sector:
E.S is widely used in automobile industries not only in the
development of automobiles but also in vehicles for achieving various
automated operations.
Automobile sector uses the embedded system in the following:
Anti-lock braking system(ABS)
Electronic Stability Control (ESC/ESP)
Traction Control (TCS)
Automatic Four-Wheel Drive
Fuel Injecton Control
Air bags and Automatic braking
Car Entertainment systems
• Telecommunication- This industry utilizes
numerous embedded systems from telephone
switches for the network to mobile phones at the
enduser.
• Telecom industry uses the E.S in the following:
 In Telephone lines to route data
 For messaging
 For other multimedia features in cell phones
and other devices.
 In network router and bridges
 Rocket and satellite control.
 Air Traffic Control.
• Aerospace and Avionics – E.S is more popular in this
field because a complex mixture of hardware,
electronics and embedded software is required to fulfill
the requirements.
• Embedded engineers confront major challenges in this
field like:
• Specially designed programs that helps to synchronize
the hardware of aero vehicles and the system software
of ATC, to take-off and landing the aero-vehicles.
• Ensuring that the complex software and hardware
interactions are right.
• Assembling components that meet specifications and
perform effectively together.
• Understanding the larger context of the embedded
software.
• Consumer Electronics: This field has benefited
a lot from embedded technologies like:
• MP3 Players
• Mobile Phones
• Digital Cameras
• Printers
Defense: The defense field also uses the E.S
services in RADARs, Guided Missile Systems,
automated guns and satellite phones.
Hardware
Processor – or the CPU is responsible for performing all
the computational and logical operations in an E.S.
Memory – It is odevice which can be used to store data in
a system. An E.S can have on-chip or off –chip memory.
There are different kinds of memory devices.
User Interface – It is a mechanism through which user can
provide certain choices to the E.S. These choices are
used by the CPU to perform a given task in certain
manner. Keypad is one of the most common UI.
Displays – These are used to provide certain
information to the user. Alphanumeric Displays
and LCD displays are widely used in embedded
device.
Input/Output: I/O peripherals provide a physical
media for Data Transfer with the external world.
Other Electrical Components: There are plenty
of other active and passive components in an
E.S. Examples Power supply, Data Converters
etc.
Software
• Control software:- It is responsible for
managing different modules of the system.
• Computation Extensive software: - It is
responsible for performing mathematical and
logical operations on the input data. The
output of this can be sent back or stored for
later use or can be used by the control
software to take certain decisions.
• Device Drivers: - These are the software
modules which control system’s peripheral.
• User Interface:- This software is responsible
for collecting user inputs and providing “User
Menu” or “System Status” to the user.
• Operating system : It is a software which
manages the different resources of a system
and provides an abstraction of the underlying
hardware to the users.
Microprocessors and Microcontrollers
• Microprocessors – It is a programmable integrated
circuit that can perform any type of arithmetic or
logical operation within a fraction of second.
• It forms a vital role on a computer system.
• Microprocessor is a high speed computer with less
storage capacity within it.
• It is also called as CPU or Central Processing Unit.
• It is the heart of a computer.
• It is a complete computation engine that is fabricated
on a single chip.
• The first miroprocessor was developed by intel
Working of Microprocessor
• A microprocessor executes a collection of
machine instructions that tell the processor what
task to do.
• A microprocessor does three basic things:-
 Using ALU it can perform mathematical
operations like addition, subtraction,
multiplication and division.
 It can move data from one memory location to
another.
 It can make decisions and jump to a new set of
instructions based on those decisions.
Microcontroller
• It is a small computer on a single integrated
circuit containing a processor core, memory and
programmable input/output peripherals.
• It is designed for personal computers or other
general purpose applications.
• They are used in automatically controlled
products and devices like automobile engine
control systems, applications etc.
• Microcontrollers are special purpose computer.
• Microcontrollers are embedded inside some
other device so that they can control the
features or actions of the product.It is also
called as “embedded controller”.
• They are dedicated to do one task and run one
specific program. The programs are stored in
ROM.
• They are low power devices ie they consume
less power.
• It has a dedicated input device and often has a
small LED or LCD display for output.
• It is often small and low cost.
Difference b/w Microprocessor and
Microcontroller
Microprocessor –
 It is a general purpose device that finds its applications in
most of the electronic device.
 It is a dependant unit that requires other chips for its proper
operation.
 It is called as a IC which contains many useful functions.
 It requires external memory devices to stored set of
instructions to carry out user defined tasks.
 It main use is to read data, perform extensinve calculations on
that data, and store the results in a mass storage device or
display the results.
 Example for microprocessor is 8085.
 It uses the memory chips to get the data.
• Microcontroller.
 It is a specific purpose device which has a specific
task for a sepecfic device.
 It is an independent device that does not require any
other specific chips.
 It is called as Microchip which contains the
components of microprocessor.
 It has the ability to execute a stored set of
instructions to carry out user defined tasks.
 It is used to control the operations of a machine
using a fixed program that is stored in Rom and does
not change over the lifetime of the system.
 Example of microcontroller is 8051.
RISC AND CISC Controllers
• RISC – Reduced Instruction Set Computing
It is designed to perform a smaller number of
types of computer instructions so that it can
operate at a higher speed.
The range of instructions is 30 to 40.
It is a type of microprocessor architecture that
utilizes a small, highly-optimezed set of
instructions , rather than a more specialized set
of instructions often found in other types of
architectures.
• CISC- Complex Instruction Set Computing
Here a single instruction can execute several
low-level operations and is capable of
performing multi-step operations or
addressing modes within single instructions.
Pentium microprocessors are CISC
microprocessors.
Difference b/w RISC and CISC
• RISC –
 It has lesser number of instructions.
 It uses High level instructions.
 Provides instruction pipelining.
 Increased execution speed.
 Single fixed length instruction.
 Less silicon and pins are used.
 Design time is reduced.
 It uses Harvard Architecture.
 Large number of registers are available.
• CISC
It has more number of instructions.
It rarely uses high-level instructions.
Instruction pipelining is not used.
Comparative lesser speed.
Variable length instructions.
More silicon and pins are used.
Increased design time.
Uses Von Neumann Architecture.
Limited number of general purpose registers
available.
Big Endian and Little Endian Processors
• Big Endian and Little Endian processors
describe the order in which a sequence of
bytes are stored in computer memory.
Big Endian is an order in which the most
significant value in the sequence is stored first at
the lowest storage address.
Little Endian is an order in which the least
significant value in the sequence is stored first.
Application Specific Integrated
Circuits(ASIC)
• It is designed to perform some specific function
or task.
• It is a microchip customized for a particular use
rather than for general purpose use.
• Ex- A chip designed solely to run a cell phone is
an ASIC.
• It include entire 32-bit processors , memory
blocks including ROM, RAM, EEPROM, Flash and
other large building blocks.
• ASIC is often termed as SoC (System-on-a-Chip).
ASCIsTypes
• ASCIs are categorized according to the technology used for
manufacturing them. They are:
• Full-custom- The full custom IC’S are the ASIC that cannot be
modified to suit for the different applications.
• These are entirely tailor-fitted to a particular application from
the very start.
• As its design and functionality is pre-specified by the user it is
manufactured with all the layers fully defined like off-the-shelf
general purpose IC’S.
• Semi-custom – These ASCI can be modifies partially.
• Semi-custom ASIC’S can be partly customized to serve
different functions within its general area of application.
• Semi-custom ASIC’S are designed to allow a certain degree of
• Structured or Platform ASIC –
• This belongs to a relatively new ASIC
classification.
• These are designed and produced from a
tightly defined set of design methodologies
,intellectual properties and well-characterized
silion.
• This type of ASIC is developed for shortening
the design cycle and minimizing the
development costs of the ASIC.
Programmable Logic Devices(PLD)
• It is an electronic component used to build
reconfigurable digital circuits.
• A PLD has an undefined function at the time
of manufacture.
• Before the PLD can be used in a circuit it must
be programmed that is reconfigured.
Classification of PLD

Classification of
Devices

Fixed Logic Programmable


Devices Logic Devices
FLD PLD
FLD
• The circuits in a FLD are permanent.
• They are made to perform one function or set
of functions.
• Once FLD’S are manufactured they cannot be
changed.
• With FLD’s the time required to go from
design, to prototypes, to a final manufacturing
run can take from several months to a year.
Sensors
• Sensors are also called as detectors.
• The changes in the system environment or variables are
detected by the sensors connected to the input port of the
embedded system.
• It is a transtrucer that converts energy from one type to
another type for any particular purpose.
• Example- ECG machine it is designed to monitor the heart
beat status of a patient and it canot impose a control over
the patient’s heart beat and its order. The sensors are used
here are the different electrode sets connected to the body
of the patient.
• The variations are captured and presented to the user
through a visual display or some printed chart.
Actuators
• Actuator is a form of transducer device which converts
signals to corresponding physical action.
• Actuator acts as an output device.
• If the embedded system is designed for any controlling
purpose the system will produce some changes in the
controlling variable to bring the controlled variable to
the desired value. This is achieved through an actuator
connected to the output port of the embedded system.
• If the E.S is designed for monitoring purpose only then
there is no need for including an actuator in the
system.
Types of Actuators

Classification of Actuators

Multi-Turn Actuator Part-Turn Actuator Linear Actuator


Multi-turn Actuator-
• It is an actuator which transmits to the valve a
torque for at least one full revolution. It is
capable of withstanding thrust.
• It is required for the automation of multi-turn
valves.
• One of the main type of this is the gate valve.
Part-turn actuators –
• It is an actuator which transmits a torque to the
valve for less than one full revolution. It is not
capable of withstanding thrust.
• The major representatives of this type are
butterfly valves and ball valves.
Linear Actuator –
• The major representative of this type are the
control valves.
• Just like the plug in the bathtub is pressed into
the drain the plug is pressed into the plug seat by
a stroke.
Communication Interface
• These are the devices through with the E.S can
interact with various subsystems and the
external world.
• For embedded product communication interface
can be viewed in two different perspectives :
1)Device/board level communication interface(On
board communication Interface)
2)Product level communication interface (External
communication interface)
Onboard communication Interface
• The communication channel which
interconnects the various components within
an embedded product is referred as
device/broad level communication interface.
• Examples – Serial interfaces like I2C,I-Wire,
and parallel bus interface.
External Communication interface
• These are the E.S which may be a part of large
distributed system and they require interaction and
data transfer between various devices and sub-
modules.
• The product level communication interface is
responsible for data transfer between the E.S and other
devices or modules.
• The external communication interface can be either a
wired media or a wireless media and it can be a serial
or a parallel interface.
• Examples – Infrared (IR), Bluetooth(BT), Wireless LAN
(Wi-Fi),Radio Frequency waves etc.
On Board Communication Interface
Inter Integrated Circuit Bus (I2C Bus) –
• It is a synchronous bi-directional half duplex two
–wire serial bus which provides communication
link between integrated circuits.
• It was designed by Philips Semiconductors in
1980s.
• It was developed to provide an easy way of
connection between a microprocessor /
microcontroller system and peripheral chips in
television sets.
• It comprises of two bus lines i.e Serial Clock-SCL and Serial
Data-SDA.
• SCL line is responsible for generating synchronisation clock
pulses.
• SDA is responsible for transmitting the serial data across
devices.
• I2C bus is a shared bus system to which many number of
I2C devices can be connected.
• Devices connected to the I2C nus can act as either
“Master” device or “Slave” device.
• The Master device is responsible for controlling the
communication by initiating or terminating data transfer,
sending data and generating necessary synchronisation
clock pulses.
• The Slave devices wait for the commands from the Master
and respond upon receiving the commands.
• Master and Slave devices can act as either
transmitter or receiver.
• Regardless whether a master is acting as
transmitter or receiver the synchronisation
clock signal is generated by Master device
only.
• I2C supports multi masters on the same bus.
External Communication Interfaces
• Infrared –
Infrared is a serial ,half duplex, line of sight based wireless technology
for data communication between devices.
The remote control of TV, AC works on the infrared data
communication principle.
IR uses infrared waves of the electromagnetic spectrum for
transmitting the data.
It supports point-point and point-to-multipoint communication.
The typical communication range for IR lies in the range of 10 cm to
1m.
The range can be increased by increasing the tranmitting power of the
IR device.
IR supports data rates ranging from 9600bits/sec to 16Mbps.
UNIT –II
Characteristics and Quality Attributes of E.S
Embedded systems possess certain specific
characteristics and these are unique to each
embedded system.
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
Application and Domain Specific –
• Each E.S 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.
• Ex – 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.
Reactive and Real Time –
• E.S are in constant interaction with the real world through
sensors and user-defined input devices which are
connected to the input port of the system.
• Any changes in the real world care captured by the sensors
or input devices in real time and the control algorithm
running inside the unit reacts in a designed manner to
bring the controlled output variables to the desired level.
• E.S 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 ie the system should
respond to requests in a known amount of time.
• Example – E.S which are mission critical like flight control
systems, Antilock Brake Systems (ABS) etc are Real Time
systems.
Operates in Harsh Environment –
• The design of E.S should take care of the
operating conditions of the area awhere the
system is going to implement.
• Ex – 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.
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.
• Ex – 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.
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.
• In embedded domain compactness is a
significant deciding factor.
Power Concerns –
• Power management is another important
factor that needs to be considered in
designing embedded systems.
• E.S should be designed in such a way as 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 Operational
quality attributes and non-operational quality
attributes.
Quality Attributes of E.S

Operation Q.A Non-Operational Q.A

Response Testability and Debug-ability

Throughput Evolvability

Reliability Portability

Maintainability Time to Prototype and Market


Security
Per Unit and Total Cost
Safety
Operational Quality Attributes
• The operational quality attributes represent the relevant
quality attributes related to the embedded system when it
is in the operational mode or online mode.
Operational Q.A are:
Response –
It is the measure of quickness of the system.
It tells how fast the system is tracking the changes in input
variables.
Most of the E.S demand fast response which should be almost
real time.
Ex – Flight control application.
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.
• Ex – In case of 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.
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.
• 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 embedded system with critical application
need, it should be of the order of minutes.
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.
• Reliability and maintainability are
complementary to each other.
• A more reliable system means a system with
less corrective maintainability requirements
and vice versa.
• As the reliability of the system of the system
increases the chances of failure and non-
functioning also reduces thereby the need for
maintainability is also reduced.
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, pubic and the
environment due to the breakdown of an E.S .
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
determine the best course of action to bring
down the consequences of the damages to an
acceptable level.
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.
Testability and Debug-ability –
• Testability deals with how easily one can test the
design, application and by which means it can be done.
• For an E.S testability is applicable to both the
embedded hardware and firmware.
• Embedded hardware testing ensures that the
peripherals and total hardware functions in the desired
manner, whereas firmware testing ensures that the
firmware is functioning in the expected way.
Evolvability –
• It is a term which is closely related to Biology.
• It is referred as the non-heritable variation.
• For an embedded system evolvability refers to
the ease with which the embedded product can
be modified to take advantage of new firmware
or hardware technology.
Portability-
• It is the measure of system independence.
• An embedded product is said to be portable if the
product is capable of functioning in various
environments, target processors and embedded
operating systems.
Time-to-Prototype and Market –
It is the time elapsed between the
conceptualisation of a product and the time at
which the product is ready for selling.
Per Unit Cost and Revenue –
• Cost is a factor which is closely monitored by
both end user and product manufacturer.
• 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.
Unit- II Chapter- II
Application and Domain Specific
• The embedded systems are basically application
specific or domain specific.
• Application specific means the particular system
is designed for some specific application only like
cell phones, washing machine, camera etc.
• Domain Specific – The major application domains
of embedded systems are consumer, industrial,
automotive, telecom etc of which telecom and
automotive industry holds a big market share.
Application Specific E.S
One of the example of application specific E.S is a washing machine.
• Washing machine contains sensors, actuators, control unit and application
–specific user interfaces like keyboards, display units etc.
• The actuator part of the washing machine consists of motorised agitator,
tumble tub, water drawing pump and inlet valve to control the flow of
water into the unit.
• The sensor part consists of the water temperature sensor, level sensor etc.
• The control part contains a microprocessor/ controller based board with
interfaces to the sensors and actuators.
• The sensor data is fed back to the control unit and the control uint
generates the necessary actuator outputs.
• The control unit also provides connectivity to user interfaces like keypad
for setting the washing time, selecting the type of material to be washed
like light, medium, heavy duty etc.
• User feedback is reflected through the display unit and LEDs connected to
the control board.
Washing Machine Models
• Washing machine comes in two models ie – Top
loading and Front loading machines.
Top loading machine –
In top loading models the agitator of the machine
twists back and forth and pulls the cloth down to
the bottom of the tub.
On reaching the bottom of the tub the clothes work
their way back up to the top of the tub where the
agitator grabs them again and repeats the
mechanism.
Front loading –
In front loading machines the clothes are tumbled
and plunged into the water over and over again.
This is the first phase of washing.
In the second phase of washing, water is pumped
out from the tub and the inner tub uses centrifugal
force to wring out more water from the clothes by
spinning at several hundred rotations per minute
(RPM) . This phase is called as “Spin Phase”.
In the keyboard panel of the washing machine we
can see three buttons like wash, spin and rinse.
These buttons can be used to configure the washing
stages.
The inner tub of the machine contains a number of holes and
during the spin cycle the inner tub spins, and forces the water
out through these holes to the stationary outer tub from
which it is drained off through the outlet pipe.
The design of washing machines may vary from manufacturer
to manufacturer but the general principle underlying in the
working of the washing machine remains the same.
The basic controls consist of a timer, cycle selector
mechanism, water temperature selector, load size selector
and start button.
The mechanism includes the motor, transmission, clutch,
pump, agitator, inner tub, outer tub and water inlet valve.
Water inlet valve connects to the water supply line using at
home and regulates the flow of water into the tub.
The integrated control panel consists of a
microprocessor/controller based board with I/O interfaces
and a control algorithm running in it.
Input interface includes the keyboard which
consists of wash type selector namely wash, spin
and rinse, cloth type selector namely Light,
Medium, Heavy duty and Washing time setting etc.
The output interface consists of LED/LCD displays,
status indication LEDs etc. connected to the I/O bus
of the controller. This interface may vary from
manufacturer to manufacturer and model to model.
The other types of I/O interfaces which are invisible
to the end user are different kinds of sensor
interfaces like water temperature sensor, water
level sensor, etc and actuator interface including
motor control for agitator and tub movement
control, inlet water flow control etc.
Domain Specific Embedded System
Domain –specific modeling is an emerging
technology.
The domain specific embedded system is a
combination of various application specific
embedded systems.
The major domain specific embedded system
are industrial, consumer, telecom and
automotive.
Domain Specific Embedded System
Automotive
Automotive embedded systems are the one
where electronics take control over the
mechanical systems.
The presence of automotive embedded system
in a vehicle varies from simple mirror and wiper
controls to complex air bag controller and
antilock brake systems (ABS).
Inner Working of Automotive E.S
• Automotive embedded systems are normally built
around microcontrollers or DSPs or a hybrid of the two
and are generally known as Electronic Control Units
(ECUs)
• The number of embedded controllers in an ordinary
vehicle varies from 20 to 40 whereas a luxury vehicle
like Mercedes S and BMW 7 may contain 75 t0 100
numbers of embedded controllers.
• The first embedded system used in automotive
application was the microprocessor based fuel
injection system introduce by Volkswagen 1600 in
1968.
The various types of electronic control units
(ECUs) used in the automotive embedded
industry can be broadly classified into - High-
speed embedded control units and Low-speed
embedded control units.
High-speed Electronic Control Units (HECUs)-
High-speed electronic control units are deployed
in critical control units requiring fast response.
They include fuel injection systems, antilock
brake systems, engine control, eletronic throttle,
steering controls, transmission control unit and
central control unit.
Low-Speed Electronic Control Unit (LECUs) –
Low –speed electronic control units are
depployed in applications where response time
is not so critical.
They are built around low cost microprocessors
/microcontrollers and digital signal processors.
Audio controllers, passenger and driver door
locks, door glass controls(power windows),
wiper control, mirror control, seat control
system, head lamp and tail lamp controls, sun
roof control unit etc. are examples of LECUs.
Automotive Communication Buses
Automotive applications make use of serial
buses for communication, which greatly reduces
the amount of wiring required inside a vehicle.
The different types of serial interface buses
deployed in automotive embedded
applications are : Controller Area Network
(CAN), Local Interconnect Network (LIN),
Media-Oriented System Transport (MOST) Bus
CAN- The CAN bus was originally proposed by
Robert Bosch, pioneer in the Automotive
embedded solution providers.
It supports medium speed(ISO11519-class B
with data rates up to 125 Kbps) and high speed
(ISO11898 class C with data rates up to
1Mbps)data transfer.
CAN is an event-driven protocol interface with
support for error handling in data transmission.
It is generally employed in safety system like
airbag control, power train systems like engine
control and Antilock Brake System(ABS) and
navigation systems like GPS.
LIN-
 LIN bus is a single master multiple slave
communication interface.
 LIN is a low speed single wire communication
interface with support for data rates up to 20
Kbps and is used for sensor/actuator interfacing.
 LIN bus follows the master communication
triggering technique to eliminate the possible
bus arbitration problem that can occur by the
simultaneous talking of different slave odes
connected to a single interface bus.
 LIN bus is employed in applications like mirror
controls, fan controls , seat positioning controls,
window controls and position controls where
response time is not critical issue.
MOST Bus –
The Media-Oriented system transport is targeted
for automotive audio/video equipment interfacing,
used primarily in European cars.
A MOST bus is a multimedia fibre-optic point-to-
point network implemented in a star, ring or daisy
chained topology over optical fibre cables.
The MOST bus specifications define the physical
layer as well as the application layer, network layer,
and media access control.
MOST bus is an optical fibre cable connected
between the Electrical Optical Converter (EOC) and
Optical Electrical Converter (OEC) which would
translate into the optical cable MOST bus.
UNIT -3
Programming Embedded System
• Embedded system is widely used in modern Information
Technology.
• The C programming language is the most popular programming
language for programming embedded systems.
• C remains a very popular language for micro-controller developers
due to code efficiency and reduced overhead and development
time.
• C offers low-level control and is considered more readable than
assembly.
• Many free C compliers are available for a wide variety of
development platforms.
• Using C increases portability, since C code a can be compiled for
different types of processors.
Structure of Embedded Program
• To accomplish a meaningful task on a computer, it
must be provided with exhaustive and very
explicit instructions.
• A collection of such instructions is called a
program and the one who writes and revises
these instructions are known as a Programmer or
developer.
• The processor processes all information in binary
about the binary number system and its
operation.
Embedded Development Cycle
• The development process for embedded
software follows a cycle as below:
1. Problem Specification
2. Tool/Chip selection
3. Software plan
4. Device Plan
5. Code/Debug
6. Test
7. Integrate
Problem Specification
• It means defining the problem.
• It is a statement of the problem that the program
will solve without considering any possible
solutions.
• The main aim is explaining in detail what the
program will do.
• Once the specification of the problem is complete
we must examine the system as a whole.
• At this point specific needs must be considered
such as those of interrupt driven or time-critical
systems.
Tool/Chip Selection
• Here we decide about the hardware components that can solve
our problem requirements.
• The type of application will often determine the device chosen.
• Needs based on memory size, speed and special feature availability
will determine which device will be most appropriate.
• The cost and availability issues should also be investigated.
• It is also essential to determine that the development decisions
made are possible with the device we are considering.
• Ex- If we wish to use C we must select a device for which there is a
C language compiler.
• It is also important to investigate the availability of emulators,
simulators and debuggers.
Software Plan
• In this step the programmer needs to define the
algorithms that is required to solve the problem.
• The first step in the software plan is to select an
algorithm which solves the problem specified in
our problem specification.
• Various algorithms should be considered and
compared in terms of code side, speed, difficulty
and ease of maintenance.
• After the basic algorithm is chosen the overall
problem should be broken down into smaller
problems.
Device Plan
• The routines for hardware specific features
should be planned.
• The routines include :
Set up the reset vector
Set up the interrupt vectors
Watch the stack (hardware or software)
Interact with peripherals such as timers,serial
ports and A/D converters.
Code/Debug
• The modules form the software plan stage are
coded in the project language.
• The coded modules are compiled or
assembled and all syntactic error are repaired.
• Debugging should consider the issues such as:
 Syntactic correctness of the code
 Timing of the program
Test
• Each module should be tested to ensure that
it is functioning properly.
• This testing is done using Simulators and/or
emulators.
• It is very important to test the hardware we
will be using.
• This is done by writing small programs which
test the devices.
Integrate
• The modules must be combined to create a
functioning program.
• It is very important at this point to test the
routines which are designed to respond to
specific conditions.
• These routines include interrupt services and
Watchdog support routines.
• The entire program must be thoroughly
tested.
First Embedded C Program
• The first program which a developer writes in
the C language is one which displays the
message “Hello World” on the computer
screen.
• This is a sensible beginning for traditional C
platform where conventional input and
output are important and fundamental
concepts.
Structure of the Program
• Program Comments: -
The program comments are used to describe the function
performed by that particular command.
A good program includes comments throughout a program.
Comments help to explain what the code is doing at a
particular point and often states what specific symbols or
operations represent.
C compiler use slash and asterisk combinations as comment
delimiters.
When the compiler encounters a slash immediately followed
by an asterisk , /* or // it treats every character following this
pair as a comment until an asterisk immediately followed by a
slash, */ or // is encountered.
Preprocessor Directives:
 First embedded C program contains three preprocessor
directives - #include,#define and #pragma.
 Preprocessor directives are specific instructions given
to the preprocessor.
 Preprocessor directives are always preceded by the #
character which is referred as hash mark.
 #include < >-
1. It is one of the most commonly used preprocessor
directive.
2. When the preprocessor reaches this directive it looks
for the file named in the brackets.
3. If the file is found the preprocessor will replace the
#include directive with the entire contents of the file
or else the preprocessor will halt and give an error.
#define ON 1
#define OFF 0 :-
I. #define is another commonly used preprocessor
directive which is used to define symbolic constants.
II. Programs often use a constant number or value many
times.
III. Instead of typing in the actual number or value
throughout the program we can define a symbol
which represents the value.
IV. When the preprocessor reaches a #define directive it
will replace all the occurrences of the symbol name in
the program with the associated constant.
V. The statements #define ON 1 and #define OFF 0, the
symbols ON and OFF are assigned the values 1 and 0
respectively.
#pragma –
I. The preprocessor handles #pragma
directives in a slightly different fashion than
other preprocessor directives.
II. It instruct the compiler to behave in a certain
way based on the description of the
hardware resources of the target computer.
III. These statements are most often used in
header files which provide the hardware
specifications for a particular device.
The main () function:-
 When C program is executed, how does it
know where the program starts?
 All C programs must have one function called
main() which is always the first function
executed.
Void main
{
// function statements
}
The Function Body:
 Every function definition has a function header.
 A function header describes what type of value
the function returns, the name of the function,
and what input it expects.
 The body of the function follows the function
header.
 The function body contains a set of statements
between braces which are executed when the
function is called.
 There are several different types of C statements.
Assignment Statement –
 The assignment operator is used to assign value
to a particular variable.
 An assignment statement takes the value of the
expression on the right of the equal sign and
assigns it to the symbol on the left side of the
equal sign.
Control Statements-
Control statements allow decisions to be made to
determine which statements are executed and how
often.
Ex – In C decisions are made using control
statements.
Control statements can select between two or more
paths of execution and repeat a set of statements a
given number of times.
Some common control statements are-
While:
While
{
// statements
}
• The while () control statement instructs the
computer to repeat a set of instruction (loop) as
long as condition is valid.
• The condition is an expression placed in the
brackets which follow the while statement.
• C considers any condition which does not
evaluate to 0 to be true and any condition which
does evaluate to 0 to be false.
If :-
If ( )
{
--------------------
}
• The if () statement provides the ability to
make decisions.
• If the if statement condition is true then the
computer executes the statement in the if
body.
Calling Functions:
A program can delegate a task by calling another
function.
The while loop is an infinite loop.

Thus the structure of the embedded program


consists of :
Directives which are handled directly by the
preprocessor.
Declarations are the instructions for the compiler
to record the type and associated memory locations
of symbols.
Statements – are the executable instructions in a
program.
Unit – IV
Embedded Hardware
All the processors store their data and program codes in memory but
in some cases the memory resides on the same chip as the processor ,
but most of the memory chips are located externally.
The processors communicates with memory by suing address bus and
the data bus.
For reading and writing data at some particular location the processor
first writes the desired address onto the address bus and then the data
using the data bus.
Memory Map-
A memory map is the structure of the data that indicates how memory
is laid out.
Memory maps can have different meaning in different parts of the
operating system.
In boot process a memory map is passed on from the firmware in
order to instruct an operating system kernel about memory layout.
It contains the information regarding the size of total memory,
any reserved regions and also provide details specific to
architecture.
In the below diagram there are three devices attached to the
address and data buses.
These devices are the RAM and ROM and a Serial Controller
“Zilog 85230”.
RAM is located at the bottom of memory and extends upward
for the first 128 KB of the memory space.
The ROM is located at the top of memory and extends
downward for 256 KB. But this area of memory actually
contains two ROMs an EPROM and a Flash memory device
each of size 128 KB.
The third device the Zilog 85230 Serial Communications
Controller, is a memory-mapped peripheral whose registers
are accessible between the addresses 70000h and 72000h.
I/O MAP
• To communicate with input/output devices the concept of I/O map
is used.
• The process of creating the I/O map is similar to memory mapping.
• Memory –mapped I/O uses the same address but to address both
memory and I/O devices.
• The memory and registers of the I/O devices are mapped to
address values.
• When an address is used by the CPU it may refer to a portion of
physical RAM or it can refer to memory of the I/O device.
• The CPU instructions used to access the memory are also used for
accessing devices.
• Each I/O device monitors the CPU’s address bus and responds to
any of the CPU’s access of address space assigned to that device
connecting the data bus to a desirable device’s hardware register.
Interrupt
• Interrupt is something that produces some kind of
interruption.
• In microprocessor and microcontroller systems an
interrupt is defined as a signal that initiates changes in
normal program execution flow.
• The signal that generates changes in normal program
execution flow may come from an external device
connected to the microprocessor/controller requesting
the system that it needs immediate attention or the
interrupt signal may come from some of the internal
units of the processor/controller such as timer
overflow indication signal.
Why Interrupts?
• From programmer point of view interrupt is a boon.
• Interrupts are very useful in situations where you need to
read or write some data from or to an externally connected
device.
• Without interrupts the normal procedure adopted is
pooling the device to get the status.
• We can write the program in two ways to pool the device.
• In the first method the program pools the device
continuously till the device is ready to send data to the
controller or ready to accept data from the controller.
• This technique achieves the desired objective effectively by
sacrificing the processor time for that single task.
• Whenever there is a chance of program hang up and the
total system to crash in certain situations where the
external device fails or stops functioning.
• Another approach for implementing the pooling technique is to schedule
the pooling operation on a time slice basis and allocate the total time on a
shared basis to rest of the tasks also.
• This leads to more effective utilization of the processor time.
• The biggest drawback of this approach is that there is a chance for missing
some information coming from the device if the total tasks are high in
number.
• Here comes the role of interrupts. If the external device supports interrupt
we can connect the interrupt pin of the device to the interrupt line of the
controller.
• Enable the corresponding interrupt in firmware. Write the code to handle
the interrupt request service in a separate function and put the other
tasks in the main program code.
• Here the main program is executed normally and when the external
device asserts an interrupt the main program is interrupted and the
processor switches the program execution to the interrupt request
service.
• On finishing the execution of the interrupt request service the program
flow is automatically diverted back to the main stream and the main
program resumes its execution exactly from the point where it got
interrupted.
USE of Interrupts
In any interrupt based systems interrupts are
mainly used for accomplishing the following tasks:
1. I/O data transfer between peripheral adevices
and processor/controller.
2. Timing applications
3. Handling emergency situations example- switch
off the system when the battery status falls
below the critical limit in battery operated
systems.
4. Context switching /Multitasking/ Real-Time
application programming.
5. Event driven programming.
Interrupt Map
• The embedded systems have few handful of interrupts.
• These interrupts are associated with an interrupt pin and an interrupt service routine (ISR).
• For the execution of correct interrupt service routine a mapping is required between interrupt pins
and interrupt service routine.
• This mapping usually takes the form of an interrupt vector table.
• The vector table is just an array of pointers to functions located at some known memory address.
• The processor uses the particular interrupt as its index into this array.
• The value stored at that location in the vector table is usually just the address of the interrupt
service routine to be executed.
• Now the system requires initializing the interrupt vector table correctly.
• This is achieved by using the following:
Create an interrupt map that organizes the relevant information.
Create an interrupt map that is a table contains a list of interrupt types and the devices to which they
refer.
Add board-specific header file. Each line of the interrupt map becomes a single #define within the file.
Processor Family
• A set of related processors from the same manufacturer is called as
Processor family.
• The term processor refers to any three type of devices known as
microprocessors, microcontrollers and Digital Signal Processors.
• DSP –
• The third type of processor is a digital signal processor or DSP.
• The Central processing unit within a DSP is specially designed to
perform discrete-time signal processing calculations ex- the
processors for audio and video communications.
• The DSP performs such calculations much faster than other
processors they offer a powerful,low-cost microprocessor
alternative for designers of modems and other
telecommunications.
• Two common DSP families are the TMS320CX and 5600X series
from TI and Motorola.
Memory

• Memory is an important part of a


processor/controller based E.S.
• Some of the procoessors/controllers contain
built in memory and this memory is reffered
as on-chip memory.
• Others which do not contain any memory
inside the chip requires external memory to
be connected with the controller/processor
called off-chip memory.
Memory

ROM RAM
ROM
• The program memory or code storage
memory of an E.S stores the program
instructions and it can be classified into
different types
• ROM(Read Only Memorty) –
It retains its contents even after the power to it
is turned off.
It is a non-volatile memory.

You might also like