Скачать презентацию Microprocessor-based Systems Course 10 Design of Input Output interfaces Скачать презентацию Microprocessor-based Systems Course 10 Design of Input Output interfaces

7fb70f7ce5222a00471fc2b92d409f58.ppt

  • Количество слайдов: 35

Microprocessor-based Systems Course 10 Design of Input/Output interfaces (continuation) 1 Microprocessor-based Systems Course 10 Design of Input/Output interfaces (continuation) 1

USB – Universal Serial Bus ¡ Goal: l l ¡ a communication standard for USB – Universal Serial Bus ¡ Goal: l l ¡ a communication standard for a wide range of peripheral devices, connectable to a PC ¡ Mouse, keyboard, joy-stick – input devices ¡ Printer – output device ¡ Scanner, Digital camera, Webcam – multimedia devices ¡ Memory-stick – storage devices replaces traditional serial and parallel interfaces Solution: l multilayer protocol with master-slave functionality 2

Performance features ¡ ¡ ¡ Very high speed Wide bandwidth (12 Mbs) Pn. P Performance features ¡ ¡ ¡ Very high speed Wide bandwidth (12 Mbs) Pn. P (Plag and Play) facilities One interface handle many devices in the same time Many communication channels on the same physical support Transmission modes adapted to different dataflow types: l sporadic data l periodic data l high volume of data 3

Physical characteristics ¡ Transmission on standard cable: l l 4 wires: ¡ 2 for Physical characteristics ¡ Transmission on standard cable: l l 4 wires: ¡ 2 for power supply: Vcc (red), GND (brown) => 5 V, 500 m. A ¡ 2 for data (blue and yellow ), twisted Cable length: ¡ maximum 5 m ¡ extensible with HUBs until 30 m Standard connectors: ¡ type “A” – for the computer (host or master) ¡ type “B” – for devices Connectable during normal work (hot-swappable) 4

Physical topology of the USB (network) Host (computer) Root Hub Device Compound Device Hub Physical topology of the USB (network) Host (computer) Root Hub Device Compound Device Hub Device Star topology Device 5

Device types: ¡ “Host” (master) – usually a computer l l l ¡ the Device types: ¡ “Host” (master) – usually a computer l l l ¡ the device that controls the communication on the USB network distributes network access rights to the other devices moditors the USB network topology “Device” – peripheral device connected to the computer l l offers a given “functionality” for the host (ex: mouse, printer, scanner, etc. ) when it is connected the device gets a unique address from the host the format of data depends on the type of the device information exchanged between the host and the device may be: ¡ ¡ general information specific for a given type of devices 6

Device types (cont. ): “Hub” – amplifying and branching device ¡ “Compound Device” – Device types (cont. ): “Hub” – amplifying and branching device ¡ “Compound Device” – ¡ l l ¡ contains a HUB and some devices every device has its own address (including the HUB) “Composite Device” – l contains a number of functionalities but under a single address 7

The USB protocol model ¡ the protocol is organized on three hierarchical layers: l The USB protocol model ¡ the protocol is organized on three hierarchical layers: l l l USB bus interface layer – the physical layer ¡ handles the physical transmission of data (on the cable) USB device layer – ¡ assures the logical connection between the host and the devices ¡ it is the operating system’s vision over the USB interface Function layer – ¡ assures the connection between the “client software” in the host and the “function” in the device 8

The USB protocol model Host Device Client software Function System software Logical device USB The USB protocol model Host Device Client software Function System software Logical device USB controller Bus interface Physical connection Logical connection 9

Logical topology (layer 2) Host Logical Device • Direct connections between the host and Logical topology (layer 2) Host Logical Device • Direct connections between the host and the logical devices • the physical connections (including HUBs) are ignored 10

Application level topology (layer 3) Host Client software Dispozitiv Function 11 Application level topology (layer 3) Host Client software Dispozitiv Function 11

Communication channels Host Client software Buffers Communication flows Device Channels (Pipes) Function Endpoints 12 Communication channels Host Client software Buffers Communication flows Device Channels (Pipes) Function Endpoints 12

Communication channels ¡ ¡ ¡ communication channel: a logical connection between a device and Communication channels ¡ ¡ ¡ communication channel: a logical connection between a device and a software that runs on the host a device may have a number of communication channels the host allocates a given bandwidth for every channel according with: l l ¡ the type of the data transmission and the available bandwidth Every channel ends with an endpoint, used to: l l configure the data channel address the channel 13

Endpoints ¡ Endpoint: a part of a USB device: l l l it is Endpoints ¡ Endpoint: a part of a USB device: l l l it is uniquely identified through a number ends a communication channel stores the parameters of a channel: ¡ bus access frequency ¡ required bandwidth ¡ endpoint’s number ¡ behavior in case of an error ¡ maximum length of accepted packages ¡ transfer type ¡ transfer direction 14

Endpoints ¡ ¡ ¡ an USB device is a collection of endpoints every device Endpoints ¡ ¡ ¡ an USB device is a collection of endpoints every device have two predefined endpoints, one for input and one for output, both on address 0; the other endpoints are not defined the other endpoints are configured by the host, when the device is connected the endpoints are for input or for output a communication channel is identified through: l l l device address, the endpoint number and the dataflow direction 15

Communication on the USB bus ¡ ¡ communication is made through frames of 1 Communication on the USB bus ¡ ¡ communication is made through frames of 1 millisecond (1000 cadre/s) a frame contains a number of transactions a given transfer may be performed through a number of transactions Transfer types on the USB bus: l control transfer l isochronous transfer, or periodic l interrupt transfer or a-periodic l bulk transfer or on blocks 16

Control transfer ¡ ¡ ¡ initiated by the host, non-periodic used for configuring and Control transfer ¡ ¡ ¡ initiated by the host, non-periodic used for configuring and dialog with the device a control transfer contains: l l l ¡ ¡ ¡ a “setup” transaction – through which the device is interrogated zero ore more data transfers transactions a status transaction – to find the state of the device the control transfer is performed on a standard channel present in every USB device the standard channel is used for configuration and for device interrogation through this channel the host configures all the other channels (including endpoints) 17

Control transfer ¡ ¡ ¡ maximum dimension of the control packet may be 8, Control transfer ¡ ¡ ¡ maximum dimension of the control packet may be 8, 16, 32 or 64 bytes the “setup” packet has a fixed dimension of de 8 bytes the device descriptor specifies the maximum accepted length for the data packets the control transfers have lower priority than isochronous or interrupt transfers at most 10% of a frame is allocated for control transfers, the rest is allocated for isochronous or interrupt transfers the control transfer used “handshake” in order to guarantee the correctness of the transfer l the erroneous packets are re-transmited 18

Isochronous transfer (periodical) ¡ ¡ ¡ assures a guaranteed bandwidth for periodic transfers the Isochronous transfer (periodical) ¡ ¡ ¡ assures a guaranteed bandwidth for periodic transfers the format is not specified by the USB standard; it depends on the type of the device, the content is interpreted only at the client software level the transfer is continuous, it ends only on an explicit request a reduced error detection mechanism, the erroneous frames are not re-transmitted the transfer through an endpoint is made in a single direction; for bidirectional transfer two endpoints must be defined 19

Isochronous transfer (periodical) ¡ ¡ the maximum dimension of a packet is 1023 bytes Isochronous transfer (periodical) ¡ ¡ the maximum dimension of a packet is 1023 bytes if more isochronous devices are used in the same time the packet dimension is divided accordingly the system allocates 90% of the bandwidth for isochronous and interrupt transfers every device will specify the required transfer rate, which may be between 1 and 216 , (one packet per several frames) 20

Interrupt transfers ¡ ¡ ¡ used for sporadic, small data transfers examples: mouse, keyboard, Interrupt transfers ¡ ¡ ¡ used for sporadic, small data transfers examples: mouse, keyboard, multiple channel devices maximum packet dimension: 64 bytes a channel has a guaranteed bandwidth assured through the allocation of a frame portion during configuration, a minimum appearance period is specified between 1 -255 microseconds during configuration the system verifies if the required bandwidth necessary for a given frequency can be assured 21

Bulk transfer ¡ ¡ ¡ ¡ used for transferring blocks of data without time Bulk transfer ¡ ¡ ¡ ¡ used for transferring blocks of data without time restrictions transfers are non-periodical examples: printer, digital camera the transfer will use the maximum available bandwidth the erroneous packets are re-transmitted maximum packet dimensions: 8, 16, 32, or 64 pt. USB 1. 1 or 512 for USB 2. 0 the bandwidth is not guaranteed the priority is minimum 22

Communication on USBD interface HCD interface Client software Data USB Driver Host Controller Driver Communication on USBD interface HCD interface Client software Data USB Driver Host Controller Driver Transfers Transaction list Transactions Transaction Hardware interface Transactions Host Controller Packets USB 23

Components involved in the communication ¡ Client software l l l ¡ determines the Components involved in the communication ¡ Client software l l l ¡ determines the type of the transfer for each device it does not handle communication channels for communication uses the drivers offered by the operating system USB driver (USBD) l l handles the configuration and normal transfer requests received from the client software establish and configure communication channels based on the received requests; some requests may be rejected because of bandwidth limitations 24

Components involved in the communication ¡ ¡ Host controller’s driver (HCD) l receives transfer Components involved in the communication ¡ ¡ Host controller’s driver (HCD) l receives transfer requests and handles their transmission l puts the received data in the buffer l checks the transmission limits (requests v. s bandwidth) l announce the end of the transmission Transaction list l ¡ contains the list of transactions in progress Host controller l l transforms the waiting transactions in activities on the bus handles the frames and send and receive packets 25

Parallel interface ¡ Transfer is made through a number of lines: l l ¡ Parallel interface ¡ Transfer is made through a number of lines: l l ¡ Features: l l l ¡ Data lines (ex: 8) – for data transmission Control lines – for synchronization and dataflow control High speed Small distances Usually unidirectional transfers Types of parallel transfers: l l l a) without control signals b) asynchronous protocol without confirmation c) asynchronous protocol with confirmation (hand shaking) 26

Transfer types a) Without control signals - only data lines are used - useful Transfer types a) Without control signals - only data lines are used - useful for reading status lines or generating command signals - cannot be used for sequential data transfer – there are no signals for synchronization or flow control - examples: testing digital sensors, control of actuators b) asynchronous protocol without confirmation - an extra control signal is used (besides data lines); it may be generated by the emitter or by the receiver - a sequence of data may be transmitted - the transmission speed is controlled by the device generating the control signal - there is no feedback signal (confirmation) from the other partner; the speed should be enough small to cover any possible delays; so the transmission is slow 27

Parallel transfer c) Asynchronous protocol with confirmation (hand - shaking) - two control signals Parallel transfer c) Asynchronous protocol with confirmation (hand - shaking) - two control signals are used: one from the emitter and one from the receiver - transmission with “feed-back” - it may be adapted to the variable speed of the emitter or receiver devices; the result is a higher speed - if the correlation between control signals is not good errors may occur Correct Error 28

Parallel transfer c) asynchronous protocol (hand - shaking), with interconditioning between control signals - Parallel transfer c) asynchronous protocol (hand - shaking), with interconditioning between control signals - solves the correct transmission of data - the control signals are inter-conditioned 29

Parallel transfer ¡ The I 8255 circuit – controller for parallel transfers l l Parallel transfer ¡ The I 8255 circuit – controller for parallel transfers l l 3 data ports of 8 bits (A, B and C) Working modes: ¡ ¡ Inputs Outputs Bidirectional transfer Port C divided in 2 in order to serve as control signals for ports A and B A si B 30

Counter/Timer circuits ¡ Used for: l l ¡ Specialized controller: I 8253 l l Counter/Timer circuits ¡ Used for: l l ¡ Specialized controller: I 8253 l l ¡ counting external events generate different frequencies by dividing a base clock frequency delaying signals (monostable) generate periodic interrupts 3 counters of 16 bits different working modes Use in a PC: l l l to generate interrupts in order to measure the time periodical memory refresh cycles to generate simple sounds 31

Design of an Input/Output interface ¡ Steps l l l ¡ Define the functional Design of an Input/Output interface ¡ Steps l l l ¡ Define the functional block scheme select circuits for special interface functionalities (controllers) allocate addresses for registers from the I/O space establish the selection/decoding mode design circuits for selection and control. Functional blocks: l l l selection/decoding block Input/Output registers (ports) Command device Command register Status register Adaptation circuit for the peripheral device 32

Design of an Input/Output interface ¡ Selection block: l l Role: Select the interface Design of an Input/Output interface ¡ Selection block: l l Role: Select the interface and the registers inside it Selection mode: ¡ ¡ ¡ Total – all the address lines are considered (rarely used) Partial – a limited number of address lines are used (most often used) Linear – every address line is considered a selection lie (used for small, dedicated systems) 33

Design of an Input/Output interface ¡ Register block: l Data registers/ports – for data Design of an Input/Output interface ¡ Register block: l Data registers/ports – for data transmission: ¡ ¡ l Control register(s) ¡ l generate control signals to the peripheral device or determine the working mode of the interface Status register(s): ¡ ¡ for Input for Output show the state of the interface or of the device Data amplifier: l assures the proper fan-out 34

Circuits specialized for different interfaces ¡ Parallel interface controller l ¡ Serial interface controller Circuits specialized for different interfaces ¡ Parallel interface controller l ¡ Serial interface controller l ¡ ¡ ¡ SIO – serial I/O, or USART – universal serial asynchronous receiver and transmitters: I 8251 Counter/Timer controller: l ¡ PIO – parallel I/O: I 8255 CTC – counter/timer controller: I 8253 Floppy disk controller: I 8272 DMA controller: I 8237 Interrupt controller: I 8259 A 35