CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Principles of Computers 19 th Lecture Pavel Ježek, Ph.D.

Slides:



Advertisements
Similar presentations
IO Interfaces and Bus Standards. Interface circuits Consists of the cktry required to connect an i/o device to a computer. On one side we have data bus.
Advertisements

I2C bus Inter Integrated Circuits bus by Philips Semiconductors
Computer Architecture
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
Memory Address Decoding
1/1/ / faculty of Electrical Engineering eindhoven university of technology Processor support devices Part 1:Interrupts and shared memory dr.ir. A.C. Verschueren.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
DMA Direct memory access  Problems with programmed I/O  Processor wastes time polling  In our example I.Waiting for a key to be pressed, II.Waiting.
Computer Organization and Architecture Tutorial 2 Kenneth Lee.
I/O Subsystem Organization and Interfacing Cs 147 Peter Nguyen
Operating Systems Béat Hirsbrunner Main Reference: William Stallings, Operating Systems: Internals and Design Principles, 6 th Edition, Prentice Hall 2009.
I2CI2C CS-423 Dick Steflik. Inter-Integrated Circuit Developed and patented by Philips for connecting low speed peripherals to a motherboard, embedded.
Two Wire Interface Another popular serial peripheral interface bus -More flexible than SPI -Master and slave modes supported -7-bit slave address -400khz.
Design and Synthesis of a RISC Stored-Program Machine
Haptic Belt team Informational Presentation.  I 2 C is a form of control bus (multi-master) which allows communication between multiple integrated circuits.
Synchronous Serial IO Send a separate clock line with data
INPUT/OUTPUT ARCHITECTURE By Truc Truong. Input Devices Keyboard Keyboard Mouse Mouse Scanner Scanner CD-Rom CD-Rom Game Controller Game Controller.
Computer Architecture Lecture 08 Fasih ur Rehman.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
Input / Output CS 537 – Introduction to Operating Systems.
Lecture 111 Lecture 11: Lab 3 Overview, the ADV7183B Video Decoder and the I 2 C Bus ECE 412: Microcomputer Laboratory.
Embedded Bus – i2c David E. Culler Lab 2 Feb 2, 2015
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
THE COMPUTER SYSTEM. Lecture Objectives Computer functions – Instruction fetch & execute – Interrupt Handling – I/O functions Interconnections Computer.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Lecture 9 I2C NCHUEE 720A Lab Prof. Jichiang Tsai.
I/O Example: Disk Drives To access data: — seek: position head over the proper track (8 to 20 ms. avg.) — rotational latency: wait for desired sector (.5.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
DMA Versus Polling or Interrupt Driven I/O
Chapter 8: The Very Simple Computer
Input/Output Computer component : Input/Output I/O Modules External Devices I/O Modules Function and Structure I/O Operation Techniques I/O Channels and.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
1 Synchronous Serial IO Send a separate clock line with data –SPI (serial peripheral interface) protocol –I 2 C (or I2C) protocol Encode a clock with data.
Modes of transfer in computer
8085. Microcomputer Major components of the computer - the processor, the control unit, one or more memory ICs, one or more I/O ICs, and the clock Major.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
Computer Systems Organization
Refer to Chapter 15 in the reference book
©2008 R. Gupta, UCSD COSMOS Summer 2008 Peripheral Interfaces Rajesh K. Gupta Computer Science and Engineering University of California, San Diego.
IT3002 Computer Architecture
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Principles of Computers 14 th Lecture Pavel Ježek, Ph.D.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
Structure and Role of a Processor
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Principles of Computers 11 th Lecture Pavel Ježek, Ph.D.
Central Processing Unit Decode Cycle. Central Processing Unit Current Instruction Register (CIR) I1 The fetch cycle has transferred an instruction from.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
8 085Microprocessor Temp Reg (8) Accumulator (A reg) Flag flip flops(8) Instruction Register (8) Arithmetic Logic Unit ALU Instruction Decoder and Machine.
1 load [2], [9] Transfer contents of memory location 9 to memory location 2. Illegal instruction.
STUDY OF PIC MICROCONTROLLERS.. Design Flow C CODE Hex File Assembly Code Compiler Assembler Chip Programming.
DIRECT MEMORY ACCESS and Computer Buses
Two Wire Interface Another popular serial peripheral interface bus
Chapter 11: Inter-Integrated Circuit (I2C) Interface
(Inter-IC bus) By Tejaswini Gadicherla
Computer System Overview
EE 107 Fall 2017 Lecture 7 Serial Buses – I2C Direct Memory Access
CS 286 Computer Organization and Architecture
Dr. Michael Nasief Lecture 2
Overview Peripheral Devices Input-Output Interface
Principles of Computers 21st Lecture
Principles of Computers 16th Lecture
Topic 6 LC-3.
Principles of Computers 20th Lecture
Another Physical Layer – I2C
Principles of Computers 17th Lecture
Principles of Computers 21st Lecture
Presentation transcript:

CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Principles of Computers 19 th Lecture Pavel Ježek, Ph.D.

Address decode 8-bit Sound Card HCI... $F $F DD $F $F $F $F Data W/O reg RWAddr reg PlayAdr reg Playback logic Loudspeaker image (CC Attribution) authored by Sallee Design, DAC auto increment sound buffer (100kB – MB)

Address decode 16-bit Sound Card HCI (Byte Ordering as Part of HCI)... $F DD $F DD $F $F $F $F Data W/O reg MSB LSB RWAddr reg PlayAdr reg Playback logic Loudspeaker image (CC Attribution) authored by Sallee Design, DAC auto increment on MSB write (LSB and MSB must be written at once during a single 16-bit write [if on 16-bit system bus] or LSB must be written first and MSB second if on 8-bit system bus) auto increment sound buffer (100kB – MB)

Address decode 16-bit Sound Card HCI... $F DD $F DD $F AA $F $F $F Data W/O reg MSB LSB RWAddr R/W reg PlayAdr reg Playback logic Loudspeaker image (CC Attribution) authored by Sallee Design, DAC auto increment sound buffer (100kB – MB)

Address decode 16-bit Sound Card HCI... $F DD $F DD $F AA $F CF $F $F Data W/O reg MSB LSB RWAddr R/W reg Config R/W reg ▪sample rate ▪sample size ▪mono/stereo PlayAdr reg Playback logic Loudspeaker image (CC Attribution) authored by Sallee Design, DAC auto increment sound buffer (100kB – MB)

Address decode 16-bit Sound Card HCI... $F DD $F DD $F AA $F CF $F CT $F Data R/W reg MSB LSB RWAddr R/W reg Config R/W reg ▪sample rate ▪sample size ▪mono/stereo Control W/O reg ▪play/stop ▪record/stop PlayAdr reg Playback logic Loudspeaker image (CC Attribution) authored by Sallee Design, DAC auto increment sound buffer (100kB – MB)

Address decode 16-bit Sound Card HCI... $F DD $F DD $F AA $F CF $F CT $F ST... Data R/W reg MSB LSB RWAddr R/W reg Config R/W reg ▪sample rate ▪sample size ▪mono/stereo Control W/O reg ▪play/stop ▪record/stop Status R/O reg ▪play position ▪playing? ▪recording? PlayAdr reg Playback logic Loudspeaker image (CC Attribution) authored by Sallee Design, DAC auto increment sound buffer (100kB – MB) Base address: $F

I 2 C Bus Arbitration Original source: Embedded Systems Academy - Bus Arbitration:

Sending 1 Byte Via Philips PCA9564 I 2 C HBA W I2CCON ← (STA=1|STO=0|CR0-CR2=clock rate) R I2CCON → wait for SI=1 (controller waits for I2C idle state) R I2CSTA → $08=start transmitted W I2CCON ← (STA=0,STO=0) W I2CDAT ← (slave addr|R/W=0=write) R I2CCON → wait for SI=1 R I2CSTA → $18=ACK received=slave listening → $20=NACK received=slave not present → $38=arbitration lost W I2CDAT ← data byte to send R I2CCON → wait for SI=1 R I2CSTA → $28=ACK received → $30=NACK received → $38=arbitration lost W I2CCON ← (STA=0,STO=1) Registers I2CCON = Control (R/W) bit STA: 1 = send Start condition bit STO: 1 = send Stop condition bit SI = Serial Interrupt: 1 = Status register changed (SCL line is held LOW → I2C transmission is suspended) I2CDAT = Data (R/W) I2CSTA = Status (R/O)

Sending 1 Byte Via Philips PCA9564 I 2 C HBA W I2CCON ← (STA=1|STO=0|CR0-CR2=clock rate) R I2CCON → wait for SI=1 (controller waits for I2C idle state) R I2CSTA → $08=start transmitted W I2CCON ← (STA=0,STO=0) W I2CDAT ← (slave addr|R/W=0=write) R I2CCON → wait for SI=1 R I2CSTA → $18=ACK received=slave listening → $20=NACK received=slave not present → $38=arbitration lost W I2CDAT ← data byte to send R I2CCON → wait for SI=1 R I2CSTA → $28=ACK received → $30=NACK received → $38=arbitration lost W I2CCON ← (STA=0,STO=1) Registers I2CCON = Control (R/W) bit STA: 1 = send Start condition bit STO: 1 = send Stop condition bit SI = Serial Interrupt: 1 = Status register changed (SCL line is held LOW → I2C transmission is suspended) I2CDAT = Data (R/W) I2CSTA = Status (R/O) If everything is ideal: 1 transaction on I 2 C bus = 11 transactions on system bus (or more, if not ideal)

Sending 1 Byte Using Interrupts procedure SendByte(…); begin set interrupt X handler W I2CCON ← (STA=1|STO=0|CR0-CR2=clock rate) end; procedure SendAddress(…); begin R I2CSTA → $08=start transmitted W I2CCON ← (STA=0,STO=0) W I2CDAT ← (slave addr|R/W=0=write) set interrupt X handler end; procedure SendData(…); begin R I2CSTA → $18=ACK received=slave listening → $20=NACK received=slave not present → $38=arbitration lost W I2CDAT ← data byte to send set interrupt X handler end; procedure SendStop(…); begin R I2CSTA → $28=ACK received → $30=NACK received → $38=arbitration lost W I2CCON ← (STA=0,STO=1) set interrupt X handler = default end; Registers I2CCON = Control (R/W) bit STA: 1 = send Start condition bit STO: 1 = send Stop condition bit SI = Serial Interrupt: 1 = Status register changed (SCL line is held LOW → I2C transmission is suspended) I2CDAT = Data (R/W) I2CSTA = Status (R/O)

Sending 1 Byte Using Interrupts procedure SendByte(…); begin W I2CCON ← (STA=1|STO=0|CR0-CR2=clock rate) set interrupt X handler end; procedure SendAddress(…); begin R I2CSTA → $08=start transmitted W I2CCON ← (STA=0,STO=0) W I2CDAT ← (slave addr|R/W=0=write) set interrupt X handler end; procedure SendData(…); begin R I2CSTA → $18=ACK received=slave listening → $20=NACK received=slave not present → $38=arbitration lost W I2CDAT ← data byte to send set interrupt X handler end; procedure SendStop(…); begin R I2CSTA → $28=ACK received → $30=NACK received → $38=arbitration lost W I2CCON ← (STA=0,STO=1) set interrupt X handler = default end; Registers I2CCON = Control (R/W) bit STA: 1 = send Start condition bit STO: 1 = send Stop condition bit SI = Serial Interrupt: 1 = Status register changed (SCL line is held LOW → I2C transmission is suspended) I2CDAT = Data (R/W) I2CSTA = Status (R/O) RACE CONDITION!

Sending 1 Byte Using Interrupts procedure SendByte(…); begin W I2CCON ← (STA=1|STO=0|CR0-CR2=clock rate) set interrupt X handler end; procedure SendAddress(…); begin R I2CSTA → $08=start transmitted W I2CCON ← (STA=0,STO=0) W I2CDAT ← (slave addr|R/W=0=write) set interrupt X handler end; procedure SendData(…); begin R I2CSTA → $18=ACK received=slave listening → $20=NACK received=slave not present → $38=arbitration lost W I2CDAT ← data byte to send set interrupt X handler end; procedure SendStop(…); begin R I2CSTA → $28=ACK received → $30=NACK received → $38=arbitration lost W I2CCON ← (STA=0,STO=1) set interrupt X handler = default end; Registers I2CCON = Control (R/W) bit STA: 1 = send Start condition bit STO: 1 = send Stop condition bit SI = Serial Interrupt: 1 = Status register changed (SCL line is held LOW → I2C transmission is suspended) I2CDAT = Data (R/W) I2CSTA = Status (R/O) RACE CONDITION! If interrupt arrives here, we will send the same data byte for the second time!

Sending 1 Byte Using Interrupts procedure SendByte(…); begin set interrupt X handler W I2CCON ← (STA=1|STO=0|CR0-CR2=clock rate) end; procedure SendAddress(…); begin R I2CSTA → $08=start transmitted W I2CCON ← (STA=0,STO=0) set interrupt X handler W I2CDAT ← (slave addr|R/W=0=write) end; procedure SendData(…); begin R I2CSTA → $18=ACK received=slave listening → $20=NACK received=slave not present → $38=arbitration lost set interrupt X handler W I2CDAT ← data byte to send end; procedure SendStop(…); begin R I2CSTA → $28=ACK received → $30=NACK received → $38=arbitration lost set interrupt X handler = default W I2CCON ← (STA=0,STO=1) end; Registers I2CCON = Control (R/W) bit STA: 1 = send Start condition bit STO: 1 = send Stop condition bit SI = Serial Interrupt: 1 = Status register changed (SCL line is held LOW → I2C transmission is suspended) I2CDAT = Data (R/W) I2CSTA = Status (R/O)

PIO (Programmed I/O) 6502: LDA ctrl_data_reg_address STA buffer_address

PIO (Programmed I/O) 6502: LDA ctrl_data_reg_address STA buffer_address 1 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 1 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 4 tx

PIO (Programmed I/O) 6502: LDA ctrl_data_reg_address STA buffer_address 1 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 1 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 4 tx 6502: LDA addr = 3 byte instruction STA addr = 3 byte instruction 3 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 3 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 8 tx

PIO (Programmed I/O) 6502: LDA ctrl_data_reg_address STA buffer_address 1 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 1 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 4 tx 6502: LDA addr = 3 byte instruction STA addr = 3 byte instruction 3 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 3 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 8 tx e.g. system bus: 1 byte/tx 2 cycles/tx 1 MHZ cycles = 0,5 MB/second = x B/s PIO transfer = (x / 8) B/s = 62,5 kB/s

PIO (Programmed I/O) 6502: LDA ctrl_data_reg_address STA buffer_address 1 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 1 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 4 tx 6502: LDA addr = 3 byte instruction STA addr = 3 byte instruction 3 tx = read/fetch load instruction opcode 1 tx = read data from controller’s data register 3 tx = read/fetch store instruction opcode 1 tx = write data from A to buffer in memory = 8 tx e.g. system bus: 1 byte/tx 2 cycles/tx 1 MHZ cycles = 0,5 MB/second = x B/s PIO transfer = (x / 8) B/s = 62,5 kB/s Solution: DMA