Sei sulla pagina 1di 63

EEE520

EMBEDDED SYSTEM DESIGN


LECTURE 1
Contents:
Introduction
SystemDesign
Example 1: System Specification
Product definition
Hardware specification
Product Definition
Controller Selection
Hardware/Software Requirement
Hardware/Software Partitioning
Distributed Processor System
CHAPTER 1
INTRODUCTION
The first step in achieving anything is to
establish a goal.
The process of designing an embedded
system begins with a goal the definition of
the product.
Product definition is the first element in a
process that is key to any successful
electronic system design: documentation.
The documentation describes what you are
going to build and how you are going to build
it.
System Design
Thedevelopments documents that are useful
in designing embedded system as below:
Product requirements:
Describe what the product is
Functional requirements:
Describe what the product must do
Engineering specifications
Describe how the design will be implemented and how
requirement will be met
describe what boards, subsystem and firmware will be
used, what each one does and how they communicate.
Cont..
Hardware specifications
Describe how the specific hardware is designed
one hardware specification for each board or
subsystem. Describe how the board is implemented and
how it works.

Firmware specifications
Describe how the firmware for specific processors will be
designed
Test specification
Describe what must be tested and how to verify that the
system operates correctly
System Design
The
embedded design process
generally follow these steps:
Product requirement definition
Functional requirement definition
Processor selection
Hardware/software specification
System evaluation
Hardware design
Firmware design
Integration
Verification (test)
Product requirement and functional requirement
can be merged into product specification:

describe product and describe how product will be


designed
Product definition
The
requirement definition (part of the
product specification) must describe:
What the system is to do
What the real world I/O consists of
What are the operator interface is
Who will decide the product definition?
In a very large company the marketing
department or a major customer may
define the requirements.
In a smaller company the hardware and
software engineers may sketch out the
requirement definition.
For a small one-engineer project, the
requirements may be the result of
momentary inspiration
Example 1: System Specification for a
Swimming Pool Timer
A: Product definition for a swimming pool
pump timer
System description: the system is a swimming
pool timer that cycles the alternating current
(AC ) pump motor on a swimming pool.
Power input: 9 to 12 VDC from a wall mount
transformer.
Pump is a hp, single phase, AC motor
controlled by mechanical relay. Relay is
remote from control unit, located in
weatherproof box near pool pump motor.
The user can set the length of time the
pump is on and off. An override is
available to permit turning off the pump
when it is on for maintenance and turning
the pump on when it is off so that
chemical can be added.
On/off/override time is to be adjustable in
30 minute increments from one-half hour
to 23 hours. A display will indicate the on/
off condition of the pump, the time
remaining and whether the pump is in the
override mode. The display also will
indicate the condition of the water low
User interface:
Display:
four seven segment digits: 2 digit for hours, 2 for
minutes.
3 LEDs: SET, ON, OVERRIDE
Keypad:
There are 3 keys: SET, ON, OFF
Operation:
The display will indicate the time remaining before
pump switches on or off.
After reset, ON time will be set to 8 hoursm 30
minutes. Off time will be set to 8 hours 0 minute.
B: System Hardware Specification:
Display:
4 seven segment
ON LED
SET LED
OVERRIDE LED
Keys:
SET: enable time set
ON: On override, on time set
OFF: Off override, off time set
Other inputs:
Water low switch closure
Power: 9 to 12V DC input, using coaxial connector-
onboard 5V regulator, polarity protected
Outputs
Relay on/off
Other outputs
Watchdog timer required
Circuit description:
CPU: 8031, 6MHz input clock
EPROM: 8K x8, external 2764, no internal
ROM
8031 Port usage:..
Controller Selection:.
Afterthe requirements are defined the
next step is to determine whether a
microprocessor is the best choice.
Determine whether microprocessor is the
best choice:
Speed
Single IC or PLD will do the job?
The system has a lot of user I/O?
The design need to be changed?
Controller selection
The following item must be considered:
Number of I/O pin required
Interfaces required
Memory requirement
Number of interrupt required
Real time consideration
Development environment
Processing speed
ROMabilityMemory architecture
Power requirement
Environmental requirement
Life cycle cost
Operator training competence
Real requirements
Number of I/O
Example:
Intel(8031/8051 family) 32pins
Microchip 33pins
Atmel 32

Take
into account the use of internal
functions such as serial ports and timers
that restrict the use of certain pins
Pin diagram of 8051 and 8255
Interfaces required
The processor need to interface to real
world hardware.
For example: microchip pic17c42 has two
pulse width modulation outputs that
simplify design such as motor servos
Serial port, the maximum baud rate, refer
to data sheet.
Memory requirement
Essentialpart of embedded system design
Overestimate-costly
Underestimate-the system must be
redesigned.
RAM
example 8052 has 256bytes general purpose
RAM
Need more RAMs, use external RAM, this
requires I/O pins for addressing.
Cont..
ROM
Required for program code and lookup tables
More than 80% is too full, maybe the are some
changes.
Like RAM usage, code size depends on
language selected. Assembly language takes
less space than C language.
Cont..
Number of interrupts:
Interrupt it interrupts program execution
Best used for those things that cannot wait for
the processor to get to them.
Can be used to reduced the hardware
complexity
Cont..
Real time considerations
Related to processing speed
Are what microprocessor generally are
intended to handle.
Example: many processors have PWM output
or timers that can be configured as PWM
outputs. The processor just sends changes in
the duty cycle to the PWM controller.
Cont..
Development environment
New development tools require learning curve

Processing speed
Add up the interrupt latencies
The length of the polling loop must be short
enough to never miss a byte of serial data or a
byte from any other interface.
In some cases, higher speeds gain nothing if wait
states must be inserted to meet the memory
access requirements.
Cont..
ROM ability
Applies to those devices that execute their
programs from internal rom
Mask rom, from manufacturer
High volume
In circuit programming
Sometimes need the capability to program the part in
circuit to perform field upgrade of the firmware
Must have a processor with the program stored in flash
memory
Sometimes need to compromise between cost and
performance
Cont..
Non volatile storage
Sometimes some application need non
volatile storage,
Example, building a television, we want to
remember what channel the set on last,
even power is removed.
Many controllers include a small amount
of EEPROM on chip
Cont..
Memory architecture
Von Neumann and Harvard
Von Neumann architecture permits data and code to be
intermixed. Can put data table in PROM with the code and you
can move the code to RAM and execute it there
Harvard has separate code and data areas. Code executes
from PROM, data comes from a separate RAM and cannot get
data from code space.
Most microprocessors use modified Harvard architecture, that
allows table or other information to be compiled into the code for
use at the runtime.
Advantage of Harvard architecture- there are two separate
memory areas, so code and data can be fetched simultaneously,
increase the throughput of the processor.
In modified Harvard architecture, must be sure that the lookup
table not overlap the code.
Harvard and Von Neumann
Architecture
Cont..
Power requirements:
two issues
To operate from a wall mounted power supply
Battery power supply-need to know the total
operational current.
Environmental requirements
Typically temperature
Extended temperature device (military or
automotive purpose), more expensive.
Cont..
Life cycle cost
Has rooms for upgrading the system
Operator training
Effect the user interface
Example LCD and touch screen require more
memory to store the screen and message
Real requirements
Must look past the request for a specific
feature to get at the real requirement.
Hardware and Software
Requirement
If the product specification is the goal for the
product, the hardware and software
requirements are the goal for the detailed
design.
Hardware and software requirement start with
definition of user interface and system
functionality.
The most productive method of defining the
hardware is to start with the requirement-what
the hardware must have. This is tied to the
system specification because the hardware must
support whatever functionality the system has.
For the example of pool timer there are two
choices for output display/L LED or LCD. LED
is chosen because the timer will be exposed to
the weather all year and the LCD had problem
with cold temperature.
Engineering specification is a list of the
requirement for each microprocessor-based
board.
Hardware specification includes the specific
information that another engineer needs to
understand the design and the software
engineer need to program around the
hardware.
Thehardware specification includes the
following:
Memory and I/O port addresses
Amount of memory available
The definition of each bit in each status
register
The use of each bit on each port pin
An explaination of how peripheral devices are
driven (such as the clock frequency input to a
timer)
Anything else the software engineer needs to
know about the design.
Software specification includes:
A statement of the requirement including the
re q u i re m e n t s d e f i n i t i o n , e n g i n e e r i n g
specifications and hardware definition as
appropriate.
The communication protocol to any other
software whether to another processor or to
another piece of the software for this
processor. this should include description of
buffer interface mechanism, command/
response protocols or anything to which the
complementing code needs to talk.
A description of how the design was
implemented, using flowcharts, pseudocode or
other methods.
Distributed processor system
A distributed processor system might
have a single CPU that communicates
with a host computer and distributes
commands and data to lower level
processor that control motors, sensors
or other simple task.
Advantages:
The actual processing hardware can be
located near the hardware
Cont..
The cost of the processors that control the
option can be added or removed.
The distributed CPU can be lower.
performance or cheaper.
Code for CPU is simpler.
Debugging is simpler.
Techniques of Distributed
Processing
Centralized
Decentralized
Parallel
Open Distributed Processing
Clustering
Centralized processing
Centralized processing is done at a
central location using terminals that are
attached to a central computer.
The central computer performs the
computing function and control the
remote terminals. This type of system
relies totally on the central computer.
Database Management System
Decentralized
Computer system in different location.
Although data may be transmitted
between the computers periodically.
Example: Yahoo server. On each login it
connects you to a different server.
Parallel Processing
Parallel processing is the simultaneous
processing of the same task on two or
more microprocessors in order to obtain
faster result.
Multiple processor
Multiple computer
Share memory resources
Open Distributed Processing
ODP is a reference model in computer
science, which provides a coordinating
framework for the standardization for
open distributed processing (ODP).
It supports distribution, interworking,
platform and technology independence,
and portability, together with an
enterprise architecture framework for the
specification of ODP systems.
Clustering
A cluster is a group of individual
computer systems that can be made to
appear as one computer system.
Clustering is just one form of parallel
computing.
Key point that distinguishes clustering
from other is the ability to view the
cluster either a single entity or a
collection of standalone systems.
Example: a cluster of web server.
Cont..
Advantages of single CPU:
Synchronization is easier.
Communication is easier (with a host or other
system).
Fewer oscillator, so less EMI.
Easier to update or downlod the code.
Fewer development tools are needed.
Example: Application of IEEE 1451-Based
Sensor Network

STIM: Smart Transducer Interface Module


NCAP: Network Capable Application Processor
A distributed measurement and control system
can be easily implemented based on the IEEE
1451 standards.
Three NCAP/STIMs are used to illustrate the
distributed control, remote sensing or
monitoring and remote actuating.
In the first scenario, a sensor and an actuator
are connected to the STIM of NCAP#1, and an
application software runnning in the NCAP can
perform a locally distributed control function,
such as maintaining a constant temperature in a
room.
The NCAP reports measurement data,
process information and control status to
a remote monitoring station or host.
In the second scenario, only sensors are
connected to NCAP#2 which can
perform remote process or condition
monitoring function, such as monitoring
the vibration level of a set of bearing in a
turbine.
In the third scenario, based on the
broadcast data received from NCAP#2,
NCAP#3 activates an alarm when the
vibration level of the bearing exceeds a
critical set point.
In this example, IEEE 1451 based sensor
network can easily facilitates peer to peer
communication and distributed control
function.
IEEE 1451 enables plug and play of transducers to a network
Integration of an IEEE 1451 NCAP/TIM module with an IEEE
1451.7 transducer in a network
Multi Core processor
What is multi core?
Two or more independent execution cores in the same
processors.
Specific implementation will vary over time-driven by
product implementation and manufacturing efficiencies.
Delivering tremendous growth in compute capability
Building upon success of HT technology
Better multitasking responsiveness
Improved multithreading performance
Example: Presler processor (Intels first 65nm desktop
dual core processor )
Hyper Threading Technology
In the past, computing performance was improved
by enabling threading in the software by splitting
instruction into multiple streams.
HT enables thread level parallism on processor to
increase efficiency on processor resources usage.
Resulted in higher processing throughput thus
improving performance on multithreaded software.
Hyper Threading advantages:
Improving support for multi threaded code, allowing
multiple threads to run simultaneously thus improved
reaction and response time.
Dual core: powerful evolution of HT that provided 2
full execution cores in a single processor.
Background of threading
A thread is a discrete sequence of related
instructions that is executed independently of
other instruction sequences.
Every program has at least one thread (the main
thread) that initilizes the program and begins
executing the initial instructions.
Each thread maintains its current machine state.
Multi core processors can truly execute different
threads in parallel.
Cont..
How
do we make application multi-
threaded?
Through decomposition
Breaks programs into individual tasks
A problem may be decomposed in several
ways: by task, by data or by data flow.
Cont..
How many threads are enough?
Through careful analysis of the constituent
activities
Performance is not increased by dividing the
application into unlimited number of tasks.
Which decomposition is choosen? Depending
on application.
Cont..
What
are the problems if the application
becomes multi threaded?
Synchronization is the process by which two or
more threads coordinate their activities. For
example one thread waits for another to finish
a task before continuing.
Communication refers to the bandwidth and
latency issues associated with exchanging
data between threads.
Load balancing refers to the distribution of
work across multiple threads so that they all
perform roughly the same amount of work.
Cont..
Synchronization
An enforcing mechanism used to impose
constraints on the order of execution of
threads.
Example of synchronization- condition
synchronization.
Deadlock
Occurs whenever a thread is blocked waiting
on a resource of another thread that will never
become available.
Hardware Software Partitioning
The most important challenge in the
embedded system design is partitioning:
deciding which components of the system
should be implemented in hardware and
software.
Traditionally partitioning was carried out
manually.
However because of complexity of the
systems, the partitioning parts are done
automatically.
Exercise
(a) By using multichip design concept, propose a design of vending machine to sell
Magazines. The cost of the magazine is RM15.00. The machine only can receive RM5 and RM10.
You can monitor the sells remotely. In the proposal you should explain:
Product definition
Engineering specification
Hardware Specification
List down all components in the design
Please specify the address of the related component in the design
Firmware specification. Use state diagram to explain about the firmware design.
(80 marks)

(b) You are given a choice to select which microprocessor for the design in 1(a). Which
processor will you choose? Give your reason.

Processor A: 16 bit microprocessor, run at 12 MHz, the instructions work in 12 clock cycles per
instruction

Processor B: 8 bit microprocessor, run at 5MHz, the instruction in one clock cycle per
instruction.
(20 marks)

Potrebbero piacerti anche