1 / 23

October 11, 2000

October 11, 2000. 2. Firmware for USB 2.0. Ryan Augustin Netchip Technology, Incryan@netchip.com. October 11, 2000. 3. . Agenda. USB 2.0 device-side programmingNew USB 2.0 features: a programmer's glossaryChoosing a chip from a programmer's perspectivePerformance: fast transfers, race conditionsDevelopment aids:Standard tools (USB analyzer)Manufacturer's Tools and supportYour

aman
Download Presentation

October 11, 2000

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. October 11, 2000 1

    2. October 11, 2000 2 Firmware for USB 2.0 Ryan Augustin Netchip Technology, Inc ryan@netchip.com

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

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

    5. October 11, 2000 5 USB 2.0 Max Packet Size

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

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

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

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

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

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

    12. October 11, 2000 12 Development Kits

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

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

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

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

    17. October 11, 2000 17 Your New USB 2.0 Device Development Environment A good development environment is priceless Tools: USB bus analyzer USB host-side program printf() History() Minimal run-time penalty Simple: It stores a text key and few parameters 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

    18. October 11, 2000 18 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) { HistoryCount = 0; // History rewrites itself } memset(&HistoBuf[HistoryCount], 0, sizeof(HISTORY_BUF)); // “Easy to spot” terminator }

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

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

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

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

    23. October 11, 2000 23 Question and Answers

    24. October 11, 2000 24 Thank You! From Ryan Augustin and… NetChip Technology, Inc. www.netchip.com

More Related