CSCI1600: Embedded and Real Time Software Lecture 9: Input Output Concepts Steven Reiss, Fall 2015.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
CS-334: Computer Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Lecture Objectives: 1)Explain the limitations of flash memory. 2)Define wear leveling. 3)Define the term IO Transaction 4)Define the terms synchronous.
68HC11 Polling and Interrupts
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
CHAPTER 5 I/O PRINCIPLE Understand the principles of System Bus
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Input/Output mechanisms
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
MICROPROCESSOR INPUT/OUTPUT
Interrupts and DMA CSCI The Role of the Operating System in Performing I/O Two main jobs of a computer are: –Processing –Performing I/O manage and.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
EEE440 Computer Architecture
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CSCI1600: Embedded and Real Time Software Lecture 2: Introduction Steven Reiss, Fall 2015.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
بسم الله الرحمن الرحيم MEMORY AND I/O.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
HOME AUTOMATION USING PC DONE BY RAJESHKUMAR S SRI HARSHA D.
Networked Embedded Systems Pengyu Zhang & Sachin Katti EE107 Spring 2016 Lecture 4 Timers and Interrupts.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
UNIT – Microcontroller.
Computer Architecture
CSCI1600: Embedded and Real Time Software
CSCI 315 Operating Systems Design
CSCI1600: Embedded and Real Time Software
Operating System Concepts
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
COMP3221: Microprocessors and Embedded Systems
Chapter 13: I/O Systems.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

CSCI1600: Embedded and Real Time Software Lecture 9: Input Output Concepts Steven Reiss, Fall 2015

Input and Output  I/O devices are attached to the computer  What does this mean?  How does the CPU interact with them?  What does this mean to the programmer?

Low-Level Details  Allocate a portion of the address space to I/O  Read and write to those addresses talks directly to device  Read and write to those addresses talks to an I/O controller  Special instructions to do this  No caching, ensure completion  Every device is different

Device Controller  Provides one or more I/O lines (Parallel)  Input Lines  Can be connected to input  Directly  Pulled up  Schmitt trigger (thresholded)  Can be latched  Can be indirect  Opto-isolated

Device Controller  Output lines  Pin connected through a driver for output  Provides some current (not too much)  Can connect through a transister for more power  Or a relay (solid state or physical)  Can be latched

Physical Hardware  Peripheral Interface Adapter  16 lines, 4 control lines  Bus interface to CPU  Built into the Arduino  Provides 14 digital lines  Provides 6 analog lines

Serial I/O  Parallel inputs are limited  For more comprehensive data using few pins  Use serial I/O  Send data over one line at a fixed rate  Needs to be clocked  Needs sender and receiver to agree on timing  We’ll get back to this

Pinball I/O  Problem  60 lights that must be controlled  56 switches that must be sensed  Limited number of input/output ports  Solution  Use an array of controls  Use a multiplexor

Array of Controls

Multiplexer

Demultiplexer (Demux)

Controlling 64 lights  How many I/O lines are needed  Problem  Can only drive a fraction at one time  Flash them fast enough and it will work  Problem  Not enough current

Driving Outputs  Use a driver circuit  Use a relay

I/O Timing  Input comes at random points in time  Handling timing issues is central to embedded computing  Must respond to an input within a certain time  Must deal with outputs in a timely fashion  Output should only be sent when the device is ready  Device might not see output if it changes too fast  CPU can be responsible for timing  Poll the inputs at the correct rate (input must be stable)  Turn outputs off and on at correct rate  Can complicate the program

Interrupts  I/O device can have a ready line to tell CPU timing  Polling is not always desirable  Very accurate times might mean busy wait  Instead the I/O device can tell the CPU when it is ready  This is typically done using an interrupt

Device Perspective  When should a device interrupt  Can be obvious (UART)  Can be flexible  When a line turns on (or off)  Or voltage goes above/below a certain level  More complex conditions  When a set of lines gets to a certain state  When any of a set of lines changes  Set via hardware or software

CPU Perspective  CPU has 2-16 interrupt request lines  IRQ : interrupt request  NMI : non-maskable interrupt  If a device sets these lines  CPU stops what it is doing  Starts executing in a separate context at fixed address

Interrupt Priority and Masking  Different lines have different proirities  Higher priority can interrupt lower priority processing  Can handle multiple interrupts at once  CPU can mask off interrupts  All interrupts beyond a certain level  The pend until unmasked  Higher interrupts mask off those of lower priority

Interrupt Coding  Interrupts introduce multiprocessing  Need to worry about race conditions, synchronization, deadlock  They need to be coded very cautiously  Shared data can be problematic, esp. data structures  Note that even 16/32 bit integers might be multiple values  Treat as multithreaded programming  Non-blocking synchronization techniques  Critical regions  Locks = masking interrupts  Interaction with real synchronization can be weird (later)

Arduino Interrupts  User provide a routine to be called when an interrupt occurs  For either DIO or AIO line (small set are usable)  Specific line and condition is settable  Interrupts can be masked  Also have timer interupts

Interrupt Coding  Do the minimum amount of work possible  Small and fast interrupt routine  Set shared flags for processing later  Read input and save for future processing  Protect access to these flags

Homework  Read Chapter 5