October 11, 20001. 2 Firmware for USB 2.0 Ryan Augustin Netchip Technology, Inc

Slides:



Advertisements
Similar presentations
Lecture 101 Lecture 10: Kernel Modules and Device Drivers ECE 412: Microcomputer Laboratory.
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
CS-334: Computer Architecture
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.
PC To GT Program Load Shachar Rosenberg Alex Normatov Technion - Digital Lab.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
Chapter 1 and 2 Computer System and Operating System Overview
USB 2.0 INTRODUCTION NTUT CSIE 學 生:許家豪 指導教授:柯開維教授.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 15 PC Standard Bus Interfaces WK.
Hardware Interface Design Patterns Ahmet Selman Bozkır – Hacettepe Univ.
May 8, The EASY Way to Create I/O Devices John Hyde Intel Corporation intel.com.
Input / Output CS 537 – Introduction to Operating Systems.
May 9, USB 2.0 High Bandwidth Peripheral Design Challenges Robert Shaw Cypress Semiconductor Robert Shaw Cypress Semiconductor
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Introduction to USB Development. USB Development Introduction Technical Overview USB in Embedded Systems Recent Developments Extensions to USB USB as.
Introduction to USB © 2010 Renesas Electronics America Inc. All rights reserved.
System Calls 1.
USB host for web camera connection
CHAPTER 5 I/O PRINCIPLE Understand the principles of System Bus
October 10, USB 2.0 Peripheral Design Options Dave Podsiadlo Product Marketing Manager Cypress Semiconductor Single-Chip, Internal.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
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.
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
MICROPROCESSOR INPUT/OUTPUT
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
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.
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
LWIP TCP/IP Stack 김백규.
2007 Oct 18SYSC2001* - Dept. Systems and Computer Engineering, Carleton University Fall SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
Renesas Electronics America Inc. RX USB Peripheral The Renesas RX USB peripheral a.k.a. USBC_597IP_PP Ver
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Ethernet Driver Changes for NET+OS V5.1. Design Changes Resides in bsp\devices\ethernet directory. Source code broken into more C files. Native driver.
I/O management is a major component of operating system design and operation Important aspect of computer operation I/O devices vary greatly Various methods.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
UDI Tutorial & Driver Walk-Through Part 1 Kurt Gollhardt SCO Core OS Architect
RL78 Code & Dataflash.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
1 Presented By: Eyal Enav and Tal Rath Eyal Enav and Tal Rath Supervisor: Mike Sumszyk Mike Sumszyk.
Updates and Common Questions Asked by Simulation Developers Peter Shier Architect Windows Devices and Storage Technologies
Organisasi Sistem Komputer Materi VIII (Input Output)
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.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Intel Open Source Technology Center Lu Baolu 2015/09
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
بسم الله الرحمن الرحيم MEMORY AND I/O.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
LonWorks Introduction Hwayoung Chae.
1394 H/W and OHCI Gi-Hoon Jung. 2002/01/162 Agenda Overview of the VITANA board OHCILynx PCI-based Host Controller Overview of the OHCI Spec.
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
USB The topics covered, in order, are USB background
Cypress CY3663 Development Kit
Operating Systems (CS 340 D)
Group Manager – PXI™/VXI Software
The PCI bus (Peripheral Component Interconnect ) is the most commonly used peripheral bus on desktops and bigger computers. higher-level bus architectures.
NS Training Hardware.
USB-Microcontroller C540U Family
CSCI 315 Operating Systems Design
Computer System Overview
Bus-Based Computer Systems
Operating Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
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:

October 11, 20001

2 Firmware for USB 2.0 Ryan Augustin Netchip Technology, Inc

October 11, Agenda USB 2.0 device-side programming w New USB 2.0 features: a programmer’s glossary w Choosing a chip from a programmer’s perspective w Performance: fast transfers, race conditions w Development aids: – Standard tools (USB analyzer) – Manufacturer’s Tools and support w Your “Rev 1” board: Tips, hints, steps to success

October 11, USB 2.0 Glossary, Features – For the Chip Programmer Glossary w CHIRP- Device/host: Who’s 2.0, who’s 1.1? w PING- Better way to NAK OUT packets w Micro-frame- 8 micro-frames per frame w?-w?-w?-w?- USB 2.0 features for chip programmers w 480 Mbit/s- 40 times faster than USB 1.1 w Bulk/Int: 512- Bulk and Interrupt MaxPkt now 512 w ISO: ISO MaxPkt now 1024 (up to 3 per micro frame)

October 11, USB 2.0 Max Packet Size 1024 (1,2 or 3 per µframe) 1023 (one per frame) ISO 64 8, 16, 32, 64 CONTROL (bMaxPacketSize0) 512 / , 16, 32, 64 BULK / INTERRUPT USB 2.0 USB 1.1 wMaxPacketSize

October 11, Choosing a Chip – Programmers Perspective Get involved choosing the chip w Understand the hardware designer’s restrictions w Understand your task w Can the chip help you and the HW designer? – Pitfalls: e.g. The “endianism” problem w Can the chip maker help? – Development kits – Support policy

October 11, Choosing a Chip – Transfers and Hardware w Programmed I/O (Firmware transfer loop): – Transfer Rate: One pass of a “for” loop – End conditions: u Packet level: How much overhead? u Transfer level: ZLPs and dribble bytes – Write samples (Surprise!) w DMA – End conditions w Deep FIFOs – The “buzz” – Double depth (2 x 512 byte) minimum – FIFO allotment

October 11, Transfer Firmware – Programmed I/O w IN and OUT transfer firmware: – Interrupt handlers – Arbitrary length transfers (zero to a zillion+1) – Fast! (any type: Iso, Bulk, Interrupt, Control) w Critical considerations: – End of Transfer handling: Short Packets and ZLPs – Handling asynchronous nature of the USB – “Dribble” bytes (on 16 and 32 bit CPUs)

October 11, Transfer Firmware – IN Transfer Usb_Interrupt(): For arbitrary length IN transfer w Read IntStat – Which endpoint interrupted? w Write EpStat – Re-arm endpoint interrupt w Read EpStat – Check for Short Packet u (Short packet? Finish and return) w Read EpCount – Get available FIFO space w Copy – “for” loop w Return from Interrupt u Deep FIFOs

October 11, Transfer Firmware – OUT Transfer Usb_Interrupt(): For arbitrary length OUT transfer w Read IntStat – Which endpoint interrupted? w Write EpStat – Re-arm endpoint interrupt w Read EpCount– Get FIFO count (in bytes) w Read EpStat– Check for Short Packet u (Short Packet? Re-read EpCount) w Copy – “for” loop (32-bit) w Return from Interrupt u Short Packet (ZLP) detection u NAK OUTs after Short Packet

October 11, Transfer Firmware – Summary w Write critical transfer code to find weak spots – ZLPs – Dribble bytes – Race conditions w See for yourself: Get a development kit

October 11, Development Kits USB 2.0 Host USB 2.0 “Device” USB Cable NET2290 Development Kit for a USB 2.0 device PCI card with NET2290 Plugged into Windows PC

October 11, Development Kits – Highlights w Goals of the kit: – Show the chip in action – Provide a good HW platform for learning firmware – Provide “Ready to port” sample source code w Allows development without hardware: – Develop your firmware without hardware – Develop host drivers and apps without hardware – Prove concepts without hardware w Includes host-side and device-side tools

October 11, Development Kits – Device-Side Software Tools USB device-side monitor application w Interactive and intuitive w Comprehensive command set w Full control of: – Chip register content – Transfer content (fill, copy, compare, …) – Transfer size – EP0: Standard, Vendor Specific; Read and Write w Multiple commands w Can you repeat that?

October 11, Development Kits – Host-Side Software Tools USB Host-Side Monitor Application w Interactive and intuitive w Comprehensive command set w Full control over transfers: – Transfer content (fill, copy, compare, …) – Transfer size – EP0: Standard, Vendor Specific; Read and Write w Multiple commands w Can you repeat that? w Loopback tests

October 11, Your New USB 2.0 Device – Rev 1: Prototype Board w Relaxed board dimensions w Header pins w Diagnostic serial port w Room for emulator pod (if applicable) w Board layout and USB signal quality

October 11, Your New USB 2.0 Device Development Environment A good development environment is priceless w Tools: – USB bus analyzer – USB host-side program w printf() w History() – Minimal run-time penalty – Simple: It stores a text key and few parameters u Example History(“TxPk”, ExpectLen, GotLen, pBuf); – Call History() anywhere in your code – Make a HISTORY() macro (add or remove at compile time) – Examine History memory after problem occurs

October 11, Your New USB 2.0 Device – History() Module typedef struct _HISTORY_BUF { char* Text; Arg1; Arg2; Arg3; } HISTORY_BUF #define HISTORY_ENTRIES 1000// Number of historical events static HISTORY_BUF HistoBuf[HISTORY_ENTRIES];// History is recorded here static HistoryCount = 0;// Current historical event void History(char * Text, Arg1, Arg2, Arg3) { memcpy(&HistoBuf[HistoryCount].Text, Text, 4);// Text key (E.g. “TxCo” HistoBuf[HistoryCount].Arg1 = Arg1; HistoBuf[HistoryCount].Arg2 = Arg2; HistoBuf[HistoryCount].Arg3 = Arg3; HistoryCount++;// Prepare for next event if (HistoryCount >= HISTORY_ENTRIES) { if (HistoryCount >= HISTORY_ENTRIES) { HistoryCount = 0;// History rewrites itself } memset(&HistoBuf[HistoryCount], 0, sizeof(HISTORY_BUF));// “Easy to spot” terminator }

October 11, Your New USB 2.0 Device – Bringing up the Board Take small steps! w Prove register access w Prove interrupt subsystem w Vendor Specific enumeration w Basic IN and OUT transfers w Loopback transfers w Special transfers w Special enumeration

October 11, Your New USB 2.0 Device – Enumeration w Everything has to work at the same time w You can’t single step (except PDK) w Things that can cause enumeration failures: – Set Address request (gotcha!) – Signal quality – Descriptor content … and plenty more! w Use Vendor Specific enumeration first

October 11, Your New USB 2.0 Device: - Bringing up the Board Take small steps! w Prove register access w Prove interrupt subsystem w Vendor Specific enumeration w Basic IN and OUT transfers w Loopback transfers w Special transfers (Control, ISO, Interrupt) w Special enumeration (for class devices) Debugger “Gotcha”

October 11, NET2290 – A Few Special Features w Built-in Standard Request handlers “Automatic Enumeration” Class devices must handle Get Configuration w Self configuring FIFOs w Ready signal on FIFO access … and more!

October 11, ? ? Question and Answers ? ? ? ? ? ? ? ? ? ? ? ? ? ?

October 11, Thank You! From Ryan Augustin and… NetChip Technology, Inc.