Professional Documents
Culture Documents
Unit1 Esd 22md5pcesd
Unit1 Esd 22md5pcesd
Unit1 Esd 22md5pcesd
11/23/2023 1
11/23/2023 2
Application Areas
• Medical Systems
– pace maker, patient monitoring systems, injection systems, intensive care
units, …
• Office Equipment
– printer, copier, fax, …
• Tools
– multimeter, oscilloscope, line tester, GPS, …
• Banking
– ATMs, statement printers, …
• Transportation
– (Planes/Trains/[Automobiles] and Boats)
• radar, traffic lights, signalling systems, …
11/23/2023 3
Application Areas
• Automobiles
– engine management, trip computer, cruise control,
immobilizer, car alarm,
– airbag, ABS,…
• Building Systems
– elevator, heater, air conditioning, lighting, key card
entries, locks, alarm systems, …
• Agriculture
– feeding systems, milking systems, …
• Space
– satellite systems, …
11/23/2023 4
Applications and Technology Trend
11/23/2023 5
Embedded Systems are everywhere
–Dedicated purpose
–Hidden
11/23/2023 6
What is Embedded System?
An Electronic/Electro mechanical system which is designed to
perform a specific function and is a combination of both
hardware and firmware (Software)
11/23/2023 7
Embedded Systems Vs General Computing Systems:
11/23/2023 8
Embedded Systems based on Purpose/Usage
• Data Collection/Storage/Representation
• Data Communication
• Data (Signal) Processing
• Monitoring
• Control
• Application Specific User Interface
11/23/2023 9
11/23/2023 10
11/23/2023 11
Hearing Aid
11/23/2023 12
11/23/2023 13
Control
11/23/2023 14
Actuator- responsible for moving and controlling a mechanism or system
Application Specific User Interface
11/23/2023 15
Classification of Embedded Systems:
1. Based on Generation
4. Based on Triggering
11/23/2023 16
Embedded Systems - Classification based on Generation
11/23/2023 17
Embedded Systems - Classification based on Generation
11/23/2023 19
Embedded Systems - Classification based on Complexity &
Performance
• Medium Scale:
Embedded Systems built around medium performance,
low cost 16 or 32 bit microprocessors / microcontrollers or
DSPs.
These are slightly complex in hardware and firmware.
It may contain GPOS/RTOS.
11/23/2023 20
Embedded Systems - Classification based on Complexity & Performance
• Large Scale/Complex:
Embedded Systems built around high performance 32 or 64 bit
RISC processors/controllers, RSoC or multi-core processors and
PLD.
It requires complex hardware and software.
These system may contain multiple processors/controllers and co-
units/hardware accelerators for offloading the processing
requirements from the main processor.
It contains RTOS for scheduling, prioritization and management.
11/23/2023 21
Embedded Systems: Classification Based on deterministic behaviour
23 11/23/2023
Embedded Systems - Classification Based on Triggering
11/23/2023 24
Core
• Basic Computation Unit of CPU that performs
mathematical and logical operations
11/23/2023 25
11/23/2023 26
• A core is capable of independently executing a
single thread or process while the other cores may
be idle or executing a completely different process
simultaneously.
• processor with more cores- better able to
multitask programs without having to divide up
the available time between them as much it would
with a single core for executing all processes.
11/23/2023 27
Cores in the Embedded systems
• General purpose/ Domain specific-
microprocessors/microcontrollers/ DSP processors
11/23/2023 28
Is microcontroller or microprocessor used most in
embedded applications?
• It depends upon the application needs.
• to control a home appliance at your home then a tiny chip
micro controller can be used
• to control high end devices like servers and automation
machines you need microprocessors as micro
controllers have limited speed and low accuracy.
11/23/2023 30
11/23/2023 31
11/23/2023 32
Application Specific Integrated Circuit
(ASIC):
• A microchip designed to perform a
specific or unique application. It is
used as replacement to conventional
general purpose logic chips.
• used "as-is."
• COTS products are designed for easy installation and
interoperate with existing system components.
• Almost all software bought by the average computer user fits
into the COTS category
• Examples - operating systems, office product suites, word
processing
• One of the major advantages of COTS products- mass-
production , relatively low cost.
11/23/2023 37
Advantages of COTS
11/23/2023 38
COTS component contains
a General Purpose Processor (GPP) /
Application Specific Instruction Set
Processor (ASIP) /
Application Specific Integrated Chip
(ASIC)/
Application Specific Standard Product
(ASSP)
or Programmable Logic Device (PLD)
11/23/2023 39
advantage of using COTS
• readily available in the market
• cheap and a developer can cut down development time
to a great extend.
• no need to design the module yourself and write the
firmware .
• Everything will be readily supplied by the COTs
manufacturer
11/23/2023 40
COT- Drawbacks or concerns
• there are no operational and manufacturing standards
Accelerator To accelerate execution of Increases performance by co- In house engg cost , royalty
the code, floating point processing payments for IP
operations
11/23/2023 42
11/23/2023 43
General Schematic of Embedded system
Output
device
Input device (screen)
(keyboard) CPU program
Memory
Sensors Actuators
to measure bus to
physical control
values physical
things
Permanent Memory
11/23/2023 44
11/23/2023 45
Input and Output
• Required to communicate with outside world
• Embedded System:
11/23/2023 46
Sensor / transducer
• any device which converts one form of energy into another
Example
• A microphone converts sound into electrical impulses and a
loudspeaker converts electrical impulses into sound (i.e., sound
energy to electrical energy and vice versa).
11/23/2023 47
Actuators
11/23/2023 48
Difference in sensor and actuator
• the sensor is used to monitor the changes in the environment
by using measurands
11/23/2023 49
11/23/2023 50
11/23/2023 51
52 11/23/2023
MEMORY
• The memory used in embedded system can be either Program
Storage Memory (ROM) or Data memory (RAM)
• Certain Embedded processors/controllers contain built in
program memory and data memory and this memory is known
as on-chip memory
• Certain Embedded processors/controllers do not contain
sufficient memory inside the chip and requires external
memory called off-chip memory or external memory.
11/23/2023 53
11/23/2023 54
MEMORY
11/23/2023 55
Code memory
• Stores the program instructions
11/23/2023 56
11/23/2023 57
11/23/2023 58
11/23/2023 59
11/23/2023 60
Mask- Rom mask is created from ROM image file
created at foundry for fabrication of a chip
11/23/2023 61
EPROM
• Erasable Programmable Read-Only Memory.
• needed U-V light to erase the memory chip
EEPROMFLASH memory/
• non-volatile computer storage medium that can be
electrically erased and reprogrammed.
• bits can be individually erased and programmed
• no necessity to wipe out the entire memory and
reprogram (“burned”) the whole thing again from scratch
11/23/2023 62
Read-Write Memory/Random Access Memory (RAM)
11/23/2023 63
11/23/2023 64
11/23/2023 65
RAM
11/23/2023 66
11/23/2023 67
high-speed SRAM
11/23/2023 68
Cache Memory
• stores data in KB and recent activities that are done by CPU.
• CPU always first look for data in cache memory and if not
present in the cache then get from the RAM.
11/23/2023 69
Cache memory (high-speed SRAM)
11/23/2023 71
Shadowing of memory
• BIOS is firmware used to perform hardware
initialization during the booting process
• But for high system performance it should be
accessed from a RAM instead of accessing from a
ROM.
• RAM is volatile and it cannot hold the
configuration data which is copied from the BIOS
when the power supply is switched off. Only a
ROM can hold it permanently.
11/23/2023 72
Shadowing of memory
the first step that happens during the boot up is
copying the BIOS to the shadowed RAM and
write protecting the RAM then disabling the
BIOS reading.
11/23/2023 73
COMMUNICATION INTERFACE
• Communication Protocol: A set of rules and regulations
that allow two electronic devices to connect to
exchange the data with one and another.
11/23/2023 74
COMMUNICATION INTERFACE
11/23/2023 75
Onboard Communication Interface/ Intra system
Interface:
11/23/2023 76
Communication Types
11/23/2023 77
Basic types of communication
11/23/2023 78
Asynchronous communication
• The data is transmitted as a series
of bits.
• a series of bytes or ASCII characters
can be sent via a single wire.
• A shift register found either in the
hardware or in the software can be
used to serialize every data byte
into a series of bits.
• These bits are then delivered using
a protocol
• Baud rate varies
11/23/2023 79
Asynchronous communication
• Requests need not be targeted to specific
server.
• Service need not be available when request is
made.
• No blocking, so resources could be freed.
• Could use connectionless protocol
11/23/2023 80
Disadvantages of Asynchronous Communication
• Overhead of start and stop bits
11/23/2023 83
Iso Synchronous Communication
1.Asynchronous: This is transmission at any time, with arbitrary
delay between transmission of any two successive data items.
11/23/2023 88
I²C (Inter-Integrated Circuit)
• invented in 1982 by Philips Semiconductor (now NXP
Semiconductors).
11/23/2023 91
Features of I2C
Multi-master , Number of masters can be connected on the bus.
However, at an instance, master is one, which initiates a data
transfer on SDA (serial data) line and which transmits the data
two wire bus
1. data line (SDA) serial data line
2. clock line (SCL) serial clock line
11/23/2023 94
I2C Protocol steps
Transfers are byte oriented, MSB first
Start: SDA (serial data line) goes low while SCL is high
Master sends address of slave (7-bits) on next 7
clocks
Master sends read/write request bit
0-write to slave
1-read from slave
Slave ACKs by pulling SDA low on next clock
Data transfers starts
11/23/2023 95
Master Writes to Slave
11/23/2023 96
Synchronous Serial Bus Fields and its length
• First field of 1 bit─ Start bit
• Second field of 7 bits─ address field. It
defines the slave address, which is
being sent the data frame (of many
bytes) by the master
• Third field of 1 control bit─ defines
whether a read or write cycle is in
progress
• Fourth field of 1 control bit─ defines
whether is the present data is an
acknowledgment (from slave)
11/23/2023 97
• Fifth field of 8 bits─ I2C device data byte
• Sixth field of 1-bit─ bit NACK (negative
acknowledgement) from the receiver.
• Seventh field of 1 bit ─ stop bit
11/23/2023 98
𝟐
𝑰 C (Inter integrated Circuit) protocol
• Any device that is compatible with a I2C
• Range - about 1 meter at 100 Kbaud, or
10 meters at 10 Kbaud
11/23/2023 99
Master Reads from Slave
11/23/2023 100
I2C
11/23/2023 102
I2C Protocol
11/23/2023 103
I2C Protocol
11/23/2023 104
Speed – I2C Bus
Standard mode - upto 100 Kbps
11/23/2023 105
Disadvantage of I2C bus • if any device
pull up resistors- "open drain“ , they can pull the holds the
corresponding signal line low, but cannot drive it SDA or SCL
high. line low, it
prevents the
master from
sending
START or
STOP
commands to
reset the bus.
11/23/2023 106
Disadvantage of I2C bus
• Need of pull up resistors- resistors
2.2 K on each line between the
SCL and SDA lines and the voltage
source
• A pull up resistor is used to
provide a default state for a signal
line or general purpose
input/ouput (GPIO)
11/23/2023 107
Disadvantage of I2C bus
11/23/2023 108
Disadvantage of I2C bus
• Because I²C is a shared bus, there is possibility for any device
to have a fault and hang the entire bus.
• if any device holds the SDA or SCL line low, it prevents the
master from sending START or STOP commands to reset the
bus.
11/23/2023 109
Serial Peripheral Interface (SPI)
• protocol developed by Motorola (1980s)
• commonly used to send data between
microcontrollers and small peripherals
such as shift registers, sensors, and SD
cards, for on board communication.
• separate clock and data lines, along with a
select line to choose the device
• Full-duplex Synchronous communication
• SPI is designed for on-PCB
communications less than 30.48cm
• Applications include Secure Digital cards
and liquid crystal displays.
11/23/2023 110
SPI protocol
MOSI - signal is generated by Master,
recipient is the Slave.
11/23/2023 113
SPI Disadvantages
• requires more signal lines than other communications
methods
• No hardware flow control by the slave
• No hardware slave acknowledgment
• No error-checking protocol is defined
• master controls all communications (slaves can’t talk directly
to each other)
• requires separate SS lines to each slave, which can be
problematic if numerous slaves are needed.
• supports only one master device
11/23/2023 114
Applications
• Interfacing with Sensors, ADC, LCD, touchscreens, video
game controllers
• Interfacing Memory
• Real-time clocks
11/23/2023 115
Microcontroller with independent chip selects for
multiple slave devices.
11/23/2023 116
SPI
• In typical SPI systems with one master and multiple slaves, a
dedicated chip-select signal is used to address an individual
slave.
• As the number of slaves increase, the number of chip-select
lines.
• In this situation, the board layout of the system can become
quite a challenge.
• This architecture increases hardware and layout complexity.
• layout alternative is daisy-chaining
11/23/2023 117
SPI Daisy-chain configuration
Only the first slave in the chain (SLAVE 1) receives the command
data directly from the microcontroller. Every other slave in the
network receives its DIN data from the DOUT output of the
preceding slave in the chain.
11/23/2023 118
SPI
• The number of bits is not defined by the protocol
so not limited to only 8bits - it can be any
number of bits.
11/23/2023 119
SPI Daisy-chain configuration
11/23/2023 120
SPI Daisy-chain configuration
11/23/2023 121
I2C SPI
can be multi-master and multi-slave SPI can be multi-slave but does not a multi-
master
half-duplex communication protocol. full duplex commination protocol.
has the feature of clock stretching, means if the Clock stretching is not the feature of SPI.
slave is not able to send data fast enough, then
it suppresses the clock to stop the
communication.
only two wire for the communication, one wire needs four wire for communication
is used for the data and the second wire is used
for the clock.
slower than SPI ; draws more power than SPI. SPI is faster; Draws less power
less susceptible to noise than SPI more susceptible to noise than I2C.
11/23/2023 122
I2C SPI
cheaper to implement than the SPI Costly as compare to I2C.
Requires pull-up resistors. no requirement of pull-up resistor
In I2C communication we get the Acknowledgment bit is not
acknowledgment bit after each byte. supported by the SPI communication
protocol.
I2C is the address base bus protocol, select the slave using the slave
we have to send the address of the select (SS) pin
slave for the communication.
I2C is better for long distance on board SPI is better for the short distance on
communication. board communication.
11/23/2023 123
11/23/2023 124
11/23/2023 125
START Condtion:
sbit SDA=P1^7; // initialize the SDA and SCL pins of the STOP Condition:
microcontroller//
void main ()
sbit SCL=P1^6; {
void delay(unsigned int); SDA=0; // Stop processing the data//
SCL=1; //clock is high//
void main () delay();
{ SDA=1; //Stopped//
SDA=1; //processing the data// delay();
SCL=0; //clock signal is low//
SCL=1; //clock is high// }
delay(); Void delay(int p)
SDA=0; //sent the data// {
unsignedinta,b;
delay(); For(a=0;a<255;a++); //delay function//
SCL=0; //clock signal is low// For(b=0;b<p;b++);
} }
Void delay(int p)
{
unsignedinta,b;
For(a=0;a<255;a++); //delay function//
For(b=0;b<p;b++);
} 11/23/2023 126
11/23/2023 127
LPC 1768 I2C-bus serial I/O controllers
11/23/2023 128
LPC 1768- SPI serial I/O controller
• one SPI controller.
• SPI is a full duplex serial interface designed to handle multiple masters and
slaves connected to a given bus. Only a single master and a single slave can
communicate on the interface during a given data transfer. During a data transfer
the master always sends 8 bits to 16 bits of data to the slave, and the slave
always sends 8 bits to 16 bits of data to the master.
• Maximum SPI data bit rate of 12.5 Mbit/s
• Synchronous, serial, full duplex communication
• 8 bits to 16 bits per transfer
11/23/2023 129
• Whenever we shut down the computer all
connections and processes inside stop. How is it that
when we open the computer again it tells the exact
correct time?
11/23/2023 132
Difference in RTC and Timer?
11/23/2023 133
RTC
• a system component responsible for keeping track of time
.
• RTC holds information like current time (In hours, minutes
and seconds) in 12 hour/24 hour format, date, month, year,
day of the week, etc. and supplies timing reference to the
system.
11/23/2023 134
RTC and Timer
RTC gives real time in human units rather than just giving signals
to process data/instructions
11/23/2023 137
RTC
• ICs on older systems utilize lithium batteries, whereas newer
systems make use super-capacitors ( a high-capacity capacitor
with a capacitance value much higher than other capacitors,
but with lower voltage limits)
• The supercapacitor can be charged and discharged a virtually
unlimited number of times
11/23/2023 138
RTC
• For Operating System based embedded devices, a timing reference is
essential for synchronising the operations of the OS kernel.
• The RTC can interrupt the OS kernel by asserting the interrupt line of
the processor/controller to which the RTC interrupt line is connected.
11/23/2023 139
RTC- Applications
• Real Time Clock (RTC) is used for tracking time and
maintaining a calendar.
• Many applications require to keep record of time/date for
occurrence of certain events. RTCs are useful in such
applications.
• RTCs come handy in data logging applications..
• RTCs have several registers that keep a track of time and
date.
11/23/2023 140
LPC 1768 RTC
• RTC is clocked by a dedicated RTC oscillator.
• The RTC will continue working when the battery voltage drops to as low
as 2.1 V.
• An RTC interrupt can wake up the CPU from any reduced power mode.
11/23/2023 141
LPC 1768 RTC
• CCR Clock Control Register
• Consolidated Time Registers CTIME 0 CTIME 1 CTIME 2
11/23/2023 142
RESET circuit- What happens when 8051 is reset?
11/23/2023 143
Reset circuit activation
Hard reset-
power on reset
Board reset/Manual reset
Soft reset –
Software instruction
Programmed timer
11/23/2023 144
Difference between board reset and power-on reset
• Power-on-reset: When switch is made ON
controller/processor is resetted as there will
be signal at reset pin.
• Board reset/Manual reset: done by pressing
a switch that provides the signal at reset pin
of the controller/processor.
• It is usually to reset the controller in the
mid-way with turning OFF the power
11/23/2023 145
soft reset /soft reboot.
11/23/2023 147
Watchdog timer
• commonly found in embedded systems and other computer-
controlled equipment where humans cannot easily access the
equipment or would be unable to react to faults in a timely
manner.
• In such systems, the computer cannot depend on a human to
invoke a reboot if it hangs; it must be self-reliant.
• hardware to protect a system from specific software or hardware
failures that may cause the system to stop responding.
• a hardware timer that automatically generates a system reset if an
embedded device hangs because of a software or hardware fault.
11/23/2023 148
WDT
• The purpose of the watchdog is to
reset the microcontroller within a
reasonable amount of time if it
enters an erroneous state.
The output of the watchdog
timer is given directly to
• When enabled, the watchdog will the microcontroller reset signal.
generate a system reset if the user Whenever the watchdog
program fails to reload the counter register is not cleared,
watchdog within a predetermined
then it immediately forces to
amount of time
restart the microprocessor or
controller
11/23/2023 149
Watchdog timer
• predefined timeout -This time is usually configured
and the watchdog timer is activated within the first
few clock cycles after power up.
• The timeout signal is used to initiate corrective
action or actions. The corrective actions typically
include placing the computer system in a safe state
and restoring normal system operation
• restarting a watchdog timer is commonly referred as
kicking" the watchdog
11/23/2023 150
watchdog timer
• based on a counter that counts down from
some initial value to zero.
11/23/2023 151
External Watchdog Timer
• If the microcontrollers or processors lack
inbuilt watchdog timer, then these are
interfaced with watchdog timers, externally.
11/23/2023 153
Advantages of Watchdog Timers
• Resets automatically without human intervention.
• Detects the errors in the program and reboot the system
• Cost sensitive
• Saves the time and money
• No need to monitor the software debugs.
• Increases the system performance.
11/23/2023 154
Brown-out Protection Circuit
The processor behaviour may not be predictable if the supply voltage falls
below the recommended operating voltage. It may lead to situations like data
corruption.
It is essential for battery powered devices since there are greater chances for
the battery voltage to drop below the required threshold.
11/23/2023 155
Brown-out Protection Circuit
11/23/2023 156
Brown-out Protection Circuit
• it can be implemented using external passive
circuits or ICs.
• The transistor conducts always when the
supply voltage VCC is greater than that of the
sum of VBE and VZ.
• The transistor stops conducting when the
supply voltage falls below the sum of VBE
and VZ.
• The values of the resistors can be selected
based on the electrical characteristics.
11/23/2023 157
Brownout detection in LPC 17678
• The LPC17xx include 2-stage monitoring of the
voltage on the VDD(REG)(3V3) pins.
• If this voltage falls below 2.2 V, interrupt signal is
generated to the Vectored Interrupt Controller.
• The second stage of low-voltage detection asserts reset to
inactivate the LPC17xx when the voltage on the
VDD(REG)(3V3) pins falls below 1.85 V.
11/23/2023 158
Brownout detection in LPC 17678
• This reset prevents alteration of the flash memory as operation of
the various elements of the chip would otherwise become
unreliable due to low voltage.
11/23/2023 159
Unit1 complete
11/23/2023 160