SlideShare a Scribd company logo
2
Most read
6
Most read
16
Most read
Using the PSoC USB




       March 17, 2012
Lloyd Moore, President/Owner
Overview
 USB Background
 USB Standard Classes

 Endpoints and Transfer Types

 Enumeration

 USB Descriptors

 Example Project
USB Background
   Star topology, master / slave architecture
    • Host 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)
    •   High power: 500mA or 900mA Max (USB 2,3)
   Vendor Id, Product Id, serial number
    uniquely identify each device
Standard USB Classes
                         Audio                    Speakers, microphone,
   Used to define the                            MIDI

    USB device.          Communication (CDC)      Virtual Serial Port, modem,
                                                  Ethernet
   Standardizes         Content Security         File and resource access

    protocols and        Firmware Upgrade (DFU)   Device software upgrades

    drivers for          Human Interface (HID)    Keyboards, mice, joysticks,
                                                  barcode scanners, UPS
    common devices.      IrDA Bridge              IR communications
   Allows operating     Mass Storage             Hard drives, DVD, flash

    systems to           Personal Healthcare
                                                  memory
                                                  Heart rate, blood pressure,
    provide default                               glucose meters, ect.

    drivers.             Printer                  Printers – ya that simple!

                         Smart Card               Phone cards, keyless entry
   Can also create      Still Image Capture      Cameras, scanners
    vendor specific      Test & Measurement       ADC, DAC, sensors, etc.
    classes for custom   Video                    Video cameras, web cams
    applications.
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
Transfer Types

Type          Guarantees      Typical Use

Control       Presence,       Device id and
              Error Free      configuration
Bulk          Error Free      Printer, hard
                              drive
Interrupt     Latency         Keyboard,
              Error Free      mouse
Isochronous   Delivery rate   Streaming
                              audio & video
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.
   Communication details collected by way of
    “descriptors”
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.
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-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.
   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.
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.
   USBFS – USB 2.0 Full Speed driver, will
    configure this to be a Joystick HID device
    to send information to the PC.
Device Descriptor
   Walkthrough live configuration of
    descriptor.
Clock Configuration




     IMO = 24.000 MHz
     USB = IMOx2
     ILO = 100KHz
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
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
Resources
   Book: USB Complete, Fourth Edition
    • Jan Axelson
    • ISBN: 978-1-931448-08-6
   PSoC Application notes: AN57294, AN57473, AN58726
   PSoC Product Web Site:
    •   http://www.cypress.com/?id=1353
   PSoC Developer Community:
    • http://www.psocdeveloper.com/forums/
   PSoC Training On Demand:
    • http://www.cypress.com/training
   PSoC Full Development Kit (1, 3, 5): $249
    • http://www.cypress.com/?rID=37464
   My Contact Info:
    • Lloyd@CyberData-Robotics.com
    • http://www.CyberData-Robotics.com
Questions????

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

More Related Content

PDF
Super Pro I S01
PDF
ITFT_Peripheral devices
PPT
Computer hardware Created By :- king parmeshwar pawar
PPT
Introduction to Desktop NanoBoard NB2DSK01
PPTX
Computer configuration
PPTX
Comp tia flashcards set 2 (25 cards) cpu erd
PPTX
Expansion cards
PPTX
Advance peripheral devices
Super Pro I S01
ITFT_Peripheral devices
Computer hardware Created By :- king parmeshwar pawar
Introduction to Desktop NanoBoard NB2DSK01
Computer configuration
Comp tia flashcards set 2 (25 cards) cpu erd
Expansion cards
Advance peripheral devices

What's hot (20)

PPTX
Computer Basics
PPTX
Computer
PPT
Computer hardware-ports-connectors
PPTX
Internal components - Technical
PPTX
Building a computer in virtual desktop.
PDF
BadUSB — On accessories that turn evil by Karsten Nohl
PDF
Computer Devices that are Both Input & Output Devices
DOCX
Computer components checklist
PDF
BAD USB 2.0
PDF
Hardware basics: peripherals
PPSX
10. GPU - Video Card (Display, Graphics, VGA)
PPTX
Input devices , output devices & storage devices
PDF
Mcomputing l130-l230[ncomputing.123vietnam.vn]
PPSX
2018 all lens bag of tricks v1.2
PPTX
input & output devices
PPTX
project on input output devie
PPT
Computer System
PPTX
Peripheral devices
PDF
BadUSB, and what you should do about it
Computer Basics
Computer
Computer hardware-ports-connectors
Internal components - Technical
Building a computer in virtual desktop.
BadUSB — On accessories that turn evil by Karsten Nohl
Computer Devices that are Both Input & Output Devices
Computer components checklist
BAD USB 2.0
Hardware basics: peripherals
10. GPU - Video Card (Display, Graphics, VGA)
Input devices , output devices & storage devices
Mcomputing l130-l230[ncomputing.123vietnam.vn]
2018 all lens bag of tricks v1.2
input & output devices
project on input output devie
Computer System
Peripheral devices
BadUSB, and what you should do about it
Ad

Similar to PSoC USB HID (20)

PPTX
Bus interface 8086
PDF
An1003 usb
ODP
Philip polstra
PPT
Usb 72213 76207
PPT
USB BASIC
PPTX
Peripherals
PPT
Choosing_(and_Implem..
PPTX
Advance of usb
PPT
Usb Overview
PDF
CSE491_Computer_Interfacing_and_Peripherals_Lec1.pdf
PDF
Linux usb2ether
PDF
USB Complete Everything You Need to Develop Custom USB Peripherals Third Edit...
PPTX
Usb protocol
PDF
USB: Undermining Security Barriers
PPT
13. Computer Systems Input And Output Architecture
PDF
Chapter II - Computer Hardware Components & Peripherals.pdf
PDF
Chapter II - Computer Hardware Components & Peripherals.pdf
Bus interface 8086
An1003 usb
Philip polstra
Usb 72213 76207
USB BASIC
Peripherals
Choosing_(and_Implem..
Advance of usb
Usb Overview
CSE491_Computer_Interfacing_and_Peripherals_Lec1.pdf
Linux usb2ether
USB Complete Everything You Need to Develop Custom USB Peripherals Third Edit...
Usb protocol
USB: Undermining Security Barriers
13. Computer Systems Input And Output Architecture
Chapter II - Computer Hardware Components & Peripherals.pdf
Chapter II - Computer Hardware Components & Peripherals.pdf
Ad

More from LloydMoore (15)

PPTX
Free / Open Source C++ Static Analysis Tools
PPTX
Chosing The Right Language for your project
PDF
Cuda Without a Phd - A practical guick start
PPTX
Less Magical Numbers - A coding standard proposal
PPTX
Debugging Intermittent Issues - A How To
PPTX
Successful Software Projects - What you need to consider
PPTX
A Slice Of Rust - A quick look at the Rust programming language
PPTX
What Have We Lost - A look at some historical techniques
PPTX
Raspberry pi robotics
PPTX
High Reliabilty Systems
PPTX
Real Time Debugging - What to do when a breakpoint just won't do
PPT
Using PSoC Creator
PPT
Using the Cypress PSoC Processor
PPT
C for Microcontrollers
PPTX
Starting Raspberry Pi
Free / Open Source C++ Static Analysis Tools
Chosing The Right Language for your project
Cuda Without a Phd - A practical guick start
Less Magical Numbers - A coding standard proposal
Debugging Intermittent Issues - A How To
Successful Software Projects - What you need to consider
A Slice Of Rust - A quick look at the Rust programming language
What Have We Lost - A look at some historical techniques
Raspberry pi robotics
High Reliabilty Systems
Real Time Debugging - What to do when a breakpoint just won't do
Using PSoC Creator
Using the Cypress PSoC Processor
C for Microcontrollers
Starting Raspberry Pi

Recently uploaded (20)

PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Hybrid model detection and classification of lung cancer
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPTX
Tartificialntelligence_presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
project resource management chapter-09.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
August Patch Tuesday
PPTX
cloud_computing_Infrastucture_as_cloud_p
A novel scalable deep ensemble learning framework for big data classification...
Hybrid model detection and classification of lung cancer
SOPHOS-XG Firewall Administrator PPT.pptx
1. Introduction to Computer Programming.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Web App vs Mobile App What Should You Build First.pdf
Zenith AI: Advanced Artificial Intelligence
MIND Revenue Release Quarter 2 2025 Press Release
Enhancing emotion recognition model for a student engagement use case through...
Tartificialntelligence_presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
WOOl fibre morphology and structure.pdf for textiles
project resource management chapter-09.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
DP Operators-handbook-extract for the Mautical Institute
A comparative study of natural language inference in Swahili using monolingua...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
August Patch Tuesday
cloud_computing_Infrastucture_as_cloud_p

PSoC USB HID

  • 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 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) • High power: 500mA or 900mA Max (USB 2,3)  Vendor Id, Product Id, serial number uniquely identify each device
  • 4. Standard USB Classes Audio Speakers, microphone,  Used to define the MIDI USB device. Communication (CDC) Virtual Serial Port, modem, Ethernet  Standardizes Content Security File and resource access protocols and Firmware Upgrade (DFU) Device software upgrades drivers for Human Interface (HID) Keyboards, mice, joysticks, barcode scanners, UPS common devices. IrDA Bridge IR communications  Allows operating Mass Storage Hard drives, DVD, flash systems to Personal Healthcare memory Heart rate, blood pressure, provide default glucose meters, ect. drivers. Printer Printers – ya that simple! Smart Card Phone cards, keyless entry  Can also create Still Image Capture Cameras, scanners vendor specific Test & Measurement ADC, DAC, sensors, etc. classes for custom Video Video cameras, web cams applications.
  • 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 Type Guarantees Typical Use Control Presence, Device id and Error Free configuration Bulk Error Free Printer, hard drive Interrupt Latency Keyboard, Error Free 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.  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-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.  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.  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 Axelson • ISBN: 978-1-931448-08-6  PSoC Application notes: AN57294, AN57473, AN58726  PSoC Product Web Site: • http://www.cypress.com/?id=1353  PSoC Developer Community: • http://www.psocdeveloper.com/forums/  PSoC Training On Demand: • http://www.cypress.com/training  PSoC Full Development Kit (1, 3, 5): $249 • http://www.cypress.com/?rID=37464  My Contact Info: • Lloyd@CyberData-Robotics.com • http://www.CyberData-Robotics.com
  • 16. Questions????  Will be around a bit after the meeting for individual questions  Feel free to e-mail me