Class1
Upcoming SlideShare
Loading in...5
×
 

Class1

on

  • 717 views

 

Statistics

Views

Total Views
717
Views on SlideShare
717
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Class1 Class1 Presentation Transcript

  • 525.415 : Embedded Microprocessor Systems Douglas Wenstrand Joseph Haber
  • Semester 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
  • Grading
    • 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.
  • Schedule…
    • 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
  • Other 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
  • Administrative Stuff
    • Class Webpage : apl.jhu.edu/~wenstds1
      • Notes and Assignments and other data
    • Textbook:
      • http://www.rabbitsemiconductor.com/products/EmbedSysR3K/index.shtml
    • Join the class Yahoo “group”
      • [email_address]
      • We use this as a mailing list for sending information and answering questions.
      • Ask questions to the group and answer each other.
  • Introduction Embedded Micro Concepts and Examples
  • Dictionary 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).
  • 4,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
  • Interesting Facts
    • Estimated that approximately 2% of all silicon sales are from processors…but 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?articleID=9900861
  • Processor Breakdown by sales Source : Embedded Systems Programming Magazine
  • Microprocessor Invasion Denon Home Theater In a Box Analog Devices SHARC DSP Maytag “Fuzzy Logic” Washer 8051 Variant Kodak Digital Camera DSP/uP Combo Chip I-River MP3 Player / FM Tuner CONTOUR Spacecraft Instrumentation RTX2010RH Rad-Hard Processor (and others)
  • Microprocessor 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)
  • uP’s in automobiles
    • Cruise Control
    • Intermittent Wipers
    • Control / Memory for power seats/mirrors
    • On Board Diagnostics and Readout
    • Navigation System
    • Engine Control (ECU)
    • (etc)
  • Embedded 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
  • Design 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)
  • Design 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 system’s implementation
      • Optimizing design metrics is a key challenge
  • Design 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
  • Design 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
  • Design 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 Size Performance Power NRE cost Microcontroller CCD preprocessor Pixel coprocessor A2D D2A JPEG codec DMA controller Memory controller ISA bus interface UART LCD ctrl Display ctrl Multiplier/Accum Digital camera chip lens CCD
  • Time-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
    Revenues ($) Time (months)
  • Losses 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
    On-time Delayed entry entry Peak revenue Peak revenue from delayed entry Market rise Market fall W 2W Time D On-time Delayed Revenues ($)
  • Losses due to delayed market entry (cont.)
    • Area = 1/2 * base * height
      • On-time = 1/2 * 2W * W
      • Delayed = 1/2 * (W-D+W)*(W-D)
    • Percentage revenue loss = (D(3W-D)/2W 2 )*100%
    • Try some examples
      • Lifetime 2W=52 wks, delay D=4 wks
      • (4*(3*26 –4)/2*26^2) = 22%
      • Lifetime 2W=52 wks, delay D=10 wks
      • (10*(3*26 –10)/2*26^2) = 50%
      • Delays are costly!
    On-time Delayed entry entry Peak revenue Peak revenue from delayed entry Market rise Market fall W 2W Time D On-time Delayed Revenues ($)
  • NRE 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
      • NRE=$2000, unit=$100
      • For 10 units
        • total cost = $2000 + 10*$100 = $3000
        • per-product cost = $2000/10 + $100 = $300
    Amortizing NRE cost over the units results in an additional $200 per unit
  • NRE and unit cost metrics
    • Compare technologies by costs -- best depends on quantity
      • Technology A: NRE=$2,000, unit=$100
      • Technology B: NRE=$30,000, unit=$30
      • Technology C: NRE=$100,000, unit=$2
    • But, must also consider time-to-market
  • The 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., Camera’s 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 = B’s performance / A’s performance
      • Throughput speedup = 8/4 = 2
  • Metric Summary Special Purpose HW General Purpose HW NRE/Dev Cost Speed Flexibility Time to Market Production Cost Our class focuses on this approach
  • Old Style Embedded SW Design Flow
    • Develop Code which is to be run on Target processor
    • Since target is minimal (doesn’t have much memory, I/O…etc. 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.
  • Emulation / Debugging
      • 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
    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). 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
  • Differences 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)
    • 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.
    Microprocessor versus Microcontroller? Hyder and Perrin (the author’s of our book) claim that the difference is the existence of internal memory, thus making the Rabbit a microprocessor
  • Rabbit3000 Processor
    • 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
  • RabbitCore 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”
  • General 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 $$$)
  • Microprocessor 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 <= data; else outport <= ‘Z’; end if;
  • Handling 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);
  • GPIO (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 Rabbit’s I/O registers. A listing of these register macros can be found in the Rabbit 2000 Microprocessor User’s Manual and the Rabbit 3000 MIcroprocessor User’s 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.
  • Rabbit General Purpose I/O
  • Drive Control Register: Open Drain 5V Rabbit doesn’t have this inverter. Input Gate Output 1 0 “H” (5V) 0 1 0V
  • Dynamic 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
  • Dynamic 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 B asic I nput/ O utput S ystem