DOC PREVIEW
U of U CS 5780 - Lecture Notes

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Page 1 1 CS 5780 School of Computing University of Utah Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis Today’s topics: • intro to interfacing (non-interrupt style) • also covered in Chap. 3 of the text 2 CS 5780 School of Computing University of Utah Interface Control • Critical SW role in ES design  ES’s distinguished by » large variety of I/O devices » each device is controlled by software • method is device specific • but there are general strategies (covered subsequently) • I/O interfaces  physical connections  software routines that affect information exchangePage 2 3 CS 5780 School of Computing University of Utah Interface Performance Measures • Latency  delay between service request and service completion » includes both software and hardware delays  for real-time systems » guarantee must be made for worst-case latency • Bandwidth (or throughput)  maximum rate at which data can be processed • Priority  determines service order when more than one request is pending 4 CS 5780 School of Computing University of Utah Synchronizing SW w/ I/O Devices • Problem: I/O devices operate in parallel w/ controller  pro: parallelism enhances performance  con: it’s hard for humans to get it right • Hardware common case  3 states: idle, busy, or done  when not idle » busy and done alternate • I/O or CPU bound (unbuffered vs. buffered interfaces)  I/O bound is typical » I/O devices often much slower than controller SW loop • synchronization is required • unbuffered interface works but SW has to do significant babysitting – we’ll start with this more typical case  CPU bound » still need synchronization for accurate information transfer » buffering required to store I/O transactionsPage 3 5 CS 5780 School of Computing University of Utah Polling (a.k.a. Gadfly) Loop Example Input device 6 CS 5780 School of Computing University of Utah Gadfly: Output DevicePage 4 7 CS 5780 School of Computing University of Utah Synchronization Mechanisms • Blind cycle  SW waits a fixed amount of time for the I/O to complete » then samples input or produces another output • Gadfly (busy waiting)  check I/O status flag once per iteration (previous example) » waits for flag to indicate I/O done state • Interrupt  I/O requests SW to become active • Periodic polling  timer based interrupt requests software activity » 6812 TCNT timer both more accurate and energy efficient than a cycle counting software timer • Direct Memory Access (DMA)  I/O device transfers data to/from controller memory » memory used as a mailbox to facilitate communication 8 CS 5780 School of Computing University of Utah Blind Cycle Printer Interface Note implicit timing assumptions: printer can always take a new byte every 10ms pulse width is long enough for printer to see it in all cases protocol: data is valid on rising edge of GO signalPage 5 9 CS 5780 School of Computing University of Utah Remember the Device Port data and direction registers 10 CS 5780 School of Computing University of Utah Initialize and Output to a Printer Blind Cycle Method What should be added to this code? DDR = data direction register ports T or M both outputs herePage 6 11 CS 5780 School of Computing University of Utah Blind Cycle ADC Interface Note different GO sense and implicit timing assumption 12 CS 5780 School of Computing University of Utah Initialize and Read ADCPage 7 13 CS 5780 School of Computing University of Utah Blind Cycle Evaluation • Advantages  simple and predictable • Problems  inflexible – periodic timing assumption  inefficient if the delay is long » problematic if other parallel threads compete • might interfere with periodicity assumption » if done wrong • faster CPU upgrade may break code – e.g. pulse width will be smaller • Works well for simple, high-speed devices  fact: most ES’s have a few blind cycle interfaces 14 CS 5780 School of Computing University of Utah Gadfly SynchronizationPage 8 15 CS 5780 School of Computing University of Utah Multiple Gadfly Outputs: Single Loop 16 CS 5780 School of Computing University of Utah Multiple Gadfly Inputs & OutputsPage 9 17 CS 5780 School of Computing University of Utah Gadfly Evaluation • Advantages  simple  more flexible than blind cycle • Potential “gotcha’s”  inefficient if devices are not fast » due to long wait times  potentially unpredictable » wait until the I/O device is ready •  if wait is not known then loop time can’t be known • if wait is known then use blind cycle model • Use with caution  however a common tactic in many ES’s » bizarre but it happens even in real time systems • in this case code is even more implicit • updates become truly scary 18 CS 5780 School of Computing University of Utah Gadfly Keyboard Interface Using Latched Input Implicit Timing Assumptions?Page 10 19 CS 5780 School of Computing University of Utah Initialize and Read from a Keyboard 20 CS 5780 School of Computing University of Utah Gadfly ADC Interface for a Simple InputPage 11 21 CS 5780 School of Computing University of Utah Initialize and Read from an ADC 22 CS 5780 School of Computing University of Utah Gadfly External Sensor Interface Using an overlapping variant of a 4 cycle input handshake implicit timing assumptions?Page 12 23 CS 5780 School of Computing University of Utah Initialize and Read from a Sensor 24 CS 5780 School of Computing University of Utah Gadfly Printer Interface Using Output Handshake Non-overlapping 4-cycle variant Notice anything weird here?Page 13 25 CS 5780 School of Computing University of Utah Initialize and Write to a Printer Is this code robust – if not why not? 26 CS 5780 School of Computing University of Utah Gadfly Synch to Digital Thermometer • Dallas Semiconductor DS1620  range -55 to 125 C with .5 C resolution  data encoded using 9 bit 2’s complement values »  basis weights • -128, 64, 32, 16, 8, 4, 2, 1, 0.5Page 14 27 CS 5780 School of Computing University of Utah More DS1650 • Can also be used as a thermostat  2 registers » TL – threshold low » TH – threshold high  temp >>


View Full Document

U of U CS 5780 - Lecture Notes

Documents in this Course
Lab 1

Lab 1

5 pages

FIFOs

FIFOs

10 pages

FIFOs

FIFOs

5 pages

FIFO’s

FIFO’s

12 pages

MCU Ports

MCU Ports

12 pages

Serial IO

Serial IO

26 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?