Sie sind auf Seite 1von 84

R N Satish Kumar

CKO
Harness systems - Bangalore

Embedded systems
Computing systems are everywhere
Most of us think of desktop computers
PCs
Laptops
Mainframes
Servers

But theres another type of computing system


Far more common...

Embedded systems

Embedded computing systems

Computing systems embedded within

electronic devices

Computers are in here...


and here...

Hard to define. Nearly any computing


and even here...

system other than a desktop computer


Billions of units produced yearly,

versus millions of desktop units


Perhaps 50 per household and per

automobile

Lots more of these,


though they cost a lot
less each.

Embedded System
An embedded system
is combination of hardware
components
and software components to perform a specific
application
The hardware part is usually:
Processor/Controller
Peripherals
Memory

Bus
And the software part would be:
Application programs
Operating systems
Drivers

Characteristics of embedded
systems
Single-functioned
Executes a single program, repeatedly

Tightly-constrained
Low cost, low power, small, fast, etc.

Reactive and real-time


Continually reacts to changes in the systems

environment
Must compute certain results in real-time without delay

Examples: Digital Consumer


Broadband Access
Cable, xDSL modems, Markets
Home

Gateways
Home Media Servers
Interactive Digital TV
Cable, Satellite and Terrestrial
STBs
HDTVs
Digital Imaging
Digital Cameras,
Printers, MFPs, Scanners, Fax
Mobile & Handheld
Mobile phones
PDAs
Digital Audio/Video
Web-Tablets
Screenphones

Embedded System in Robotics

Robocleaner

Aibo

Ashimo

In Automobiles

In Aerospace and Defense

And a few more

Classification of Embedded
Systems

Embedded Systems are classified as :


- General purpose
- Real time.

General purpose systems are those which do not have


any time constraints associated with their functionality .
Real time system are those which have some time
constraints associated with their operation.

General Purpose

Embedded

High computing performance

Low computing performance

End-user programmable

Developer programmable

GUI

GUI or non-GUI

Few memory / storage / power


constraints

High resource constraints


(economics dominate)

Multi-purpose to end-user

Typically dedicated function

Operated when user runs


application

Typically operating 24/7 or always


when switched on

Economics justify prices in the


$1,000s

Economics typically dictate prices


in the $10s

Few, clearly defined interfaces

Vast array of chip-level, board-toboard and external interfaces

Design Challenges
Faced

Embedded System Development Life


Cycle

Embedded System Components


1. Hardware provides basic computing resources (Processor,
memory, System Bus and I/O modules).
2. Operating system controls and coordinates the use of the
hardware among the various application programs for the
various users.
3. Applications programs define the ways in which the
system resources are used to solve the computing problems of
the users (compilers, databases, games, business programs)
4. Device Drivers enable software programs talk to hardware

The design of an embedded system implies that both software


and hardware are being designed in parallel.

Embedded Software Design Cycle

Embedded System Hardware

Example: Digital Camera

Evolution of Processors

We started off with 4-bit processor, 4 Kbit of

memory and 1 MHz operating frequency way


back in 1970.
We have advanced to 64-bit processors, Gbytes

of memory
Operating frequency have moved up to 3 GHz
Advances possible due to
VLSI Technology

Evolution of
In 1970 the first 4 bit microprocessor 4004 was
microprocessors
introduced by Intel.
Then came: 8008, 8080 and 8085 all 8 bit processors
8086, 80186, 80286 16 bit processors
80386, 80486, Pentium, Pentium II, Pentium III and

the latest P-4


Current trends: Dual core, Core2Duo, Quad Core

processors
Intel and AMD biggest players in processor field.

Address/Data
Bus

Memory

Special
function
registers
(PC, SP)

Decode &
Control
Unit

General
purpose
registers

Bus
Controller
Peripheral
bus
controller

ALU

Cloc
k

Microprocessor
General-purpose microprocessor
CPU for Computers
No RAM, ROM, I/O on CPU chip itself
Example Intels x86, Motorolas 680x0

CPU
GeneralPurpose
Microprocessor

Many chips on mothers board

Data
Bus
RAM

ROM

I/O
Port

Address Bus
General-Purpose Microprocessor System

Time
r

Seria
l
COM
Port

Classification of
Based on Memory connection:
microprocessor
Van Neumann
Harvard

Based on Instruction set supported


Complex Instruction set computer (CISC)
Reduced Instruction set computer (RISC)

Von Neumann architecture

Von Neumann Design is quite satisfactory when you are content to


execute all of the required tasks in serial.

Von Neumann architecture


-Developed by John Von Neumann
-Most widely used architecture.
-Implemented in majority of the processors.
-All elements in the system are controlled by single
bunch of 3 busses.
*Address bus.
*Data bus.
*Control bus.

Harvard architecture

Harvard Architecture
-Developed at Harvard university.
-Uses two different bus systems to transport
-Instructions fetched from the program memory
-Program memory has its own address, data and control bus.
-Data to CPU from peripherals or memory to CPU.
-Data bus has its own address, data and control bus.
-Program and data memories physically/logically separated
(accessed using different buses)
-Simultaneous fetch of instructions from program memory
and data from data memory.

Connection of Peripherals
The peripherals devices also need address and

data line to communicate with CPU


Two methods are used:
Memory mapped IO
IO mapped IO

Memory Mapped IO

Memory-mapped I/O uses the same address bus to address

both memory and I/O devices

The CPU instructions used to access the memory are also

used for accessing devices.


Areas of CPU's addressable will be reserved for I/O.
Each I/O device monitors the CPU's address bus and

responds to any CPU's access of device-assigned address


space, connecting the data bus to a desirable
device's hardware register.
Advantage: Simple and cost effective

IO Mapped IO
IO mapped I/O uses a special class of CPU instructions

specifically for performing I/O.


The IN and OUT instructions which can read and write a

single byte to an I/O device.


I/O devices have a separate address space from general

memory.
IO mapped IO is accomplished by an extra "I/O" pin on the

CPU's physical interface, or an entire bus dedicated to I/O.

Processor Classification
Processor Classification based on Instruction

set architecture
Complex Instruction Set Computer (CISC)
Reduced Instruction Set Computer (RISC)

CISC Architecture
Complex Instruction Set Computer (CISC)
Too many instructions and Addressing modes (>100)
Variable length instructions

1 byte to several bytes


1

byte to 17 bytes in 80386

Most instructions are executed with microcode


Most instructions take multiple clock cycles to

execute

CISC

Small internal register set ( less than 32)


CISC uses more transistors
e.g. Pentium 4 (CISC) has approx 55 million+ transistors

MSP430 (RISC) has only 6825* transistors!

Optimised to reduce the number of instructions executed


by having complex instructions.

focus.ti.com/lit/ml/slap105a/slap105a.pdf
+ http://ffden-2.phys.uaf.edu/212_fall2003.web.dir/David_Giessel/trans.html

Disadvantages of CISC
Highly complicated control unit
Slower processing time (using microcodes & complex
instructions)
Longer design cycle

Difficult for compiler to optimise HLL

CISC Effects
Moved complexity from s/w to h/w
Compact code
Ease of compiler design (HLLCA)
Easier to debug
Lengthened design times
Increased design errors

The 32-Bit Microprocessor


Complex Instruction Set Computer (CISC)

Intel

: 80386, 80486, PI, PII, PIII, PIV

AMD
2200+

: K6-III, Athlon (K7), Athlon XP

Motorola: 68020, 68030,


68040/50/60

CISC & RISC ARCHITECTURES


Way back in late 1970s, researchers were shocked to

notice that CISC processors were spending most of their


time performing relatively simple instructions.
It was also recognized that complex instructions

required potentially complex decoding circuit.


Reduction in complexity could lead to improvement

in execution time.

RISC
Provide only basic instructions & addressing

modes (50 - 75)


Fixed length instruction
No or little microcode used
Most Instructions require 1 machine cycle

RISC
Reduced Instruction Set Computer (RISC)

Large internal register set (32 - 256)


Simple structure : fewer transistors
Instruction set designed to optimise High
Level Language efficiency
Optimised to
Reduce the number of cycles per
instruction
Keep the cycle time short at the same
time

RISC Effect
Move complexity from H/W to S/W
Provided a single-chip solution
Better use of chip area
Better Speed
Feasibility of pipelining
Single cycle execution stages
Uniform Instruction Format

RISC
Two groups of RISC architectures

Desktop and server RISCs:

Digital Alpha

Hewlett-Packard PA-RISC

IBM and Motorola PowerPC

Silicon Graphics MIPS

Sun Microsystems SPARC

RISC
Embedded RISCs:

Advanced RISC Machines (ARM)

MSP430

Hitachi SuperH

Mitsubishi M32R

Silicon Graphics MIPS16

RISC

The embedded RISCs tend to have 8 to 16 general-

purpose registers
while the desktop/server RISCs have 32

The length of instructions is 16 to 32 bits in embedded

RISCs but always 32 bits in desktop/server RISCs.


Separate embedded instruction set architectures,

Thumb and MIPS16 are really optional modes of ARM


and MIPS invoked by call instructions.

Basics of RISC instruction set


All operations on data apply to data in a register.
The only operation that effect memory are memory

load/store
Instructions are few in number and the instructions widths

are same
A simple RISC instruction set contains:
ALU instructions
Load/Store
Branches and jumps

Disadvantages of RISC

Limit on how far an instruction set can be reduced or

simplified and still allows a computer to effectively perform all


of the functions necessary for a particular application

Requires a large amount of instructions to handle any problem

Complicated subroutines

Program occupies more memory

Classifying instruction set


Register- Memory
Register- Register (loadarchitecture
Store)
- Used in CISC

- Used in RISC

Two classes
Register-Memory
Memory addressing modes

Register-register (Load-Store)
Registers are faster than memory.
Registers are more efficient for a compiler to

use

Code sequences for C=A+B


Register-Memory
(Load Store)

Register-Register

-------------------------------------------------------Load R1, A Load R1, A


Add R2, R1, B
Load R2, B
Store R2, C
Add R3, R1, R2
Store R3, C

Role of Compiler : RISC vs. CISC


CISC instruction:

MUL <addr1>, <addr2>


RISC instructions:

LOAD A, <addr1>
LOAD B, <addr2>
MUL

A, B

STORE <addr1>
RISC is dependent on optimizing compilers

Register-Memory
Memory addressing
Addressing modes

Register
Add R4, R3
Immediate Add R2, #3
Register indirect Add R4, (R3)
Indexed
Add R4, (R3+R5)
Direct or Absolute Add R4, (1000)
Autoincrement
Add R1, (R2)+
Autodecrement
Add R1, -(R2)

Improving CPU performance


The CPU normally runs at very high frequency. But the

Memory and IO deceives are not as fast as the CPU.


When ever the CPU wants to access the memory or the IO

devices, it has to slow down to the speed of that devices.


For example: If the CPU is running at 1 GHz and the IO

devices at 100 MHz, the CPU will have to reduce its speed
from 1GHz to 100 MHz.
This slowing of the CPU will reduce the performance.

Improving CPU performance


Several techniques are employed for increasing

the CPU performance:


Pipeline
Cache memory
Superscalar architecture
Co-processors etc

Pipelining
Ability to break down a complex operation into

stages so that these stages can be executed in


parallel.
Fetch: get an instruction from memory
Decode: decode the instruction and read the source operands
Execute: perform the operation specified in the instruction
Write: store the result in the destination

Pipleline Stages
Fetch

Decode

Execute

Fetch

Decode

Execute

Fetch

Decode

Execute

- As we can see, when one instruction is being executed, the


next instruction is being decoded and the next to next
instruction is being fetched.
-at any point of time the Fetch, Decode and Execute stages are
always occupied.
- As the instructions are processed parallely, time taken to

Cache Memory
Local high speed memory to provide a primary pool of reusable

instructions and data accessed more frequently by the processor.


Saves time otherwise wasted on fetching instructions and data from

memory.
Benefits of cache improves with cache size.

Memory

CPU
Cache

Superscalar Operation

-Execution of two or more instructions / operations are


performed per cycle by two or more execution units.
- If one execution unit is busy, the next instruction can be
sent to other execution units.

Execute 1
Fetch

Decode

Execute 2
Execute 3

Availability of
Microprocessors
Currently we dont get microprocessors of size: 4, 8, 16
bit for commercial usage.
So for a simple application like: controlling a toy car or

switching on/off a device, a 32 bit microprocessor will be


too powerful!

Micro controllers
A self-contained system in which the processor, support

memory and input/output (I/O) are all present in a single


package.
So what is a microcontroller?

A microcontroller is a compact standalone computer,

optimized for control applications. Entire processor,


memory and the I/O interfaces are located on a single
piece of silicon so, it takes less time to read and write to
external devices.

Microcontrollers
By-product of microprocessor development was micro

controller.
Micro controller is responsible for all the video games,

elevators, toys, washers, VCRs, automobiles, microwaves and


all other articles that are intelligent and programmable.
Extremely popular microcontroller core, made by many

independent manufacturers including AMD, TI, Atmel, Dallas,


Intel, Motorola, Hitachi, Philips, Toshiba, Microchip and
Siemens.

Block Diagram of a microcontroller


RAM

External Bus
controller

Clock

ROM

General and
Special
Function
registers

ALU

On chip
peripheral

Interrupt
Controller

On-Chip
Peripheral

Benefits of microcontrollers
Following are the reasons why microcontrollers are
incorporated in control systems:

Cost: Microcontrollers with the supplementary circuit components


are much cheaper than a computer with an analog and digital I/O

Size and Weight: Microcontrollers are compact and light compared


to computers

Simple applications: If the application requires very few number


of I/O and the code is relatively small, which do not require extended
amount of memory and a simple LCD display is sufficient as a user
interface, a microcontroller would be suitable for this application.

Reliability: Since the architecture is much simpler than a computer


it is less likely to fail.

Speed: All the components on the microcontroller are located on a


singe piece of silicon. Hence, the applications run much faster than it
does on a computer.

Applications of
TransportationMicrocontrollers

cars, buses, trucks, trains, air crafts


Communications
mobiles, hubs, switches

Buildings
access control, smoke sensors, CCTV

Office systems and mobile equipment


fax, photocopying m/c

Banking, finance and commercial


ATM, card swiping m/c

Medical diagnostics, monitoring, and life support


ECG, X-ray, MRI

Environmental monitoring equipment


- wind speed, temperature, pollution monitoring

Manufacturing and process control


- Bottling plant, textile mills, car manufacturing plant etc

Microprocessor vs. Microcontroller


Microprocessor
CPU is stand-alone,
RAM, ROM, I/O, timer
are separate
designer can decide on
the amount of ROM,
RAM and I/O ports.
expansive
versatility
general-purpose

Microcontroller
CPU, RAM, ROM, I/O
and timer are all on a
single chip
fix amount of on-chip
ROM, RAM, I/O ports
for applications in which
cost, power and space are
critical
single-purpose

Criteria for choosing a Microcontroller


1.

Meeting the computing needs of the task efficiently and cost


effectively

speed, the amount of ROM and RAM, the number of I/O


ports and timers, size, packaging, power consumption

2.

easy to upgrade

Availability of software development tools

assemblers, debuggers, C compilers, emulator, simulator,


technical support

3.

Wide availability and reliable sources of the microcontrollers.

MEMORY
Characteristics
Types
Memory wiring
Address Space

Memory Types
MEMO
RY

HYBRI
D

RAM

DRAM

SRAM
NVRAM

ROM

EEPROM
FLASH

EPROM

MASKED
PROM

Memory Systems
There are many types of memory devices - each with a range
of application areas
Issues include
Access speed
Density (how many locations can be crammed into a
certain space on silicon)
Cost
Chip size
Programmability (PROM, EPROM, EEPROM...)
Volatility

Embedded system components: Memory


Software storage is done usually in ROM, PROM or EPROM
- Read Only Memory (ROM) could be on-chip or off chip
- External Programmable ROM (PROM) can be programmed by the
customer
- Development versions which allow erasing of the stored
information are called Erasable PROM (EPROM)
- Non-volatile memories are used to hold initialisation (bootstrap)
code and application code.
External RAM is used for data storage. Microcontrollers usually contain
a small amount of internal RAM as well as ROM storage. Some
applications are engineered to use just on-chip RAM as an economy.
External RAM may cost as much as a processor.

Embedded system components: Memory


Hybrid memory devices can be programmed as a system is
powered-up and executing. The stored data is retained when the
system is powered-down
- Battery-backed-up RAM modules like NVRAM.
- Non-powered non-volatile RAM devices like EEPROM.
- Flash memory devices - high density, low cost, nonvolatile,
fast (to read, but not to write) & electrically reprogrammable.
Many microcontrollers may include an area of non-volatile
memory internally.
Atmels 89C51 is an 8 bit microcontroller with 2KB internal
Flash.

Memory Device Characteristics


Memor
y
Type

Volatile
?

Writeable
?

SRAM

Yes

Yes

Eras
e
Size
Byte

Erase
Cycles

Relative
Cost

Relative
Speed

Expensiv
e
Moderate

Fast

N/A

Unlimi
ted
Unlimi
ted
N/A

DRAM

Yes

Yes

Byte

Masked
ROM
PROM

No

No

No

N/A

N/A

Entir
e
chip
Byte

Limite
d
Limite
d

Moderate

Fast

No

Once,with
program
mer
Yes,with
program
mer
Yes

EPROM

No

EEPRO
M

Expensiv
e

Flash

No

Yes

Secto
r

Limite
d

Moderate

NVRAM

No

Yes

Byte

Unlimi
ted

Expensiv
e

Fast to
read,
slow to
Fast to
write
read,
slow to
Fast
write

Inexpensi
ve
Moderate

Modera
te
Fast
Fast

Addressing memory
When 8-bit microprocessors appeared in the 1970s, memory was
- Expensive
- Only available in small sizes (256 bytes up to 1K)
Applications were small and were written in assembly before
specialised compilers were available for the processors.
The address lines were increased to 16 enabling access for up to
64K address. This space offered by the processors seemed huge and
would never be used up!
Advent of high-level-languages (HLLs) and operating systems
increased memory requirements memory started to become a
limitation.

Memory Bus Wiring

Memory Space
If there are 8 bits in the data bus, then a 32-bit data write or read
requires 4 bus cycle.
If there are 20 bits in the address, the total addressable memory
space is 1MB (2^20).
Of course there may be multiple memory chips within the
addressable range
Even different types (RAM, ROM, EPROM, Flash)
And unfilled holes in the address range.

Memory Map

Processor-Memory interface
Address bus

Higher
address
lines

Address
decoder

Read/notWrite
RAM

RAM

RAM

Data bus
Individual chip selects

Clock line

Processor

Peripherals
Memory is just storage and is not the only device connected to a given
processor.
I/O devices (peripherals) are connected to processor enabling interaction
with the surrounding environment.
I/O devices used for read are Input devices and I/O devices used for write
are Output devices.
Example peripherals:outputs:
One or more LEDs
A digital-to-analog converter
Input:
Switches, buttons, and knobs, etc`

Peripherals
interfaces for analogue peripheral devices

sensors

Input
conditioning

Conversion/buffering

processing
Motors,
actuators,
pumps,
temperature
control,
positioncontrol, audio,
video etc

Output
conditioning
analogue

Conversion/storage
digital

Peripherals
Example : a PWM motor controller:
inputs are:
demanded speed - user input
actual speed - sensor output
output is:
pulse-width modulated (PWM) waveform to control
power-switching to the motor
PWM Waveform

Counter/timer
Power amplifier
Speed Sensor (tachometer) output

V
+
t

start

stop

A/D converter
Parallel interface
microcontroller

Software to
implement
motor control

Types of Peripherals
Main types of peripherals :
binary outputs - simple external pins which can output a 1 or a 0 (5V
or 0V approx.) Often grouped together to form parallel ports where a
group of bits can be input or output simultaneously. Once a bit is set, the
value remains because it uses a latching flip-flop implementation
serial outputs - send and receive data using a transmit(tx) pin and a
receive(rx) pin on a chip. Parallel data is written to a register and the
serial port logic automatically sends it serially, bit by bit, out on the tx pin
at a program selectable rate. Status register information is available to be
read by a program and error information is also available.

Peripherals
Analogue interfaces: the real world often provides continuous
analogue information whereas the digital world works with discrete
values. Conversion circuits are required
Displays : simple seven-segment light-emitting-diode (LED)
displays, individual LEDs, liquid-crystal-displays (LCD) of various
forms including graphic and alpha-numeric, monitors and other
display technologies
Time related values: counter-timer devices allow rate-generation,
PWM, single-shot pulse (one pulse of deterministic length) and also
allow measurement of time and rate from externally generated pulse
sources.

Summary
Embedded Systems
Components of Embedded systems
Microprocessor
Classification of microprocessors
Microcontrollers
Criteria for choosing the microcontroller
Memory
Peripherals

Das könnte Ihnen auch gefallen