Title: 525.415 : Embedded Microprocessor Systems
1525.415 Embedded Microprocessor Systems
- Douglas Wenstrand
- Joseph Haber
2Semester Goals
- System Design
- Understand the concept of embedded systems
- Be familiar with microprocessor architectural
features and peripherals and what types of
applications they can enable - Select appropriate microprocessors and design
microprocessor-based hardware systems to handle a
particular function - Software Design
- Be able to program (C, Assembly) and debug said
system.
In short Be able to provide end-to-end design
solutions for a task which is appropriate for a
microprocessor system
3Grading
- Lab Projects 50
- Several assignments will be handed out throughout
the semester (with defined due-dates). These
assignments will involve implementation of a
particular task on the evaluation kit and
prototyping area. They may also include some
written problems. - Mid-Term 20
- Mid-term will focus on processor specific
assembly language and architecture. - Final Project 20
- Final project will be a project that combines
what we have learned into one larger project. - Quizzes 10
- We will assign quizzes based on the weeks
reading. These will be very straight forward.
4Schedule
- Week 1 Introduction to Embedded Programming
Introduction to the Rabbit Microcontroller - Week 2 Introduction to Dynamic C Rabbit
Assembly - Week 3 Timers
- Week 4 Serial I/O Exam
- Week 5 Networking Communication (TCP/IP)
- Week 6 Interfacing to External Sensors A/D
D/A - Week 7 Preemptive and Cooperative Multitasking
- Week 8 Interfacing to External Memory Power
EMI Issues
5Other Topics
- Memory Interfacing, different types of Memory
- Hardware design of a microprocessor-based
emebedded system - A/D and D/A conversion
- Power Management
- Common Embedded Communication Protocols
- Serial ports
- IrDA
- Ethernet
- Networked embedded systems
6Administrative Stuff
- Class Webpage apl.jhu.edu/wenstds1
- Notes and Assignments and other data
- Textbook
- http//www.rabbitsemiconductor.com/products/EmbedS
ysR3K/index.shtml - Join the class Yahoo group
- upclass_at_yahoogroups.com
- We use this as a mailing list for sending
information and answering questions. - Ask questions to the group and answer each other.
7Introduction
- Embedded Micro Concepts and Examples
8Dictionary Definitions
microprocessor - (Or "micro") A computer whose
entire CPU is contained on one (or a small number
of) integrated circuits.The important
characteristics of a microprocessor are the
widths of its internal and external address bus
and data bus (and instruction), its clock rate
and its instruction set. Processors are also
often classified as either RISC or CISC.
microprocessor - (Or "micro") Any CPU that is
contained on a single chip.
This little chip is the heart of a computer.
Often referred to as just the "processor," the
microprocessor does all the computations like
adding, subtracting, multiplying, and dividing.
In PCs, the most popular microprocessor used is
the Intel Pentium chip, whereas Macintosh
computers use the PowerPC chip (developed by
Motorola, IBM, and Apple).
94,8,16,32, DSP, RISC, CISC???
- A processor is frequently categorized based on
the width of its busses. - Clock Rate (i.e. at what rate does the processor
execute instructions) - Complexity of Instruction Set
- CISC Complex Instruction Set Computer
- RISC Reduced Instruction Set Computer
10Interesting Facts
- Estimated that approximately 2 of all silicon
sales are from processorsbut 30 of the profits - Estimated that under 2 of 32-bit processors sold
end up in traditional computers - How many of processors sold today are 32-bit (or
64 for that matter)?
http//www.embedded.com/showArticle.jhtml?articleI
D9900861
11Processor Breakdown by sales
Source Embedded Systems Programming Magazine
12Microprocessor Invasion
Denon Home Theater In a Box Analog Devices SHARC
DSP
Maytag Fuzzy Logic Washer 8051 Variant
Kodak Digital Camera DSP/uP Combo Chip
CONTOUR Spacecraft Instrumentation RTX2010RH
Rad-Hard Processor (and others)
I-River MP3 Player / FM Tuner
13Microprocessor Systems in Automobiles
The first car to use a microprocessor was the
1978 Cadillac Seville. The chip, a modified
6802, drove the car's "Trip Computer," a flashy
dashboard bauble that displayed mileage and
other trivia. (source ESP 8/03)
BMW 7-Series 100 microprocessors on board
Volvo S40 50-60
Toyota Echo 30-40
All Numbers Estimated ESP (8/03)
14uPs in automobiles
- Cruise Control
- Intermittent Wipers
- Control / Memory for power seats/mirrors
- On Board Diagnostics and Readout
- Navigation System
- Engine Control (ECU)
- (etc)
15Embedded Systems Characteristics
- Real-Time
- Real, defined timing requirements for particular
actions to be accomplished - Event Driven
- Actions of the system are in response to events,
not a predefined sequence. - Resource constrained
- Memory Size, speed, power constrained
- Special purpose
- Device must only perform certain well defined
tasks
16Design Approaches for Digital Systems
- Special Purpose Hardware
- Custom IC
- ASIC
- General Purpose Processor
- Pentium
- PowerPC
- Thousands of Others
- FPGA (possibly with embedded general purpose
microprocessor)
17Design challenge optimizing design metrics
- Obvious design goal
- Construct an implementation with desired
functionality - Key design challenge
- Simultaneously optimize numerous design metrics
- Design metric
- A measurable feature of a systems
implementation - Optimizing design metrics is a key challenge
18Design challenge optimizing design metrics
- Common metrics
- Unit cost the monetary cost of manufacturing
each copy of the system, excluding NRE cost - NRE cost (Non-Recurring Engineering cost) The
one-time monetary cost of designing the system - Size the physical space required by the system
- Performance the execution time or throughput of
the system - Power the amount of power consumed by the system
- Flexibility the ability to change the
functionality of the system without incurring
heavy NRE cost
19Design challenge optimizing design metrics
- Common metrics (continued)
- Time-to-prototype the time needed to build a
working version of the system - Time-to-market the time required to develop a
system to the point that it can be released and
sold to customers - Maintainability the ability to modify the system
after its initial release - Correctness, safety, many more
20Design metric competition -- improving one may
worsen others
- Expertise with both software and hardware is
needed to optimize design metrics - Not just a hardware or software expert, as is
common - A designer must be comfortable with various
technologies in order to choose the best for a
given application and constraints
Hardware
Software
21Time-to-market a demanding design metric
- Time required to develop a product to the point
it can be sold to customers - Market window
- Period during which the product would have
highest sales - Average time-to-market constraint is about 8
months - Delays can be costly
22Losses due to delayed market entry
- Simplified revenue model
- Product life 2W, peak at W
- Time of market entry defines a triangle,
representing market penetration - Triangle area equals revenue
- Loss
- The difference between the on-time and delayed
triangle areas
23Losses due to delayed market entry (cont.)
- Area 1/2 base height
- On-time 1/2 2W W
- Delayed 1/2 (W-DW)(W-D)
- Percentage revenue loss (D(3W-D)/2W2)100
- Try some examples
- Lifetime 2W52 wks, delay D4 wks
- (4(326 4)/2262) 22
- Lifetime 2W52 wks, delay D10 wks
- (10(326 10)/2262) 50
- Delays are costly!
24NRE and unit cost metrics
- Costs
- Unit cost the monetary cost of manufacturing
each copy of the system, excluding NRE cost - NRE cost (Non-Recurring Engineering cost) The
one-time monetary cost of designing the system - total cost NRE cost unit cost of
units - per-product cost total cost / of units
- (NRE cost / of units) unit cost
- Example
- NRE2000, unit100
- For 10 units
- total cost 2000 10100 3000
- per-product cost 2000/10 100 300
25NRE and unit cost metrics
- Compare technologies by costs -- best depends on
quantity - Technology A NRE2,000, unit100
- Technology B NRE30,000, unit30
- Technology C NRE100,000, unit2
- But, must also consider time-to-market
26The performance design metric
- Widely-used measure of system, widely-abused
- Clock frequency, instructions per second not
good measures - Digital camera example a user cares about how
fast it processes images, not clock speed or
instructions per second - Latency (response time)
- Time between task start and end
- e.g., Cameras A and B process images in 0.25
seconds - Throughput
- Tasks per second, e.g. Camera A processes 4
images per second - Throughput can be more than latency seems to
imply due to concurrency, e.g. Camera B may
process 8 images per second (by capturing a new
image while previous image is being stored). - Speedup of B over S Bs performance / As
performance - Throughput speedup 8/4 2
27Metric Summary
Special Purpose HW General Purpose HW NRE/Dev
Cost Speed Flexibility Time to
Market Production Cost
Our class focuses on this approach
28Old Style Embedded SW Design Flow
- Develop Code which is to be run on Target
processor - Since target is minimal (doesnt have much
memory, I/Oetc. Code development takes place on
a separate machine. (a PC) - Cross Compiler / Assembler
- Simulator
- Code is then run in the target system and
observed. Debugging is done based on
performance, and any debug support programmed
into the software.
29Emulation / Debugging
One needs to be able to interactively see how
code behaves in the real system. After initial
code development is done, testing of the code
commences on the actual target system (and
usually target processor).
- In-Circuit Emulator
- Debugger Kernel / BIOS
- Background Debug Mode
- JTAG Emulation
- Debugger
- Interactively Run Code
- Breakpoints
- Single Step
- Watch Variables
- Observe how code interacts with rest of target
system
Development environment is frequently processor
specific, less uniform that what you might expect
with PC development tools, and more prone to bugs
and errors. Since the users are engineers, these
things are typically tolerated
30Differences between Embedded Traditional
Programming
- Micros designed for embedded market frequently
include peripherals on-board - Tailored towards a target market
- A/D Converters
- Timers / Counters
- Interrupt Controllers
- General Purpose I/O pins
- Pulse-Width Modulators
- Serial Ports (Buffered / Unbuffered)
- Bus / Protocol Interfaces (IrDA, Ethernet, USB,
PCI)
Microprocessor versus Microcontroller? Hyder and
Perrin (the authors of our book) claim that the
difference is the existence of internal memory,
thus making the Rabbit a microprocessor
- Device drivers are often time consuming
- peripherals (ex A/D, Timer, Serial Ports, etc)
generally require lots of register twiddling - Frequently there are App Notes from
manufacturer with simple setup code for those who
just want to do the basics.
31Rabbit3000Processor
- 8-bit data bus
- 20-bit address bus
- Static Core Design DC 54 MHz
- Glueless memory interface
- Clock spreader for EMI reduction
- High frequency clock and 32678Hz clk
- Built-in clock doubler
- 4 levels of interrupt priority
- Bootable over serial port
- 56 I/O signals (shared with periphs)
- Four PWM channels
- Six UARTs
- Auxillary I/O bus (minimize physical i.e.
capacitive loading to memory) - Two input-capture channels
- Two quadrature decoders
- Built-in watchdog timers
32RabbitCore 3000 Module
- Rabbit processors are sold as RabbitCore modules,
which incorporate the basic functionality (i.e.,
memory, flash, oscillator, Ethernet MAC) on a
single board - They will license the IP so that the core can
be dropped onto a new PCB as is
33General Purpose I/O Pins
Embedded uP
Any piece of HW here that needs or Produces
digital signals for the uP to see
Using GPIO pins to talk to devices with some sort
of serial protocol is often called Bit-Banging.
This is another use for general purpose I/O pins
to replace Hardware with software. (save )
34Microprocessor I/O port
Registers DDR (Data Direction Register) 1 if
port is an output, 0 if input Output Data
Register if output, value in register is
written to the port
if ddr 1 then outport lt data else
outport lt Z end if
35Handling GPIO (or Parallel Ports)
Assuming that hardware is designed so that
desired signals are hooked up to a known port
pin. Find that pin based on its port name and
bit. If the port is a general purpose I/O pin,
there will be at least 2 registers that you need
to deal with the DDR (Data Direction Register)
and the Data Register. Typically the DDR is
setup such that on RESET, the direction defaults
to input, so you must write to the bits which
are to be outputs. Next, write the value you
want in the bits that you want to the data
register for that port. In some processors that
may be PGDR 0x1 // set portg to all 0, and
bit 0 1 // assumes that PGDR is defined to be
the right address Dynamic C, Rabbit 3000
WrPortI(PGDR,PGDRShadow,0x1)
36GPIO (cont)
To read the value of a port you simply get the
contents of the Data Register (typically). Temp
PGDR //(in some processors) now Temp contains
the value of the port Dynamic C / R3000 temp
RdPortI(PGDR) A.4 Rabbit 2000/3000 Internal
registers Macros are defined for all of the
Rabbits I/O registers. A listing of these
register macros can be found in the Rabbit 2000
Microprocessor Users Manual and the Rabbit 3000
MIcroprocessor Users Manual. A.4.1 Shadow
Registers Shadow registers exist for many of the
I/O registers. They are character variables
defined in the BIOS. The naming convention for
shadow registers is to append the word Shadow to
the name of the register. For example, the global
control status register, GCSR, has a
corresponding shadow register named
GCSRShadow. The purpose of the shadow registers
is to allow the program to reference the last
value programmed to the actual register. This is
needed because a number of the registers are
write only.
37Rabbit General Purpose I/O
38Drive Control Register Open Drain
5V
Input Gate Output 1 0 H (5V) 0 1 0V
Rabbit doesnt have this inverter.
39Dynamic C Quick Intro Compilation
- Dynamic C is NOT ANSI C
- Dynamic C library files end with a .LIB
extension, and are source files that can be
opened with a text editor - Dynamic C builds code differently from the
traditional edit/compile/link/download cycle - Each time code is run, Dynamic C does a complete
build
edit
Compile Source Compile Libraries Link All
Together (no errors)
errors?
program
40Dynamic C Quick Intro BIOS
- When Dynamic C compiles a user's program to a
target board, the BIOS (Basic Input-Output
System) is compiled first, as an integral part of
the user's program. The BIOS is a separate
program file that contains the code needed to
interface with Dynamic C. Normally, it also
contains a software interface to the user's
particular hardware. Certain drivers in the
Dynamic C libraries require BIOS routines to
perform tasks that are hardware-dependent. - The BIOS also
- Takes care of microprocessor system
initialization, such as the setup of memory. - Provides the communications services required by
Dynamic C for downloading code and performing
debugging services such as setting breakpoints or
examining data variables. - Provides flash drivers.
- A single, general-purpose BIOS is supplied with
Dynamic C for the Rabbit 3000. This BIOS allows
Dynamic C to boot up on any Rabbit-based system
that follows the basic design rules needed to
support Dynamic C. The BIOS requires both a flash
memory and a 32 KB or larger RAM, or just a 128
KB RAM, for it to be possible to compile and run
Dynamic C programs. If the user uses a flash
memory from the list of flash memories that are
already supported by the BIOS, the task will be
simplified.
Note BIOS is an acronym for Basic Input/Output
System