Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the PSoC USB March 17, 2012 Lloyd Moore, President/Owner.

Similar presentations


Presentation on theme: "Using the PSoC USB March 17, 2012 Lloyd Moore, President/Owner."— Presentation transcript:

1 Using the PSoC USB March 17, 2012 Lloyd Moore, President/Owner

2 Overview  USB Background  USB Standard Classes  Endpoints and Transfer Types  Enumeration  USB Descriptors  Example Project

3 USB Background  Star topology, master / slave architecture Host is the master, initiates all communicationsHost is the master, initiates all communications  Multiple speeds: Low=1.5Mbps, Full=12 Mbps, High=480Mbps, Super=5Gbps  Self powered vs. Bus powered Low power: 100mA or 150mA Max (USB 2,3)Low power: 100mA or 150mA Max (USB 2,3) High power: 500mA or 900mA Max (USB 2,3)High power: 500mA or 900mA Max (USB 2,3)  Vendor Id, Product Id, serial number uniquely identify each device

4 Standard USB Classes  Used to define the USB device.  Standardizes protocols and drivers for common devices.  Allows operating systems to provide default drivers.  Can also create vendor specific classes for custom applications. Audio Speakers, microphone, MIDI Communication (CDC) Virtual Serial Port, modem, Ethernet Content Security File and resource access Firmware Upgrade (DFU) Device software upgrades Human Interface (HID) Keyboards, mice, joysticks, barcode scanners, UPS IrDA Bridge IR communications Mass Storage Hard drives, DVD, flash memory Personal Healthcare Heart rate, blood pressure, glucose meters, ect. Printer Printers – ya that simple! Smart Card Phone cards, keyless entry Still Image Capture Cameras, scanners Test & Measurement ADC, DAC, sensors, etc. Video Video cameras, web cams

5 Endpoints  Uniquely addressable portion of a USB device.  4 end points max for a low speed device, 16 for other speeds  End point 0 is special, must be present and is used for enumeration and control  Data transfer happens at end points.  Simplest way to think about an end point is that it provides an addressable buffer to send and receive data.  IN refers to dataflow TO the Host  OUT refers to dataflow FROM the Host

6 Transfer Types TypeGuaranteesTypical Use ControlPresence, Error Free Device id and configuration Bulk Error Free Printer, hard drive InterruptLatency Error Free Keyboard, mouse Isochronous Delivery rate Streaming audio & video

7 Enumeration  Process by which the host discovers what devices are connected and the properties of those devices.  Utilizes a series of resets and Control transfers to end point 0.  Each device given a unique address between 1 and 127.  Power and bandwidth requirements are collected and allocated. Device will not be “connected” if resources are not available.Device will not be “connected” if resources are not available.  Communication details collected by way of “descriptors”

8 Descriptors  Data structures which allow the host to learn about a device and how to communicate with it.  Essentially a language which defines the protocol between the host and each device.  Can be quite complex but standard descriptors are well defined.  Standard device drivers can interpret these for a wide range of devices.

9 Example Project  Configure a PSoC 5 to send data from the CapSense buttons and slider to a PC in the form of a joystick.  Will be using the CY8CKIT-001, and PSoC Creator 1.0 for this demo. Upgraded LCD display Lumex LCM-S02004DSRUpgraded LCD display Lumex LCM-S02004DSR If using PSoC Creator 2.0 will also need to add 24Mhz crystal to bottom of processor module due to a tighter clock requirement.If using PSoC Creator 2.0 will also need to add 24Mhz crystal to bottom of processor module due to a tighter clock requirement.  Data will be shown on LCD as well as sent to PC.  Will be using a “canned” set of code as the configuration is pretty time consuming.

10 Hardware Configuration  DebugLcd used to control the LCD display  CapSense will run the CapSense buttons and slider control for input Heavy filtering here as the demo board USB spews lots of noise to CapSense when running.Heavy filtering here as the demo board USB spews lots of noise to CapSense when running.  USBFS – USB 2.0 Full Speed driver, will configure this to be a Joystick HID device to send information to the PC.

11 Device Descriptor  Walkthrough live configuration of descriptor.

12 Clock Configuration IMO = 24.000 MHz USB = IMOx2 ILO = 100KHz

13 USB Initialization Code  USBFS_Start() configures the hardware  Next we wait while the USB device goes through enumeration  Finally prepare the first set of data to be dropped to the host when requested

14 Main Loop  General operational pattern is to wait for Host to grab data currently at the end point, then replace it.  USBFS_bGetEPAckState() waits for grab  USBFS_LoadInEP() loads next batch of data to be grabbed by the host

15 Resources  Book: USB Complete, Fourth Edition Jan AxelsonJan Axelson ISBN: 978-1-931448-08-6ISBN: 978-1-931448-08-6  PSoC Application notes: AN57294, AN57473, AN58726  PSoC Product Web Site: http://www.cypress.com/?id=1353 http://www.cypress.com/?id=1353http://www.cypress.com/?id=1353  PSoC Developer Community: http://www.psocdeveloper.com/forums/http://www.psocdeveloper.com/forums/http://www.psocdeveloper.com/forums/  PSoC Training On Demand: http://www.cypress.com/traininghttp://www.cypress.com/traininghttp://www.cypress.com/training  PSoC Full Development Kit (1, 3, 5): $249 http://www.cypress.com/?rID=37464http://www.cypress.com/?rID=37464http://www.cypress.com/?rID=37464  My Contact Info: Lloyd@CyberData-Robotics.comLloyd@CyberData-Robotics.comLloyd@CyberData-Robotics.com http://www.CyberData-Robotics.comhttp://www.CyberData-Robotics.comhttp://www.CyberData-Robotics.com

16 Questions????  Will be around a bit after the meeting for individual questions  Feel free to e-mail me


Download ppt "Using the PSoC USB March 17, 2012 Lloyd Moore, President/Owner."

Similar presentations


Ads by Google