Module_1
Module_1
System
Module-1
What is an Embedded Systems?
● An embedded system is an electronic / electro-mechanical system designed
to perform a specific function and is a combination of both hardware and
software.
● Every embedded system is unique, and the hardware as well as the software
is highly specialised to the application domain.
● Embedded systems are becoming an inevitable part of any product or
equipment in all fields including household appliances, telecommunications,
medical equipment, industrial control, consumer products, etc.
Embedded systems Vs General computing systems
General Computing Systems Embedded Systems
● Special purpose hardware and embedded OS
● Generic hardware and general purpose operating
systems ● May or may not contain an operating system for
● Has general purpose Operating systems functioning
● Applications are alterable (programmable) by the ● The firmware of the embedded system is pre-
user. programmed and it is non-alterable by the end user.
● Performance is the key deciding factor in the ● Application-specific requirements (like performance,
selection of the system. power requirements, memory usage, etc.) are the key
● Less/not at all tailored towards reduced operating deciding factors.
power requirements, options for different levels of ● Highly tailored to take advantage of the power saving
modes supported by the hardware and the operating
power requirements.
system.
● Response requirements are not time-critical.
● For certain categories of embedded systems like mission
● Need not be deterministic in execution behaviour. critical systems, the response time requirement is highly
critical.
● Execution behaviour is deterministic for certain types of
embedded systems like “ Hard Real Time” systems
History of Embedded Systems
● Embedded systems were in existence even before the IT revolution.
● In the olden days, embedded systems were built around the old vacuum tube
and transistor technologies and the embedded algorithm was developed in
low level languages.
● Advances in semiconductor and nano-technology and IT revolution gave way
to the development of miniature embedded systems.
● The first recognised modern embedded system is the Apollo Guidance
Computer (AGC) developed by the MIT Instrumentation Laboratory for the
lunar expedition.
● The first mass-produced embedded system was the guidance computer for
the Minuteman-I missile in 1961.
Classification of Embedded systems
Embedded systems are classified based on the following criteria:
1. Based on generation
4. Based on triggering
Classification Based on Generation
1. First Generation
Example:8-bit microprocessors like 8085 with software developed in
Assembly code
2. Second Generation
Example: 16-bit microprocessors, Data Acquisition Systems
3. Third Generation
Example:Powerful 32-bit processors (DSP, ASIC), complex instruction set
4. Fourth Generation
Examples: Smart mobile devices, mobile internet devices, SoC
Classification Based on Complexity and Performance
1. Small-Scale Embedded Systems
Simple in application and performance requirements are not time critical. It may or may not contain an
operating system for its functioning.
Example: An electronic toy
The core of the embedded system falls into any one of the following categories:
1.1 Microprocessors
1.2 Microcontrollers
● A silicon chip representing a central processing ● A microcontroller is a highly integrated chip that
unit (CPU), which is capable of performing contains a CPU, scratchpad RAM, special and
arithmetic as well as logical operations according general purpose register arrays, on chip
to a predefined set of instructions. ROM/FLASH memory for program storage, timer
● It is a dependent unit. It requires the combination of and interrupt control units and dedicated I/O ports.
other chips like timers, program and data memory ● It is a self-contained unit and it doesn’t require
chips, interrupt controllers, etc. for functioning. external interrupt controller, timer, UART, etc. for
● Most of the time general purpose in design and its functioning.
operation. ● Mostly application-oriented or domain-specific.
● Doesn’t contain a built in I/O port. ● Most of the processors contain multiple built-in I/O
● Targeted for high end market where performance is ports.
important. ● Targeted for embedded market where
● Limited power saving options compared to performance is not so critical.
microcontrollers. ● Includes lot of power saving features
Digital Signal Processors
● Digital Signal Processors ( DSPs) are 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.
● DSPs implement algorithms in hardware which speeds up the execution
whereas general purpose processors implement the algorithm in firmware and
the speed of execution depends primarily on the clock for the processors.
RISC vs CISC Instruction Set Architectures
RISC CISC
Harvard Von-Neumann
● Separate buses for instruction and ● Single shared bus for instruction and
data fetching data fetching
● Easier to pipeline, so high ● Low performance compared to
performance can be achieved Harvard architecture
● Comparatively high cost ● Cheaper
● No memory alignment problems ● Allows self modifying codes
● Since data memory and program ● Since data memory and program
memory are stored physically in memory are stored physically in the
different locations, no chances for same chip, chances for accidental
accidental corruption of program corruption of program memory
memory
Little-Endian Processors/Controllers
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.) For example, a 4 byte long integer
Byte3Byte2Byte1Byte0 will be stored in the memory as shown below:
Big-Endian Processors/Controllers
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.) For
example, a 4 byte long integer Byte3 Byte2 Byte1 Byte0 will be stored in the memory as
follows:
Load Store Operation and Instruction Pipelining
● The RISC processor instruction set is orthogonal, meaning it operates on
registers.
● The memory access related operations are performed by the special
instructions load and store.
● If the operand is specified as memory location, the content of it is loaded to a
register using the load instruction.
● The instruction store stores data from a specified register to a specified
memory location.
● Such an instruction set architecture is called as Load Store Architecture.
The concept of Load Store Architecture
● Suppose x, y and z are memory locations and we want to add the contents of
x and y and store the result in location z.
● The first instruction load R1, x loads the register R1 with the content of
memory location x, the second instruction load R2, y loads the register R2
with the content of memory location y.
● The instruction add R3, R1, R2 adds the content of registers R1 and R2 and
stores the result in register R3.
● The next instruction store R3, z stores the content of register R3 in memory
location z.
Fetch-decode-execute sequence
● The conventional instruction execution by the processor follows the fetch-
decode-execute sequence.
● Where the ‘fetch’ part fetches the instruction from program memory or code
memory and the ‘decode’ part decodes the instruction to generate the
necessary control signals.
● The ‘execute’ stage reads the operands, perform ALU operations and stores
the result.
● In conventional program execution, the fetch and decode operations are
performed in sequence.
The single stage pipelining concept
● For simplicity let’s consider decode and execution together. During the decode
operation the memory address bus is available and if it is possible to effectively
utilise it for an instruction fetch, the processing speed can be increased.
● In its simplest form instruction pipelining refers to the overlapped execution of
instructions.
● Under normal program execution flow, it is meaningful to fetch the next
instruction to execute, while the decoding and execution of the current
instruction is in progress.
● If the current instruction in progress is a program control flow transfer
instruction like jump or call instruction, there is no meaning in fetching the
instruction following the current instruction.
Application Specific Integrated Circuits (ASICs)
● Application Specific Integrated Circuit ( ASIC) is a microchip designed to
perform a specific or unique application.
● It is used as replacement to conventional general purpose logic chips.
● It integrates several functions into a single chip and there by reduces the
system development cost.
● As a single chip, ASIC consumes a very small area in the total system and
thereby helps in the design of smaller systems with high
capabilities/functionalities.
● ASIC based systems are profitable only for large volume commercial
productions.
Programmable Logic Devices
● 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.
● As the name indicates, the circuits in a fixed logic device are permanent, they perform one
function or set of functions– once manufactured, they cannot be changed.
● Programmable Logic Devices ( PLDs) offer customers a wide range of logic capacity,
features, speed, and voltage characteristics–and these devices can be re-configured to
perform any number of functions at any time.
● With programmable logic devices, designers use inexpensive software tools to quickly
develop, simulate, and test their designs.
● Then, a design can be quickly programmed into a device, and immediately tested in a live
circuit.
Commercial Off-the-Shelf Components (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.
● Typical examples of COTS hardware unit are remote controlled toy car control
units including the RF circuitry part, high performance, high frequency microwave
electronics (2–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, are cheap and a developer can cut down his/her development time to a
great extent.
● This in turn reduces the time to market embedded systems.
Memory
● Memory is an important part of a processor/controller based embedded
systems.
● Some of the processors/controllers contain built in memory and this memory
is referred as on-chip memory.
● Others do not contain any memory inside the chip and requires external
memory to be connected with the controller/processor to store the control
algorithm. It is called off-chip memory.
● Also some working memory is required for holding data temporarily during
certain operations.
Program Storage Memory ( ROM)
• The program memory or code storage memory of an embedded system stores the program instructions
and it can be classified into different types as per the block diagram representation given in Figure
below:
• The code memory
retains its contents
even after the power to
it is turned off. It is
generally known as
non-volatile storage
memory.
• Depending on the
fabrication, erasing,
and programming
techniques they are
classified into the
following types.
● An embedded system is in constant interaction with the real world and the
controlling/monitoring functions executed by the embedded system is achieved in
accordance with the changes happening to the real world.
● The changes in system environment or variables (like pressure, acceleration, or light)
are detected by the sensors connected to the input port of the embedded system.
● 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.
● It is achieved through an actuator (applying force or motion) connected to the output
port of the embedded system.
● If the embedded system is designed for monitoring purpose only, then there is no need
for including an actuator in the system.(example. ECG machine)
Sensors
● A sensor is a transducer device that converts energy
from one form to another for any measurement or
control purpose.
● For example, in ‘Wearable devices’, the sensor which counts steps for pedometer functionality is
an accelerometer sensor and the sensor used in some of the smartwatch devices to measure the
light intensity is an Ambient Light Sensor (ALS).
Actuators
● Actuator is a form of transducer device (mechanical or electrical) which converts signals
to corresponding physical action (motion). Actuator acts as an output device.
● Looking back to the ‘Wearable devices’ example, certain smartwatches use Ambient
Light Sensor to detect the surrounding light intensity and uses an electrical/ electronic
actuator circuit to adjust the screen brightness for better readability.
The I/O Subsystem
● The I/O subsystem of the embedded system facilitates the interaction of the
embedded system with the external world.
● The interaction happens through the sensors and actuators connected to the
input and output ports respectively of the embedded system.
● The sensors may not be directly interfaced to the input ports, instead they
may be interfaced through signal conditioning and translating systems like
ADC, Optocoupler, etc.
● It is important to study some of the sensors and actuators used in embedded
systems and the I/O systems to facilitate the interaction of embedded
systems with external world.
Light Emitting Diode (LED)
● Light Emitting Diode ( LED) is an important 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.
● Light Emitting Diode is a p-n junction diode and it contains
an anode and a cathode. For proper functioning of the
LED, the anode of it should be connected to +ve terminal
of the supply voltage and cathode to the –ve terminal of
supply voltage.
7-Segment LED Display
● The 7-segment LED display is an
output device for displaying alpha
numeric characters.
● It contains 8 light-emitting diode
(LED) segments arranged in a • The LED segments are named A to G
special form. and the decimal point LED segment is
● Out of the 8 LED segments, 7 are named as DP.
used for displaying alpha numeric • The LED segments A to G and DP
characters and 1 is used for should be lit accordingly to display
representing ‘decimal point’ in numbers and characters.
• For example, for displaying the
decimal number display.
number 4, the segments F, G, B and C
are lit.
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).
● It is an input device.
● Push button switch comes in two configurations,
namely ‘Push to Make’ and ‘Push to Break’.
● In the ‘Push to Make’ configuration, the switch is normally in the open state and
it makes a circuit contact when it is pushed or pressed.
● In the ‘Push to Break’ configuration, the switch is normally in the closed state
and it breaks the circuit contact when it is pushed or pressed.
● In embedded application push button is generally used as reset and start switch
and pulse generator.
● The Push button is normally connected to the port pin of the host processor/
controller.
COMMUNICATION INTERFACE
● Communication interface is essential for communicating with various subsystems of the
embedded system and with the external world.
● For an embedded product, the communication interface can be viewed in two different
perspectives; namely; Device/board level communication interface (On-board Communication
Interface) and product level communication interface (External Communication Interface).
● Embedded product is a combination of different types of components (chips/
devices) arranged on a printed circuit board (PCB).
● The communication channel which interconnects the various components within an
embedded product is referred as device/board level communication interface (on-board
communication interface).
● Serial interfaces like I2C, SPI, UART, 1-Wire, etc and parallel bus interface are examples of
‘On-board Communication Interface’.
COMMUNICATION INTERFACE
● The ‘product level communication interface’ (External Communication Interface) is
responsible for data transfer between the embedded system 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.
● Infrared (IR), Bluetooth (BT), Wireless LAN (Wi-Fi), Radio Frequency waves (RF),
GPRS/3G/4GLTE, etc. are examples for wireless communication interface.
● RS-232C/RS-422/RS-485, USB, Ethernet, IEEE 1394 port, parallel port, CF-II interface,
SDIO, PCMCIA/PCIex, etc. are examples for wired interfaces.
● It is not mandatory that an embedded system should contain an external communication
interface.
● Mobile communication equipment is an example for embedded system with external
communication interface.
On-board Communication Interfaces
● On-board Communication Interface refers to the different communication
channels/buses for interconnecting the various integrated circuits and other
peripherals within the embedded system.
● The following are the various interfaces for on-board communication:
a) Inter Integrated Circuit ( I2C) Bus
b) Serial Peripheral Interface ( SPI) Bus
c) Universal Asynchronous Receiver Transmitter ( UART)
d) 1-Wire Interface
e) Parallel Interface
a) Inter Integrated Circuit ( I2C) Bus
● The Inter Integrated Circuit Bus (I2C–Pronounced ‘I square C’) is a synchronous bi-
directional half duplex (one-directional communication at a given point of time) two
wire serial interface bus.
● The original intention of I2C was to provide an easy way of connection between a
microprocessor/microcontroller system and the peripheral chips in television sets.
● The I2C bus comprise of two bus lines, namely; Serial Clock–SCL and Serial Data–
SDA.
● SCL line is responsible for generating synchronisation clock pulses and 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.
I2C Bus Interfacing • The I2C bus interface is built around an input
buffer and an open drain or collector transistor.
• When the bus is in the idle state, the open
drain/collector transistor will be in the floating
state and the output lines (SDA and SCL)
switch to the ‘High Impedance’ state.
• For proper operation of the bus, both the bus
lines should be pulled to the supply voltage
(+5V for TTL family and +3.3V for CMOS
family devices) using pull-up resistors.
• The typical value of resistors used in pull-up is
2.2K. With pull-up resistors, the output lines of
the bus in the idle state will be ‘HIGH’.
• The address of a I2C device is assigned by
hardwiring the address lines of the device to
the desired logic level.
• The address to various I2C devices in an
embedded device is assigned and hardwired
at the time of designing the embedded
hardware.
Serial Peripheral Interface (SPI) Bus
● The Serial Peripheral Interface Bus (SPI) is a synchronous bi-directional full
duplex four-wire serial interface bus.
● SPI is a single master multi-slave system.
● It is possible to have a system where more than one SPI device can be
master, provided the condition only one master device is active at any given
point of time, is satisfied.
● SPI requires four signal lines for communication. They are:
Universal Asynchronous Receiver Transmitter ( UART)
● Universal Asynchronous Receiver Transmitter (UART) based data transmission is an
asynchronous form of serial data transmission.
● UART based serial data transmission doesn’t require a clock signal to synchronise the
transmitting end and receiving end for transmission.
● Instead it relies upon the pre-defined agreement between the transmitting device and
receiving device.
● The serial communication settings (Baudrate, number of bits per byte, parity, number of start
bits and stop bit and flow control) for both transmitter and receiver should be set as identical.
● The start and stop of communication is indicated through inserting special bits in the data
stream.
● While sending a byte of data, a start bit is added first and a stop bit is added at the end of
the bit stream.
• The ‘start’ bit informs the receiver that a data
byte is about to arrive.
• The receiver device starts polling its ‘receive
line’ as per the baudrate settings.
• If the baudrate is ‘x’ bits per second, the time
slot available for one bit is 1/x seconds.
• The receiver unit polls the receiver line at
exactly half of the time slot available for the bit.
• If parity is enabled for communication, the UART
of the transmitting device adds a parity bit (bit
value is 1 for odd number of 1s in the
transmitted bit stream and 0 for even number of
1s).
• The UART of the receiving device calculates the
• For proper communication, the ‘Transmit
parity of the bits received and compares it with
line’ of the sending device should be
the received parity bit for error checking.
connected to the ‘Receive line’ of the
• The UART of the receiving device discards the
receiving device.
‘Start’, ‘Stop’ and ‘Parity’ bit from the received bit
• In addition to the serial data transmission
stream and converts the received serial bit data
function, UART provides hardware
to a word (In the case of 8 bits/byte, the byte is
handshaking signal support for controlling
formed with the received 8 bits with the first
the serial data flow.
received bit as the LSB and last received data
1-Wire Interface
● 1-wire interface is an asynchronous half-duplex communication protocol
developed by Maxim Dallas Semiconductor (http://www.maxim-ic.com).
● It makes use of only a single signal line (wire) called DQ for communication
and follows the master-slave communication model.
● One of the key feature of 1-wire bus is that it allows power to be sent along
the signal wire as well.
● The 1-Wire slave devices incorporate internal capacitor (typically of the order
of 800 pF) to power the device from the signal line.
● The 1-wire interface supports a single master and one or more slave devices
on the bus.
Parallel Interface
● The on-board parallel interface is normally used for communicating with
peripheral devices which are memory mapped to the host of the system.
● The host processor/controller of the embedded system contains a parallel bus
and the device which supports parallel bus can directly connect to this bus
system.
● The communication through the parallel bus is controlled by the control signal
interface between the device and the host.
● The ‘Control Signals’ for communication includes ‘Read/Write’ signal and device
select signal.
● The device normally contains a device select line and the device becomes
active only when this line is asserted by the host processor.
External Communication Interfaces
● The External Communication Interface refers to the different communication
channels/buses used by the embedded system to communicate with the
external world.
● The following are the various interfaces for external communication:
a. RS-232 C & RS-485
b. Universal Serial Bus (USB)
c. IEEE 1394 (Firewire)
d. Infrared (IrDA)
e. Bluetooth (BT)
f. Wi-Fi
g. ZigBee
h. General Packet Radio Service (GPRS), 3G, 4G, LTE
RS-232 C & RS-485
(1) Write the program in high level languages like Embedded C/C++ using an Integrated Development
Environment (The IDE will contain an editor, compiler, linker, debugger, simulator, etc. IDEs are different for
different family of processors/controllers. For example, Keil micro vision3 IDE is used for all family members of
8051 microcontroller, since it contains the generic 8051 compiler C51).
(2) Write the program in Assembly language using the instructions supported by your application’s
target processor/controller.
EMBEDDED FIRMWARE
● The instruction set for each family of processor/controller is different and the program written in
either of the methods given above should be converted into a processor understandable
machine code before loading it into the program memory.
● The process of converting the program written in either a high level language or
processor/controller specific Assembly code to machine readable binary code is called ‘HEX File
Creation’.
● The methods used for ‘HEX File Creation’ is different depending on the programming techniques
used.
● If the program is written in Embedded C/C++ using an IDE, the cross compiler included in the
IDE converts it into corresponding processor/controller understandable ‘HEX File’.
● If you are following the Assembly language based programming technique (method 2), you can
use the utilities supplied by the processor/controller vendors to convert the source code into
‘HEX File’.