Introduction To Emb System
Introduction To Emb System
The Future
Embedded System
Future of 21st Century
• Examples of system
– Time display system – watch
– Automatic cloth washing system – washing m/c
h/w and s/w - part of some larger systems and expected to function without
human intervention
• “An embedded system is a system that has software embedded into computer-
hardware, which makes a system dedicated for an application (s) or specific part
of an application or product or part of a larger system.”
– s/w usually embeds into a ROM or flash
– Independent system or part of a large system
» by Raj Kamal
Embedded System - Definitions
• “An embedded system is one that has a dedicated purpose software embedded in a computer
hardware.”
» By Raj Kamal
• Any device that includes programmable computer but not self intend to be a general purpose
computer
» Wayne Wolf
• Combination of Software and Hardware in which the software controls the entire hardware
for a dedicated application
» Raj Kamal
• A general-purpose definition of embedded systems is that they are devices used to control,
monitor or assist the operation of equipment, machinery or plant. “Embedded” reflects the
fact that they are an integral part of the system. In many cases, their “embeddedness” may be
such that their presence is far from obvious to the casual observer.
>> Institute of Electrical Engineers (IEE)
Embedded System Vs Desktop System
• Desktop / Laptop
– General purpose computer
– Used for playing games, word processing, accounting, SDT etc.,
• Embedded System
– Single Purpose and
– fixed embedded software for specific job
• Typical Examples
– A/C, VCD/DVD Player, Printer, Fax m/c, Mobile phone etc
– Customized embedded hw + fixed embedded sw (firmware) + specific
processor
• to meet the specific requirement
Examples
PDA
Digital camera
Cell phone
Camera - Canon EOS has 3 microprocessors - 32b RISC CPU runs auto focus
Digital TV
decompression, descrambling etc., more functionality
complex signaling functions
Examples
Automobile ES
high end automobile may have 100 microprocessors
4b up checks tension of the seat belt
uc run dashboard devices - display services
16/32b up controls engine - most complex function
Restricted memory
low power
critical in battery operated devices
many systems are multi rate - inputs from external world comes at different
rates
Characteristics of Embedded System
Application dependent requirements
Safe
avoid physical or economic damage to person or property
Characteristics of Embedded System
More Features – Dedicated Systems
do specific task
Sony’s Aibo Robotic Dog uses ERS-110 an MIPS 64b RISC processor
coordinate the motions
needs to do sensing
control the manipulators
need to communicate
Ex: football competition b/w robo
More Examples
Control systems
sensing and actuating - is a specific job
feed back control of RT systems
vehicle engines - fuel injection control
flight control
nuclear reactors
Types of Embedded System
signal processing
core job is processing of signals
radar
sonar
DVD players
diagnostic tools
trace failures
system does self checks to check all paths on regular basis using diagnostic
tools
if not system may damage the users due to unexpected malfunctions
emulators
IS emulators
emulates target processor on another m/c
simulation environment
timing analysis of code on host m/c
Implementing Embedded System
PC - hw connector - target board
monitor execution of code from PC
debugging tools
System SW
Cross compilers and assemblers
emulators and simulators
debugging tools
DSP
signal processing is the basic task
cost is more than GP
SoC
multi cores + Co-Processor + peripherals
Ex: TI - RISC + TI DSP + entire communication integrated
more sophisticated functionalities
History of Processor Architecture Evolution
Von-Neumann Architecture
Primitive architecture
Computer programs – small and simple but memory is costly
More suited for data intensive applications : DSP – require multiple data
operands for each instruction execution
Advantages
simpler instructions could speed up the pipe-line and thus provide a
performance improvement.
simple instruction set implies less computer hardware and thus reduced cost.
History of Processor Architecture Evolution
RISC basic design goals
Less # of instructions – instruction designed for simple operations executed
in single cycle
processing units and instruction set suit the Signal Processing Applications
MAC (Multiply and Accumulate) and Shifter (Arithmetic and Logical shift) units are
added to the DSP cores
Signal Processing Algorithms heavily depend on such operations
lot of embedded systems run signal processing applications (cell phones, portable
media players etc)
History of Processor Architecture Evolution
VLIW Architecture
“Very Large Instruction Word” architecture consists of multiple ALUs in parallel
Programmers can break their code such that each ALU can be loaded in parallel.
The operation to be done on each ALU (in a given cycle) forms the instruction
word (for that cycle).
The processor does not have any hardware to ascertain (and reschedule) the order of
instructions (this is called static scheduling).
Characteristics of Embedded SW
so, design logic on FPGA or ASIC a dedicated function using low cost cpu and
include it for compromising on cost
dedicated logic on FPGA or ASIC to compromise of SW so as to meet deadline
affordability
depending on the market targeted
safety
security
not cause bodily harms to users
scalability
timeliness
operation in time
ES Design – A Global Picture
mechanical hw
control algorithms
sw
humans
society / institutions
sociological acceptance of product - accept by society
ES Design – Life Cycle
ES Design Life cycle events
LC => how do a ES gets developed
Requirements
Design
Manufacturing
Deployment
Retirement support
ES Design Goals
performance
overall speed, deadlines
mfg cost
power consumption
size and power also related to performance and should be taken care accordingly
Ex: cannot design a digital camera of wt 10 kg
ES Design Goals
Functional and Non Functional Requirements part of ES design
Functional requirements
o/p as a function of i/p - specification of ES as i/o
functional and non functional requirements are critical for product acceptance
Design and Development Process of ES Life Cycle
Requirements
Specifications
Architecture
Components Design
System Integration
Testing is critical
GP system - patch download for a bug
ES system - use forever and no flexibility for patch update
ES Design Approach
TD or bottom up as like SDLC
TD
start from most adt description work to most detailed
BU
work from small components to big system
re-use of parts already developed
real design uses both techniques
in ES: since special purpose h/w is designed if deadline not met with SW
so hw and sw design should go in hand
Microcontroller
Device
Integrates # of components of microprocessor system on to a single microchip
Optimized to interact with ext world through on-board interfaces
i.e. it is a little gadget that houses a microprocessor, ROM (Read Only Memory),
RAM (Random Access Memory), I/O (Input Output functions), and various other
specialized circuits all in one package.
Microprocessor
Optimised to coordinate flow of information b/w separate memory and
peripheral devices located outside itself
System bus (AB / DB / CB) - up uses to select the peripheral for sx/rx data
Microcontroller
Processor and peripherals on single silicon
Self-contained device – rarely bus structures extend outside package
Microprocessor Vs Microcontroller
Microprocessor Microcontroller
Collection of on/off SWI on Silicon Small and self-suffice SoC to control
for computations
CPU is stand-alone, RAM, ROM, devices
I/O, timer are separate CPU, RAM, ROM, I/O and timer are all
designer can decide on the amount of on a single chip
ROM, RAM and I/O ports.
Expandable fix amount of on-chip ROM, RAM, I/O
ports
Expensive Not Expandable – no external bus
interface
High Speed (1000 MIPS) for applications in which cost, power
and space are critical
General purpose and Versatile Low speed, on the order of 10 KHz – 20
MHz
Large Architecture (32b, 64b)
single-purpose
Lots of IO and Peripherals externally Small usually an 8b
connected Limited IO, enough for intended app
Microcontroller – Fundamental Components
Microcontroller incorporates onto the same microchip the following:
The CPU core
Memory (both ROM and RAM)
Some parallel digital I/O
A Timer module to allow the microcontroller to perform tasks for certain time
periods.
A serial I/O port to allow data to flow between the microcontroller and other
devices such as a PC or another microcontroller.
An ADC to allow the microcontroller to accept analogue input data for processing.
Basic Microcontroller Architecture
Memory Unit
Store data and program
Addressing and memory locations
Control line to r/w
CPU
ALU + CU + Shifter + Memory L/S opns
Processor Registers
Connection b/w memory and CPU
Bus
Wires in power of 2 – address, control and data bus
address bus – wires = amount of memory
data – word length – connect all blocks inside microcontroller
Input-output unit
Ports are memory locations
Types of ports : input, output or bidirectional ports.
Working with Port
Select the port
Configure for i/o and r/w data
Timer Unit
Info about time duration, protocol in serial communication
free-run counter which is in fact a register whose numeric value increments
by one in even intervals – elapsed time calculation b/w time intervals
Basic Microcontroller Architecture
Watchdog Timer
flawless functioning of the microcontroller during its run-time
What if uc stops working or works incorrectly due to interference?
Assembling all the blocks into an electronic component where uc will access
the inner blocks through the outside pins
Interrupt
Major diff b/w DTP SW and embedded sw is ‘interrupt’
Low level perspective
hw mechanism for notification to CPU about event occurrence
Internal events: overflow of timer
External events: arrival of char through serial interface
low cost, huge range, easy availability and widespread use of the 8051 family
makes it
an excellent platform for developing embedded systems:
ideal platform for learning about embedded systems.
Intel MCS-51 family
PROM
WORM (write once read only memory) or OTP
PROM programmer – blow tiny fuses in the memory device
Fuses blown cannot be repaired but devices are cheap
Modern 8051 variants include OTP ROM
Memory Issues relating to 8051
UV EPROM
Programmed electrically
Has quartz window to erase memory by exposing the device to UV light
Erasure takes several minutes
Quartz window covered with UV opaque label after erasure
Can withstand 1000’s of program / erase cycles
Useful for prototyping but expensive to use in production
More Flexible than PROM and rather primitive compared to EEPROM
8051 members with on board UVEPROM are available
• DTP PC Context
– Program copied from Disk to RAM
– Executed from RAM
– Many 8051 - > 20 bytes On-Chip ROM + not >= 256 bytes of RAM
• appropriate mix for most general applications
Timers
• Atleast 2 Timers – T0 and T1 (8052 – additional Timer T2)
• Used to
– measure intervals of time
• For example, we can measure the duration of a function by comparing
the duration at begin and end
– generate precise hardware delays
– generate ‘time out’ facilities - a key requirement in systems with real-time
constraints
– generate regular ‘ticks’, and drive an operating system
Interrupts
• Fundamental difference b/w DTP SW and
Embedded SW
• low-level perspective
– hardware mechanism to notify a
processor that an ‘event’ occurs
– Internal events (overflow of timers) or
– External events (arrival of char
through serial interface)
• high-level perspective
– mechanism for creating multitasking
applications
• App performing more than one
task at a time using a single
processor
8051 Interrupt Sources
– In addition, there is one further interrupt source over which the programmer
has minimal control
• The ‘power-on reset’ (POR) interrupt
Serial Interface
• 8051 - serial port compatible with RS-232 communication protocol
– transfer data b/w 8051 and desktop PC/notebook PC or similar
– Serial interface is common in embedded processors and widely used
– load code into flash memory for ‘in circuit programming’ (ISP)
• when code must be updated ‘in situ’ (for example, when the product is
already installed in a vehicle, or on a production line)
The names counter and timer can be used interchangeably when talking about
the hardware.
The difference in terminology has more to do with how the hardware is used in
a given application.
Both differs largely by their use and not in logic
A Simple Timer / Counter
simple timer similar to those often included on-chip within a microcontroller
build something similar from a couple of 74HC161 counters or a programmable logic device.
The timer shown consists of a loadable 8-bit count register, an input clock signal, and an output signal
Since the latch still holds the value written by the processor, the counter will begin counting
again from the same initial value
Such a timer will produce a regular output with the same accuracy as the input clock.
This output could be used to generate
a periodic interrupt like a real-time operating system (RTOS) timer tick,
provide a baud rate clock to a UART, or
drive any device that requires a regular pulse.
Semi-Automatic Timers
Initial value as end point
timers uses the value written by the processor as the endpoint rather than the
initial count
In this case, the processor writes into a terminal count register that is
constantly compared with the value in the count register
To distinguish between a count that will not repeat automatically and one that
will, the hardware is said to be in one of two modes:
one-shot or periodic
timer is run at a constant clock rate (usually a derivative of the processor clock )
so count registers is constantly incrementing (or decrementing, for a down counter)
On an external signal
latches the value of the free-running timer into the processor-visible register and
generates an output signal (typically an interrupt)
Input Capture Timer
Use for:
to measure the time between the leading edge of two pulses.
By reading the value in the latch and comparing it with a previous
reading, the software can determine how many clock cycles elapsed.
In some cases, the timer's count register might be automatically reset just after
its value is latched
If so, the software can directly interpret the value it reads as the number of
clock ticks elapsed
input capture pin can usually be programmed to capture on either the rising or
falling edge of the input signal.
Bus Based Computer Systems
Created using up, IO devices and memory components
Up is vital components of embedded computing system
Cannot do job without IO devices and memories
How interconnect up and devices using cpu bus
Similarities in bus b/w platforms required for different applications – general
useful principles from basic concepts of bus
To Know
Cpu bus – back bone of hw system
Memory – important component of embedded platforms – types of memory
devices
Varieties of IO devices types
Basic techniques for interfacing memories and IO devices to the cpu bus
Structure of complete platform
Development and debugging
System level performance analysis for bus based systems
Alarm clock design example
The CPU Bus
Computer system
encompasses much more than CPU
also includes memory and IO devices
Bus
collection of wires + also defines protocol by which cpu, memory and
devices communicate
Architectural features improve both the speed and capacity of memory systems.
Microprocessor clock rates are increasing at a faster rate than memory speeds
memories are falling further and further behind microprocessors every
day.
Bus + Protocol
Memory + Controller
R/W
random access
any location in memory can be accessed at the same rate
same rate => time to place address and get the data is going to be same for all the
locations in memory, so it can be randomly accessed
counter part of random access is serial access => block by block or byte by byte
so in serial access time taken to access is < n+1th block
Memory Classification
Semiconductor based Memories
Ex: all RAM / ROM subsystems comes under this classification
since they make use appropriate semiconductors for storage
Dynamic RAM
Passive element along with active element
Memory controller to take care of memory retention in passive element
Slow with higher capacity and less cost
Memory Hierarchies
Memory Hierarchy basically comes from
Speed mismatch b/w CPU and Memory System
Principle of Locality and focus on
Increasing the processor utilization
Fast, Medium and Slow Memories by dividing entire address space into sections
Fast Memory – Cache – SRAM – easy and peak access – less size
Slow Memory – storage subsystems – Tapes or HDD – CPU may not directly access - larger size
Ensure that CPU always access only the faster memory in order to keep the processor utilization
always up
CPU essentially access the cache – so entire address space will not used by same kind of memory
Cache
SRAM – Closest – Fastest – Costlier - Less Size
Ex: 1KB Cache
cache is a small, fast memory that holds copies of some of the contents of main
memory
Because the cache is fast, it provides higher-speed access for the CPU
But since it is small, not all requests can be satisfied by the cache, forcing the
system to wait for the slower main memory
Multi Level Caches
Modern CPUs may use multiple levels of cache