Presentation is loading. Please wait.

Presentation is loading. Please wait.

7-1 Lecture 7 Agenda Isochronous Transfers Using HID with Visual BASIC Resources Demo USB Diagnostic Tools USBCheck HIDCheck USB 2.0.

Similar presentations


Presentation on theme: "7-1 Lecture 7 Agenda Isochronous Transfers Using HID with Visual BASIC Resources Demo USB Diagnostic Tools USBCheck HIDCheck USB 2.0."— Presentation transcript:

1 7-1 Lecture 7 Agenda Isochronous Transfers Using HID with Visual BASIC Resources Demo USB Diagnostic Tools USBCheck HIDCheck USB 2.0

2 7-2 Isochronous Transfers

3 7-3 Isochronous Transfers (1 of 3)

4 7-4 TRM Chapter 8 Set the ISO endpoint valid bits  INISOVAL (0x7FE0), OUTISOVAL (0x7FE1) Set up the FIFO sizes  Use OUTnADDR registers  These set the starting addresses for the ISO FIFOS  Size is allocated in increments of 16 bytes  All ISO endpoints share 1024 bytes of FIFO memory  Start address (SA) register format: A9 A8 A7 A6 A5 A4 0 0 (0 0)  Example1: EP8IN=512, EP8OUT=512 IN8ADDR = 0 OUT8ADDR = 512 = 1000000000, SA=10000000=0x80 Isochronous Transfers (2 of 3)

5 7-5 ISO data available as FIFO, not RAM  16 FIFO data registers: OUT8DATA, OUT9DATA,... OUT15DATA IN8DATA, IN9DATA,... IN15DATA One USB interrupt for all ISO endpoints  SOF, every millisecond SOF_ISR should read/write ISO fifo data Set DPTR to the endpoint, then execute multiple ‘movx’ instructions  Don’t need to increment DPTR each access Example code on TRM page 8-8 (Fig 8-6) Isochronous Transfers (3 of 3)

6 7-6 Using HID with Visual BASIC

7 7-7 Read Axelson Chapter 16  “Human Interface Devices: Host Application Example  Shows code for both VB and VC++ First edition of the book had a CD, Second edition does not Go to lvr.com, download ‘usbhidio’  Unpack it  VisualBasic folder has VB Project (usbhidio.vbp) In project ‘Modules’ folder: ApiDeclarations.bas  Contains VB declarations to allow VB to make C-style API calls VB application code in ‘frmMain.frm’ Change VID and PID values to 0547/7450: 'Set these to match the values in the device's firmware and INF file. Const MyVendorID = &H547 Const MyProductID = &H7450 VB-HID Development Steps host side

8 7-8 Keil project: gpHID.uv2  fw2HID.c (from last session)  gpHID_descriptors.a51 INT-IN and INT-OUT endpoints Report descriptor specifies 2-byte in and out reports Compile and load the code Start the debugger  First time: you’ll see the “HID Device Found” box  Readout should start incrementing VB-HID Development Steps device side

9 7-9 Run the VB code  It should find the device  Then Allows you to send two-byte out reports First byte is readout increment rate Second byte is decimal point  Shows the results of two-byte input reports First byte is current digit Second byte is pushbutton states VB-HID Development Steps both sides

10 7-10 My Customization based on Jan’s code

11 7-11 A VB HID Test Control Panel Click

12 7-12 Sending an OUTPUT Report The PC Side SendBuffer(0) = 0 ‘ The first byte is the Report ID SendBuffer(1) = 31 - hsRate.Value ' next 2 bytes are data--rate SendBuffer(2) = dp ' decimal point NumberOfBytesWritten = 0 Result = WriteFile _ (HidDevice, _ SendBuffer(0), _ CLng(Capabilities.OutputReportByteLength), _ NumberOfBytesWritten, _ 0)

13 7-13 Sending an OUTPUT Report The Peripheral Side if(!(OUT1CS & bmEPBUSY))// Is there something available? { timeconst = OUT1BUF[0]*20;// Output Report Byte 0 is time // const (tenths of sec) dp = OUT1BUF[1];// decimal point OUT1BC = 0;// Re-arm EP1-OUT IN1BUF[0] = count; IN1BUF[1] = buttons; IN1BC = 2;// arm the EP2-IN transfer }

14 7-14 Reading an INPUT Report The PC Side Result = ReadFile _ (HidDevice, _ ReadBuffer(0), _ CLng(Capabilities.InputReportByteLength), _ NumberOfBytesRead, _ 0) tb7SEG = Hex$(ReadBuffer(1)) ' put first byte value into text box (7-seg value) readval = ReadBuffer(2) ' get button states

15 7-15 Reading an INPUT Report The Peripheral Side if(!(OUT1CS & bmEPBUSY))// Is there something available? { timeconst = OUT1BUF[0]*20;// Output Report Byte 0 is time // const (tenths of sec) dp = OUT1BUF[1];// decimal point OUT1BC = 0;// Re-arm EP1-OUT IN1BUF[0] = count; IN1BUF[1] = buttons; IN1BC = 2;// arm the EP2-IN transfer }

16 7-16 USB Diagnostic Tools

17 7-17 USB Diagnostic Tools USBCheck Tests for Chapter 9 Compliance Tricky to use HIDView Tests HID devices Tricky to use

18 7-18 USBCheck Versions OS USBCheck Version USBDiag.sys Version Controller Win98 Gold 2.94.10.1706UHCI Win98 SE 3.25.00.1868.1UHCI Win98 SE 3.25.10.1868.1OHCI

19 7-19 USBCheck Order is critical Start USBCheck Start up your ReNumerating 8051 code Exit program, then physically disconnect your device

20 7-20 USBCheck Don’t start HIDView from here. Instead, quit USBCheck, unplug your device, then launch HIDView as a separate program.

21 7-21 HIDView

22 7-22 HIDView Ready to roll

23 7-23 USB 2.0

24 7-24 USB 2.0 in a Nutshell Runs 40X faster than USB 1.1  Low speed: 1.5Mb/s  Full speed: 12Mb/s  High speed: 480Mb/s Fully supports existing USB devices  Forward compatible—plug existing 1.1 devices into new 2.0 hosts  Backward compatible—plug new 2.0 devices into existing 1.1 hosts Uses the same cables as USB 1.1

25 7-25 USB 2.0 Hub Magic PC USB 2.0 1.1 Hub USB FS Device FS Device 12 MBits/sec shared between devices 2.0 Hub USB FS Device FS Device 12 MBits/sec per device HS Device

26 7-26 USB 2.0 Specification Revision 2.0, April 27, 2000 622 pages Full spec available at: www.usb.org/developers/docs.html

27 7-27 Cable Magic USB 1.1 D+ / D– 45 3.3V

28 7-28 Cable Magic USB 2.0 D+ / D– 17 ma 400 mV 45

29 7-29 S O F 3 2 7 S O F 3 2 8 1 msec ISO (~1000) BULK (64) USB 1.1 Bandwidth CTL (64)

30 7-30 S O F 3 2 7 S O F 3 2 8 USB 2.0 Bandwidth S O F 3 2 7 S O F 3 2 7 S O F 3 2 7 S O F 3 2 7 S O F 3 2 7 S O F 3 2 7 S O F 3 2 7 125 usec 1 msec S O F 3 2 7 S O F 3 2 7 1024 S O F 3 2 7 S O F 3 2 7 512 64 1024 512 ISO INT BULK 512 CTL 64

31 7-31 Packet Sizes Control Bulk Interrupt Isochronous 8, 16, 32, 64 1–64 1023 64 512 1024 USB 1.1USB 2.0 Transfer TypePacket Size

32 7-32 USB 2.0 13 Bulk packets per microframe max 13 * 512 * 8 * 1000 = 53 MB/s Bandwidth Example: ATA Hard Drive 7200 RPM, 512 Kbyte Internal Buffer Internal data transfer rate: 40MB/s Avg. sustained transfer rate: 15 MB/s Channel rate: 66.6MB/s

33 7-33 USB Host Buffer Head 40 Disk Drive USB 2.0 Controller USB6020–50IF 15 Sustained Bandwidth Analysis: USB Hard Drive

34 7-34 Bandwidth Conclusions Both sides, USB and Interface, must support high bandwidth USB Large endpoint buffers At least double buffering Interface Internal processor should not touch 480 Mbit/sec data. Use the CPU for USB housekeeping & I/O.  Optimize the data channel using specialized logic. Fast data transfers require fast control logic.  Interface logic should be programmable  ATA, EPP, etc.

35 7-35 16 Low level protocol CRC, PID encode- decode, chirp Deliver WORDS Token Processor EP0, Ping, ACK/NAK/ STALL/ NYET "Chapter 9" Outside Interface High speed logic clock extraction serialize/ deserialize bit stuff NRZI SYNC, EOP 16 Endpoints Endpoint FIFOS & control logic 16 CPU 48 MHz 8051 Program & Data RAM Download Code Data Channel GPIF Single-Chip Solution

36 7-36 USB BW: Endpoint Buffers

37 7-37 Endpoint FIFOS Microprocessor USB Outside World (a) Low to Medium Speed Data Transfer Speed Evolution

38 7-38 Data Transfer Speed Evolution Endpoint FIFOS Interface FIFO DMA USB Outside World (b) Faster Microprocessor RAM/FIFO

39 7-39 Data Transfer Speed Evolution Endpoint FIFOS USB Outside World (c) Fastest Microprocessor RAM/FIFO

40 7-40 Making the High Bandwidth Data Available to the Outside World Don’t let the CPU be a bottleneck Use fast logic to do the transfers Some type of DMA is essential Even better--”Zero time” DMA transfers with programmable control signals GPIF = General-Purpose Interface

41 7-41 Quantum FIFO 256 x16 256 x16 256 x16 256 x16 USB 256 x16 I/O 256 x16 256 x16 256 x16 1 clock

42 7-42 Quantum FIFO 256 x16 256 x16 256 x16 USB 256 x16 I/O 256 x16 256 x16 256 x16 256 x16

43 7-43 Quantum FIFO 256 x16 256 x16 256 x16 USB 256 x16 I/O 256 x16 256 x16 256 x16 1 clock 256 x16

44 7-44 Quantum FIFO 256 x16 256 x16 256 x16 USB 256 x16 I/O 256 x16 256 x16 256 x16 256 x16

45 7-45 Quantum FIFO 256 x16 256 x16 256 x16 USB 256 x16 I/O 256 x16 256 x16 256 x16 256 x16 8051


Download ppt "7-1 Lecture 7 Agenda Isochronous Transfers Using HID with Visual BASIC Resources Demo USB Diagnostic Tools USBCheck HIDCheck USB 2.0."

Similar presentations


Ads by Google