USB Peripheral Controller John Jones 12/11/08 Embedded Systems Architecture.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

ECE 353 Introduction to Microprocessor Systems
8086 [2] Ahad. Internal! External? 8086 vs _bit Data Bus 20_bit Address 8_bit Data Bus 20_bit Address Only external bus of 8088 is.
Parul Polytechnic Institute
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Lab III Real-Time Embedded Operating System for a SoC System.
Exceptions. Exception Types Exception Handling Vectoring Interrupts Interrupt Handlers Interrupt Priorities Interrupt applications 6-2.
OUTPUT INTERFACE – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
Programmable Interval Timer
Programmable Keyboard/ Display Interface: 8279
Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1.
Chapter 2 HARDWARE SUMMARY
8086.  The 8086 is Intel’s first 16-bit microprocessor  The 8086 can run at different clock speeds  Standard 8086 – 5 MHz  –10 MHz 
Microprocessor and Microcontroller
I/O Unit.
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.
1 TK2633TK Microprocessor Architecture DR MASRI AYOB.
ARM 7 Datapath. Has “BIGEND” input bit, which defines whether the memory is big or little endian Modes: ARM7 supports six modes of operation: (1) User.
COMP3221 lec28-exception-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 28: Exceptions & Interrupts - II
COMP3221 lec27-exception-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 27: Exceptions & Interrupts - I
Anush Rengarajan Feng Zheng Thomas Madaelil
9/20/6Lecture 3 - Instruction Set - Al Hardware interface (part 2)
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 15 PC Standard Bus Interfaces WK.
Microcomputer & Interfacing Lecture 2
3-1 System peripherals & Bus Structure Memory map of the LPC2300 device is one contiguous 32-bit address range. However, the device itself is made up of.
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
Advanced Computers and Communications (ACC) Faculty Advisors: Dr. Charles Liu Dr. Helen Boussalis 10/25/20121NASA Grant URC NCC NNX08BA44A Student Assistants:
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Exception and Interrupt Handling
Lecture 5. AT91 - Memory Map, Timers, and AIC -
1 EKT 225 MICROCONTROLLER I CHAPTER 3 I/O PORT PROGRAMMING.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
Multiplexed External Bus Interface-MEBIV3 By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41
Basic I/O Interface A Course in Microprocessor
I NTRODUCTION P IN CONFIGARATION O PERATING MODE.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
PPI-8255.
AT91 C-startup. 2 For reasons of modularity and portability most application code for an embedded application is written in C The application entry point.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Chapter Microcontroller
8255:Programmable Peripheral Interface
1 TM 1 Embedded Systems Lab./Honam University r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 (sp) r14 (lr) r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp)
ARM7 TDMI INTRODUCTION.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Gandhinagar Institute of Technology
Memory Mapped IO (and the CerfBoard). The problem How many IO pins are available on the 8051? What if you are using interrupts, serial, etc…? We want.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Intel 8255A PPI EEE 365 [FALL 2014] LECTURE ATANU K SAHA BRAC UNIVERSITY.
8255 Programmable Peripheral Interface
PROGRAMMABLE PERIPHERAL INTERFACE -8255
I/O Systems.
Timer and Interrupts.
Hardware Source: ttp:// under
8086/8088 Hardware Specifications
8085 Microprocessor Architecture
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
USB-Microcontroller C540U Family
CENG2400 Revision Q1a A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module. Two on/off switches are connected to bit-3.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Parallel communication interface 8255
Real-Time Embedded Operating System for a SoC System
8085 Microprocessor Architecture
8259 Programmable Interrupt Controller
Hardware Source: ttp:// under
Programmable Interrupt Controller (PIC)
Lecture 7 System architecture Input-output
The Programmable Peripheral Interface (8255A)
Presentation transcript:

USB Peripheral Controller John Jones 12/11/08 Embedded Systems Architecture

USB Peripheral Controller ARM USB CONTROLLER PHY USB Peripheral Device HOST

System Block Diagram Peripheral Controller ARM PHY Setup Data 8 bytes 4 IN Endpoints 128 bytes each 4 OUT Endpoints 128 bytes each ARM InterfacePHY Interface

SMSC USB3300 USB PHY Source: USB3300 datasheet

ARM & FPGA Development Board ARM Processor NXP LPC2132 Xilinx FPGA Spartan-3E X3CS500E

USB PHY Evaluation Board

Complete System

Interconnect

Problems… No external address and databus on ARM Only connection to FPGA is with P0.2 - P0.17. Could not get 8 continuous pins to form bus Some FPGA pins are dedicated inputs 3 port pins on the ARM were not functioning

Workaround… Bit Bang Port 0 I/O Access FPGA using a multiplexed address/data bus. Need to map and unmap bits to go around bad pins. unsigned int map_bits (unsigned int data) { unsigned int upper; unsigned int lower; unsigned int join; upper = (data & 0xF0) << 12; lower = (data & 0x0F) << 4; join = upper | lower; return join; } unsigned int unmap_bits (unsigned int data) { unsigned int upper; unsigned int lower; unsigned int join; upper = (data >> 12) & 0xF0; lower = (data >> 4) & 0x0F; join = upper | lower; return join; }

FPGA Write Function void fpga_wr(unsigned int address, unsigned int data) { unsigned int map_data; unsigned int map_addr; map_data = map_bits(data); map_addr = map_bits(address); IODIR0 = P0_OUTPUTS | P0_DATA; // Set BUS to output // Write address IOCLR0 = P0_LA|P0_RD|P0_WR|P0_DATA; // Initialize I/O IOSET0 = map_addr;// Drive Address IOSET0 = P0_LA;// Latch address // Write Data IOCLR0 = P0_LA|P0_RD|P0_WR|P0_DATA; // Initialize I/O IOSET0 = map_data;// Drive data IOSET0 = P0_WR;// Latch address IOCLR0 = P0_WR;// Negate WR IODIR0 = P0_OUTPUTS; // Tri-state Bus } 92 Assembly Instructions!

FPGA Read Function unsigned char fpga_rd(unsigned int address) { unsigned int map_addr; unsigned int raw_data, data; map_addr = map_bits(address); // Write address IODIR0 = P0_OUTPUTS | P0_DATA;// Set BUS to output IOCLR0 = P0_LA|P0_RD|P0_WR|P0_DATA;// Initialize I/O IOSET0 = map_addr;// Drive Address IOSET0 = P0_LA;// Latch Address IOCLR0 = P0_LA;// Negate IODIR0 = P0_OUTPUTS;// Tri-state Bus // Read Data IOSET0 = P0_RD;// Assert RD control raw_data = IOPIN0;// Latch data IOCLR0 = P0_RD;// Negate RD control data = unmap_bits(raw_data); return (unsigned char) data; } 90 Assembly Instructions!

USB Peripheral Controller Features… Four Endpoints 4 IN Buffers – 128 bytes each 4 OUT Buffers – 128 bytes each Setup Data Buffer Interrupt Start-of-frame, Setup Data, IN/OUT packets Shortcomings… No CRC support No double-buffering Manually toggle DATA0/DATA1

System Block Diagram Peripheral Controller ARM PHY Setup Data 8 bytes 4 IN Endpoints 128 bytes each 4 OUT Endpoints 128 bytes each ARM InterfacePHY Interface

ARM Interface

USB Controller

FPGA Registers IN0CNT, IN1CNT, IN2CNT, IN3CNT ARM writes to these registers to indicate how many bytes to transmit. OUT0CNT, OUT1CNT, OUT2CNT, OUT3CNT ARM reads these registers to determine how many bytes were received. IN_RDY – bits 3-0 ARM sets bit(s) to indicate if buffer has been transmitted. Set by ARM. Cleared by Controller. 1 – Buffer ready (waiting to be sent)0 – Buffer has been sent. Controller will NAK IN-packet requests to an endpoint buffer not ready. OUT_RDY – bits 3-0 ARM reads bit(s) to determine which buffer has new data. Set by Controller. Cleared by ARM. 1 – New data available,0 – No new data Controller will NAK OUT-packets if buffer has not been read by ARM (bit = 0).

FPGA Registers - continued IRQ Status Register ARM reads this register to determine source of interrupt. Four bits – four interrupt sources Bit 0 – Start-of-Frame Interrupt Bit 1 – Setup Data Available Bit 2 – IN Buffer Ready ARM must read IN RDY register to determine which buffer caused the interrupt. Bit 3 – OUT Buffer Ready ARM must read OUT RDY register to determine which buffer caused the interrupt. Write ‘1’ to clear

FPGA Registers - continued TOGGLE ARM must alternate DATA0 and DATA1 PID’s used for IN transactions. Four bits – one for each of the four IN buffers. Select which DATA PID to use for IN transactions. 0 – DATA0 PID 1 – DATA1 PID Device Address 0x00 on reset ARM re-programs this register after obtaining a new device address from host during the enumeration process. FRAME(HIGH) and FRAME(LOW) 11 bit frame number from SOF packets.

FPGA Registers - continued ULPI Address 6 bit address of USB3300 register to access. Refer to USB3300 datasheet. ULPI RW Bit 0 – ARM writes ‘1’ to initiate a write. Bit 1 – ARM writes ‘1’ to initiate a read. ULPI Data 8 bit read or write data.

Simulation – IN Transactions 1.ARM loads IN0, IN1, IN2, IN3 buffers. 2.ARM writes to byte count registers IN0CNT,…,IN3CNT. 3.ARM sets IN Ready Flags. 4.USB IN Transactions 1234

Simulation – IN Transaction (ZOOM)

Simulation – OUT Transactions 1.USB SETUP Packet 2.USB OUT transactions to endpoints 0, 1, 2, 3. 3.ARM reads Setup Data and OUT0, OUT1, OUT2, OUT3 buffers. 132

Simulation – OUT Transactions (zoom)

Start-of-Frame Packets “phy_dir” “phy_nxt” “Rx_Active” “SOF Detect” RXCMD updates BYTE 1BYTE 2BYTE 3

Start-of-Frame Packet Interval 1 millisecond

Setup Transaction “new_data” “Rx Active” “Start of Frame” “IRQ” SOF Packet SETUP Packet Setup Data (11bytes): PID + 8 bytes + CRC16

Setup Data ByteValueDescription 00x80bmRequestType 10x06 Get Descriptor 20x00 30x01Device 40x00 50x00 60x40Number of bytes 70x00 Screen capture from Insight (GUI for GNU GDB)

Device Descriptor unsigned char DeviceDescriptor[] = { 18,// Length 1,// Type 0x10,1,// USB Rev 1.1 (=0110H,low=10H, High=01H) 0,// Class 0,// Subclass 0,// Protocol 64,// Maximum Packet Size 0x42, 0x42,// Vendor ID 1, 0x42, 0, 1,// Product ID and Version 1, 2, 0,// Manufacturer, Product & Serial# Names 1// #Configs };

ARM Interrupt Handling void IRQ_Service(void) { if ( VICIRQStatus & 0x ) TMR1_Service(); if ( VICIRQStatus & 0x ) TMR0_Service(); } /********************************************/ /* Vector table and reset entry */ /********************************************/ _vectors: ldr pc, ResetAddr /* Reset */ ldr pc, UndefAddr /* Undefined instruction */ ldr pc, SWIAddr /* Software interrupt */ ldr pc, PAbortAddr /* Prefetch abort */ ldr pc, DAbortAddr /* Data abort */ ldr pc, ReservedAddr/* Reserved */ ldr pc, IRQAddr /* IRQ interrupt */ ldr pc, FIQAddr /* FIQ interrupt */ : IRQAddr:.word IRQHandler FIQAddr:.word FIQHandler : IRQHandler: stmdb sp!, {r0-r12, lr}/* save all registers */ bl IRQ_Service ldmia sp!, {r0-r12, lr} /* restore all registers */ subs pc, lr, #4/* Restore CPSR and return */ Assembly Code C-code