Vous êtes sur la page 1sur 78

UNIT 1

EMBEDDED COMPUTING

Microprocessor and Microcontroller

Microprocessor

Microcontroller

It is just a processor. Memory


and I/O components have to be
connected externally
Since memory and I/O has to be
connected externally, the circuit
becomes large.
Cannot be used in compact
systems and hence inefficient
Cost of the entire system
increases
Due to external components, the
entire power consumption is high

Micro controller has external


processor along with internal
memory and I/O components
Since memory and I/O are present
internally, the circuit is small.
Can be used in compact systems
and hence it is an efficient
technique
Cost of the entire system is low
Since external components are
low, total power consumption is
less

INTRODUCTION
Embedded Computing:
What is microprocessor?
Used for control, user interfaces, signal processing and many other
tasks
Engine that turns into motion when you turn your computer on
Performs arithmetic and logic operations using registers

1.1 COMPLEX SYSTEMS AND MICROPROCESSORS


Embedded Computing System:
Any device that includes a programmable computer but is not itself a
general-purpose computer
It is a special purpose system in which the computer is encapsulated
by the device it controls.
It performs pre-defined tasks
Examples: Atm, cell phones, printers, calculators, videogame console,
fax machines, clock, household appliances , automobiles etc

Purpose of Embedded Computing System:


To accept input from the user, perform computations, and generate
outputs and run in real time
Should lower power dissipation but should run in high speed
Should provide accurate results
Should be reliable over a long period of time
Should be in small size and low weight

1.1.1 Embedding Computers


History:
Computers have been embedded into applications since the earliest
days of computing.
Late 1940s: MIT Whirlwind computer was designed for real-time
operations.
Originally designed to control an aircraft simulator.
First microprocessor was Intel 4004 in early 1970s.
HP-35 calculator used several chips to implement a CPU

1.1.1 Embedding Computers


History:
Automobiles used microprocessor-based engine controllers starting in
1970s.
Determining when the spark plugs fire
Controlling fuel/air mixture
Provides lower emissions, better fuel efficiency.

1.1.1 Embedding Computers


Varieties of Microprocessor:
Depending on the word size:
8 bit microcontroller (low cost applications + on board memory and I/O
devices )
16 bit microcontroller (sophisticated applications + offchip memory and
I/O)
32 bit RISC microprocessor (offers high performance)

Household use of Microprocessor:


Microwave oven: at least one microprocessor
Advanced thermostat system: controlling temperature
Modern camera

1.1.1 Embedding Computers


Microprocessor in digital television:
Specialized CPUs are used
CPU is designed for audio processing in SGS Thomson
Reasons for using programmable CPU:
Easier to debug and design
Possibility of upgrading and using CPU for other purposes

Microprocessor in automobiles:
High-end automobile: 100 microprocessors
Inexpensive Car: 40 microprocessors

Embedded systems

General purpose computers

An embedded system is only


meant for one purpose.
Runs a few applications often
known at design time

These are the computers that are


designed to perform many
operations
Intended to run a fully general
set of applications
End-user programmable
Faster is always better
Example for general purpose
computer is PCs.

Not end-user programmable


Operates in fixed run-time
constraints
Example for an embedded
system is a portable music
player

Example: BMW 850i and stability control system


Anti-lock brake system (ABS): pumps brakes to reduce skidding.
Temporarily releases brake when it rotates too slowly
It sits between hydraulic pumb and the brakes

Sensors on the wheel is used to measure the speed on wheels


Wheel speed measured by ABS is used to determine hydraulic fluid
presure to prevent wheels from skidding
Automatic stability control (ASC+T): controls engine to improve
stability.
ABS and ASC+T communicate.
ABS was introduced first---needed to interface to existing ABS
module.

Example: BMW 850i and stability control system

ASC+T controls four different systems:


Throttle: device controlling the flow of fuel to engine
Iginition timing: when the electric spark is generated, fuel burns and powers the
car
Differential brake: applying different brake presure on different brakes
Gear shifting: changing from one gear arrangement to another

1.1.2 Characteristics of Embedding Computing System


1. Complex Algorithms:
Operations performed on microprocessors are very sophisticated
An automobile have microprocessors for:
Minimizing pollution
Minimizing fuel utilization

2. User Interface:
Microprocessors are used for managing complex user interfaces
Eg: GPS(Global Positioning System)
3. Real time:
Many embedded systems have to perform in real time so data should
be ready within deadline
Failure to meet deadline may endanger lives or create unhappy
customers

1.1.2 Characteristics of Embedding Computing System


4. Multirate :

Many operations may run simultaneously in embedded system


Some in slow rate and some may be in high rate
Audio and video of multimedia runs at different rates but need to be
synchronized

5. Manufacturing cost:

It is determined by:

Type of microprocessor used


Amount of memory required
Types of I/O devices

6. Power and energy

Power consumption affects cost of hardware


Energy consumption affects battery life

1.1.3 Why use microprocessor??


Reasons:
Microprocessors are very efficient way to implement digital systems
Design products with various features different price points
upgrading the product
Two factors that help to make microprocessor based design faster:
Microprocessor execute programs very efficiently

Modern RISC Processor 1 instruction per clock cycle


High performance processor several instruction per clock cycle

A lot of money is spend by the manufacturers to make CPU very fast

Many designers for single chip


Uses latest manufacturing technology

1.1.3 Why use microprocessor??


Program design and hardware design is separated:
The designers will be separated
One team will be designing the board containing microprocessor, I/O
devices, memory etc
Other team can write programs
We can create products by adding code without changing hardware

Thus reducing Manufacturing costs


Saving time

1.1.4 Physics of software


Computing is a physical act.
Software doesnt do anything without hardware.
Executing software consumes energy, requires time
Two factors:
Software Performance
Energy Consumption

What does performance mean?


In real-time systems, performance means meeting deadlines.
Missing the deadline by even a little is bad.
Finishing ahead of the deadline may not help.

1.1.5 Challenges in Embedded Computing System Design


1. How much hardware do we need?

Selecting the type of microprocessor, amount of memory, peripheral


devices etc
1. Performance deadlines
2. manufacturing cost constraints

Choice of hardware is important

2. How do we meet deadlines?

Brute Force way of meeting deadline Speed up the hardware so

that programs runs faster


This makes the system more expensive
Increasing the CPU clock rate may not be always effective,
because the programs speed may be limited by memory system

1.1.5 Challenges in Embedded Computing System Design


3) How do we minimize power consumption?

Battery powered application


Non battery applications More Power consumption leads to heat
dissipation
Make the system run more slowly Missed deadlines

4) How do we design for upgradability?

Hardware platform several product generations & different versions of


same product with few or no changes
But we should be able to add features by changing software

5) Does it really work?

Reliability is important especially in safety critical system

1.1.5 Challenges in Embedded Computing System Design


Ways in which embedded computing machines makes their design
more difficult :
1.Complex testing:

Exercising an embedded system is more difficult

We have to run a real machine for generating proper data


We cannot separate the testing of embedded computer from the machine
in which it is embedded

2.Limited Observability and Controllability:

Such systems usually dont come with keyboards and screens


It is difficult to see what is going on and to affect systems operations
Values of electrical systems on the microprocessor bus
We cannot stop the system to see what is going on inside

1.1.5 Challenges in Embedded Computing System Design


Ways in which embedded computing machines makes their design
more difficult :
3.Restricted development environments :

Developments environments are restricted


We compile the code on one system and download it onto the embedded
system
For debugging the code we rely on PC and workstations

1.1.5 Performance in Embedded Computing System


How do you measure the performance of a program??

Main goal of embedded system designers is Deadline


Real time computing science and art of programming to deadlines
Deadline : Time at which the computations must be finished after
receiving the input
Analyze system at different levels of system:
CPU
Platform (Bus and I/O devices)
Program (Structure of entire program)
Task (Multitasking system)
Multiprocessor (Interaction between processors)

1.2 Embedded System Design Process


Two Objectives:
1. Steps in embedded system design
2. Design methodology
i.
ii.

Keeping a scorecard on the design


Develop computer aided design (CAD) tools

help automate methodology steps;


keep track of the methodology itself

iii. Communication between the members of the design team

Major goals of design


Manufacturing cost
Performance (Speed and deadlines)
Power consumption
At each step in the design
Analyze the design
Refine the design
verify the design

1.2.1 Requirements
Two phases:
1. Gather informal description from customers(Requirements)
2. Refine requirements into specification

Separation between requirement analysis and specification

Consumers may have unrealistic expectations as to what can be done within


their budgets

Requirements may be functional or nonfunctional


Nonfunctional requirements include:
Performance
Cost
Manufacturing cost
Nonrecurring engineering(NRE) costs

Physical size and weight


Power consumption

1.2.1 Requirements
Mock-up: simulating functionality in restricted environment and it
may be executed on a PC or workstation
Physical, nonfunctional models of devices
Big systems complex and time consuming

1.2.1 Requirements
Name:
Simple but helpful
Crystallize the purpose of the machine

Purpose:
One or two line description about what system should do

Inputs and outputs:


Types of data:
1. Analog electronics circuits?
2. Digital data?
3. Mechanical inputs?
Data characteristics:
1. Periodically arriving data?
2. Occasional user inputs?
3. Bits per data element?

1.2.1 Requirements
Types of I/O devices:
1. Buttons?
2. Analog/digital converters?
3. Video displays?

Functions:
What the system does?
When system receives input? What does it do? etc

Performance:
Time spend on controlling physical devices or processing data coming from the physical
world

Manufacturing Cost:
Cost of hardware component
Idea of eventual cost range
Cost has a substantial influence on architecture

1.2.1 Requirements
Power:
Rough idea of how much power the system can consume
Battery powered or plugged into the wall?

Physical size and weight:


An indication of the physical size of the system

Example : GPS moving map system


Handheld device that displays a map of users current position
Moving map obtains its position form the GPS

Requirements for GPS moving system


Functionality:

Used for highway driving and not nautical or aviation uses


System should show major roads and other landmarks

User interface:
Screen should have atleast 400*600 pixel resolution
Not more than three buttons
Menu system should pop up when buttons are pressed

Performance:
Map should scroll smoothly
Display should appear in less than a second
Display current map within 15 secs

Cost:
Should not be more than $100

Physical size and weight:


Should fit comfortably in palm of the hand

Power consumption:
At least 8 hours on four AA batteries

1.2.2 Specifications

What the system does?


Contract between customer and architects
Should be understandable
Specification of GPS would include several components:

Data received from GPS satellite constellation


Map data
User interface
Operations that must be performed to satisfy customer requests
Background actions to keep the system running

1.2.3 Architecture Design

How the system functions?


Plan of overall structure of the system
Block diagram is quite abstract
Satisfy both functional and nonfunctional requirements

1.2.4 Designing hardware and software components

Hardware (FPGA and boards) and software modules


Some components will be ready made
CPU is a standard component and some memory chips also
Specialized component GPS receiver
Topographic databases access database data decompression
phase
You will have to design components yourself

1.2.5 System Integration


Putting all the components together
Bugs are typically found during system integration
Fix simple bugs early and then uncover more complex bugs

1.3 Formalisms for System Design


Unified Modeling Language(UML)
Visual language which is used to capture all the design tasks
UML is an object oriented modeling language

Design will consists of a number of interacting objects rather than


blocks of code
Some objects will correspond to real pieces of software and hardware
Object Oriented (OO) specification can be seen two ways :
System is designed in a way that closely models real world objects and their
interactions
Provides a basic set of primitives that can be used to describe systems with
particular attributes

1.3.1 Structural Description

Basic components of the system


Principal components of object oriented design object
Attributes defines internal state (variables or constants)
Example: CRT Screen(display)
note, object name, class name, attributes, operations

1.3.1 Structural Description


pixels attribute
Each object has its own memory, hence so attributes can have different
values for different objects

1.3.1 Structural Description


Types of relationships between object and classes:

Association : between objects, no ownership relation


Aggregation : complex object made of smaller objects
Composition : no access to component objects
Generalization : defines one class in terms of another

1.3.1 Structural Description

BW Display and Color-map-display


Base class and derived class
Inheritance
One form of generalization

1.3.1 Structural Description


Multiple Inheritance
Multimedia display
Display class + Speaker
class for sound

1.3.1 Structural Description


Link relationship between objects
Objects often do not stand alone
Link defines contains relation

Link: describes
relationships between
objects.
Association: describes
relationship between
classes.

1.3.1 Structural Description

Association to Link as class to object


Association between message set class and message class
Name of association contains
Message set can have zero or more messages

1.3.2 Behavioral Description

State machine : to specify behavior of an operation


Events : type of action that changes from one state to another
An event may come from inside or outside the system (examples)
There are three types of events: Signal event, Call event, Time-out
event

1.3.2 Behavioral Description


Signal event :
Asynchronous occurrence
Labeled as <<signal>>

Call event :
Procedure call in programming language

A time-out event :
Causes machine to leave a state after certain amount of time
tm(time value) amount of time after which transition occurs

State transition of a display

1.3.2 Behavioral Description

Mouse click scenario


State machine for an operation to display
Start and Stop states
States represent different conceptual operations

An example for sequence diagram

1.3.2 Behavioral Description

Sequence diagram sequence of operations over time


What happens when the mouse click is on the menu region
Time is flowing vertically
Three objects Mouse, Display, Menu
Extending below each object is its lifeline(dashed line)
Rectangular Boxes Focus of control
Mouse objects is active to create mouse-click event
Display remains active for longer
Display invokes Menu object twice
1. To determine which menu was selected
2. Execute menu call

1.4 Model Train Controller

1.4 Model Train Controller

1.4 Model Train Controller


User send messages to train with the control box attached to tracks
Train receives its electrical power from the two rails of the track, so
the control box can send signals over the tracks
Control panel sends packets over the tracks to the receiver on the train
Train includes:
Analog circuits(to sense bits transmitted)
Control system( setting speed and direction of train)

Each packet includes:


Address
Error Correction Code(ECC)

This is one way communication system

1.4.1 Requirements
The console shall be able to control up to eight trains on a single track.
The speed of each train shall be controllable by a throttle to at least 63
different levels in each direction (forward and reverse).
There shall be an inertia control that shall allow the user to adjust the
responsiveness of the train to commanded changes in speed.
There shall be an emergency stop button.
An error detection scheme will be used to transmit messages.

1.4.1 Requirements

1.4.2 DCC(Digital Command Control )


Created by National Model Railroad Association
Defines way in which model train controllers communicate, interoperability
Two documents:

Standard S-9.1, DCC Electrical Standard.


Defines how bits are encoded on the rails.

Standard S-9.2, DCC Communication Standard.


Defines packet format that carry information
It doesnt define :
1. the control panel,
2. the type of microprocessor used,
3. the programming language to be used
4. many other aspects of a real model train system.

1.4.2 DCC(Digital Command Control )

DCC Electrical Standard:


Deals with voltages and currents on the track
Bits are encoded in the time between transitions, not by voltage levels
0 100 us
1 58 us

1.4.2 DCC(Digital Command Control )


DCC Communication Standard:

Regular expression of Basic packet format:

PSA(sD)+E
P: preamble = 1111111111 (10 1 bits)
S: packet start bit = 0
A: address data byte (8 bits long)
00000000, 11111110, 11111111 are reserved

s: data byte start bit=0


D: data byte (8 bits)
Address, instruction, data, ECC

E: packet end bit = 1.

1.4.2 Conceptual Specification


It will help us to understand the system better
Train control system turns commands into packets that is transmitted over
rails
They are not generated in 1-to-1 ratio
Two subsystems:
Command unit
Train-board component

UML Collaboration diagram:

1.4.2 Conceptual Specification


Console performs three functions:
1. Read the state of front panel
2. Format messages
3. Transmit messages

Receiver performs three functions:


1. Receive message
2. Interpret message
3. Control motor

Panel = knobs + hardware


Formatters = read panel knobs and create a bit stream of required message
Transmitter = sends analog message along the track
Sender = describes analog electronics that send bits along the track

1.4.2 Conceptual Specification

Detector = detecting analog signals on the track and convert into digital
Receiver = analog Digital
Controller = interprets commands
Motor Interface = generate analog signals
Pulser = turns digital to analog to control motor speed
Train Set(multiple trains)

1.4.2 Detailed Specification


Hardware interfaces: Defining the analog components
Panel has three knobs(train number, speed, inertia) and one button
(emergency stop)
Modifying knob settings (set-knobs)
Motor system(Sender and Detector)

1.4.2 Detailed Specification


Software interfaces:
Panel, motor-interface
No internal variables

1.4.2 Conceptual Specification


Transmitter and Receiver
read_cmd() : to read message of the track
current : for holding the current command
new : to check whether the
command is processed
or not

1.4.2 Conceptual Specification


Formatter:
Holds current control settings for all trains
send_command : interface to the transmitter and issue_command()
operate() : basic actions for object and panel_active()

Formatter(send_command):

Formatter(panel_active() ):

Controller(issue_command ):

Vous aimerez peut-être aussi