© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 1
1640 USB1
Introduction to
Microchip USB Solutions
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 2
Objectives
When you finish this class you will be able to:
Describe the basics of USB, and how apply them in an embedded application
Identify Microchip’s USB MCUs, development boards, and USB software frameworks relevant to your project
Chose the right USB MASTERs classes you need to attend
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 3
Agenda
USB Fundamentals
Microchip USB solutions
Design considerations
How to get started
Summary
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 4
Universal Serial Bus
Extend the functionality of
your computer!
Data Analysis,
Data Logging,
Firmware Updates,
Diagnostics,
Embedded Applications!
• Auto detection & configuration (Plug & Play)
• Easy expansion using hubs
• Bus power
• Data CRC protected, bad packets resent
• Four speeds:
Low- 1.5, Full- 12, High- 480, Super- 5000 Mb/s
Serial
Parallel
PS/2
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 5
Agenda
USB Fundamentals
Microchip USB solutions
Design considerations
How to get started
Summary
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 6
USB Basics USB is a “Single Master + Multiple Slaves” polled bus
Mouse Speakers Printer
USB Host Controller (Master)
and Root Hub
Frame Frame Frame
Start Of Frame Mouse Packets Speakers Packets Printer Packets
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 7
USB Host
Manages and controls the bus
Initiates all communications
Automatically detects all device insertions and extractions
Enumerates all devices connected and matches them with drivers
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 8
Typical MCU Requirements for Host
Typically Host is a PC
USB 3.0 Host Controller, running at Full Speed (12 Mbps) or High Speed (480 Mbps) or Super Speed (5 Gbps)
High throughput 32/64 bit CPU running a Operating System like Windows®
USB Drivers identifying and enumerating USB Devices
Automatic update of USB drivers
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 9
Host in Embedded Design
Alternative: Implement PC in an MCU High Cost, Larger real estate
Overkill for Embedded Designs
Solution: Implement Embedded Host
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 10
Embedded Host
Embedded Host connects to a fixed number of USB Peripheral Devices – USB Drivers fixed in firmware
Advantage: Smaller, less complex embedded firmware
Example: Remote Temperature Data Logger Download data to USB Flash Drive
Not connected directly to PC Host but …
You can exchange data with PC Host using the Flash Drive
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 11
Typical Requirements for Embedded Host
Peripherals to service real world I/O:
A/D converters, Comparators, etc.
Serial Interfaces like SPI, I2C™, UART
PWMs, Timers and I/O lines
Full Speed (12 Mbps) USB 2.0 Transceiver with data input/output buffers
High throughput 16/32-bit MCU
Host Firmware Drivers to identify and enumerate USB Peripheral Devices
Microchip’s 16 and 32 bit USB PIC® MCUs are designed for Embedded Host applications
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 12
USB 2.0 vs USB 3.0
Microchip USB MCUs support USB 2.0 full-speed or low-speed
USB 3.0 devices are supported at full-speed (12Mbps)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 13
USB Peripheral Device
Responds to Host, cannot initiate transactions
Requires drivers to be recognized by the Host
Hardware/Firmware to respond to Host
Microchip’s PIC® MCUs are used in USB Peripheral Devices
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 14
Typical MCU Requirements for Peripheral Device
Peripherals to service real world I/O: A/D converters, Comparators, etc.
Serial Interfaces like SPI, I2C™, UART
PWMs, Timers and I/O lines
Full Speed (12 Mbps) USB 2.0 Transceiver with data input/output buffers
Throughput to service Full speed USB requests
USB Device and peripheral interface Firmware
All USB PIC® MCUs are designed for USB Peripheral Device applications
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 15
USB On-The-Go (OTG)
USB On-The-Go (OTG) allows Application to operate as Host or Device: PDA (Device) connected to PC (Host)
PDA (Host) connected to Thumb drive (Device)
PDA connected to PDA, host and device roles can switch (OTG mode)
PDA OTG Host
PDA OTG Device
PC Host PDA OTG Host
PDA OTG Device Thumb Drive
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 16
Typical Requirements for OTG Devices
Peripherals to service real world I/O:
A/D converters, Comparators, etc.
Serial Interfaces like SPI, I2C™, UART
PWMs, Timers and I/O lines
Full Speed (12 Mbps) USB 2.0 OTG Transceiver with data input/output buffers
High throughput 16/32-bit MCU
Host Software Drivers to identify and enumerate USB Peripheral Devices Device Drivers when connected to Host/OTG
Microchip’s 16 and 32-bit USB PIC® MCUs are designed for USB OTG applications
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 17
Other USB Device Types
Hub Repeats traffic (both directions), manages power
Compound Device Contains a hub and 1 or more peripherals
Host treats hub and peripheral function separately (each has its own address) i.e. USB keyboard with 1-port hub
Composite Device Has multiple interfaces active at the same time
Host loads a driver for each interface i.e. video camera (both audio & video interfaces active)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 18
MCP2200: USB to UART Serial Converter
Enables USB connectivity in applications with UART
Pre-programmed USB stack
Easy to configure
USB 2.0 Compliant
Full-speed USB
USB activity LED outputs
Fully configurable
VID and PID assignments
Easiest way to add USB to your design
UART
Controller
EEPROM
Control USB Protocol
Controller
USB
Transceiver
USB LEDs GPIO
LDO, Osc,
Reset
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 19
MCP2210: USB-to-SPI Master Converter
Enables USB connectivity in applications with SPI interface
Enumerate as HID device
Easy to configure
USB 2.0 Compliant
Full-speed USB
USB activity LED outputs
Fully configurable
VID and PID assignments
Easiest way to add USB to your design
SPI interface
(Master)
EEPROM
Control USB Protocol
Controller
USB
Transceiver
USB LEDs GPIO
LDO, Osc,
Reset
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 20
Dual Role Devices (DRDs)
Allows application to operate as Host or Device: 2 connectors (Standard A & B or mini B or micro B)
Must have some type of mechanical block so that both connectors are not accessible at any given point of time
No need to dynamically switch the role, connector used decides which is the role
Example: Data Logger with field update via PC
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 21
PIC24F or PIC32MX
USB device
Embedded
Host
Receptacle
DRD Example Circuit
VBUS
D+
D-
GND
5v
PPTC
A/D
VBUS
D+
D-
VUSB
2KΩ
2KΩ
150μF
1μF
3.3v
Input
Peripheral
Receptacle
VBUS
D+
D-
GND
1μF 150KΩ
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 22
Physical Interface
Half Duplex with NRZI Data Encoding
Bus Power to each device: 4.40 - 5.25 V
Guaranteed 100 mA
500 mA maximum through negotiation
~ 5.0 V
~ 3.3 V
Must use external
power if more is
required
VBUS
D+
D-
GND
VBUS
D+
D-
GND
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 23
“mini-B”
USB
Device
“B”
USB
Device
Standard Connectors
“A”
USB Host
Full or Embedded
“micro-B”
USB
Device
“micro-AB”
OTG
Device
μB μB
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 24
“mini-B”
USB
Device
“B”
USB
Device
Standard Connectors
“micro-AB”
OTG
Host
“micro-B”
USB
Device
μB
μA
“micro-AB”
OTG
Device
“micro-AB”
OTG
Host
μB
μA
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 25
Physical Bus Topology
USB Host Controller
& Root Hub
Hub Speaker
Logic
Analyzer
Up to 126 peripherals...
Keyboard
Hub: Max Chaining = 5
8-bit USB PIC® MCUs are
designed to be peripherals
16- and 32-bit USB PIC
MCUs and dsPIC® DSCs
can function as either
embedded hosts or
peripherals
Host (Tier 1)
Tier 2
Tier 3
Tier 4
Tier 5
Tier 6
Tier 7
Hub
Hub
Hub
Hub
Hub Data Logger
Printer
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 26
Logical Bus Topology
Not a tiered-star!
Host software communicates to each “logical” device as if it were directly connected to the root hub
Host
Logical
Device
Logical
Device
Logical
Device
Logical
Device Logical
Device
Logical
Device
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 27
Host System Peripheral Device
Physical Communication Path
Logical Communication Path (“Pipe”)
USB Device Framework - Software View of Hardware -
Bu
s In
terf
ace
La
ye
r
Bu
s In
terfa
ce
La
ye
r
USB Bus
Interface SIE
USB Bus Interface
SIE Host
Controller
USB Cable Transactions
Function Function
Function
Fu
nctio
n L
aye
r F
un
ctio
n L
aye
r
Interface Client
Software
Client
Software
Client
Software
Pipe Bundle
Buffers Interface-specific
US
B D
evic
e
La
ye
r U
SB
De
vic
e
La
ye
r
USB Logical
Device Endpoint
zero
USB System
Software Default Pipe (EP0)
Transfers Data per Endpoint
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 28
Endpoints: Source/Destination of USB Data in a Peripheral
RAM
Endpoint 1 OUT
RAM
Endpoint 1 IN
Data Bucket
LED
“Caps-Lock”
Maximum number of endpoints per device specified by USB specification:
16 OUT endpoints + 16 IN endpoints = 32 endpoints
PIC18F87J50, PIC18F4550, PIC24F, PIC32MX supports up to 32 endpoints
PIC18F14K50 supports up to 16 endpoints
EP0 = Default Communication Pipe
USB framed data
USB framed data
USB PIC® MCU
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 29
The “Logical” Device
Device (Manufacturer: Microchip Technology)
(Product: Mouse in a Circle Demo)
Configuration
Interface
IN (Endpoint 0) USB System Software
(default control pipes)
USB Device-Specific Pipe(s)
(Human Interface Device)
HID TX/RX Functions
(MCHPFSUSB FW)
Analog/Digital I/O
OUT (Endpoint 0)
IN (Endpoint x)
OUT (Endpoint x)
These settings are
represented by a Device
Descriptor Table, stored
in firmware. More on
this later…
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 30
USB Transaction
Token Packet
USB Transaction
Specifies:
• Target device address
• Endpoint number
• Direction of the data transfer
SETUP and OUT token types
inform the target device that
the host wants to send data.
IN token type informs the target
device that the host wants to
fetch data.
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 31
IN Transaction ACK
IN Token Packet
USB Transaction
Data Packet
Handshake Packet
Acknowledge - ACK
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 32
IN Transaction NAK
IN Token Packet
USB Transaction
Handshake Packet
Not Acknowledge - NAK
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 33
OUT Transaction ACK
OUT Token Packet
USB Transaction
Data Packet
Handshake Packet
Acknowledge - ACK
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 34
OUT Transaction NAK
OUT Token Packet
USB Transaction
Data Packet
Handshake Packet
Not Acknowledge - NAK
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 35
Demo - Capturing a Transaction -
To read the potentiometer value, the PIC24F USB embedded host continually sends command “0x37”
The PIC18F USB device Returns Command Code + 10-bit Potentiometer ADC value: <0x37><ADRESL><ADRESH>
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 36
Demo - Capturing a Transaction -
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 37
Transfer: A Group of Related Transactions
MPUSBWrite(EP7, Pointer, Size = 129, Timeout)
Transfer
Transaction 1
64 Byte Payload OUT Token Packet
Data Packet
ACK Handshake Packet
Key:
Transaction 2
64 Byte Payload
Transaction 3
1 Byte Payload
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 38
Data Transfer Types
Transfer/ Endpoint
Type
Polling Interval
% Reserved BW/Frame for all transfers of
this type
Max. # Data Bytes/Frame/Endpoint
(Max# transactions per frame @ Max Ep Size)*
Data Integrity
Interrupt Fixed, Periodic 90 64 (1 x 64) Yes
Isochronous Fixed, Periodic 90 1023 (1 x 1023) No
Bulk Variable, Uses Free Bandwidth
0 1216 (19 x 64) Yes
Control Variable 10 832 (13 x 64) Yes
*Assumes transfers use maximum packet sizes allowed per Ep type
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 39
Interrupt Transfer Example
1
MPUSBWrite(EP7, Pointer, Size = 129, Timeout)
64 64
Frame
Traffic to other Endpoints or Idle Transactions
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 40
Bulk Transfer Example
1 64 64
Frame
Transactions only occur if no higher
priority traffic
Int. Int. Isoc. Int.
MPUSBWrite(EP7, Pointer, Size = 129, Timeout)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 41
Theoretical Maximum Transfer Rate Per Endpoint
24
832
0.8 64
1216
1023
0
200
400
600
800
1000
1200
1400
KByte/s
Control Interrupt Bulk Iso
Transfer Type
Low
Full
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 42
Quiz!
Mouse Speaker Printer
Control
+
Interrupt
Control
+
Bulk
Control
+
Isochronous
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 43
USB Device Classes
Joystick
Mouse
External
Hard Drive
MPLAB®
REAL ICE™ in-circuit emulator
Modem
Floppy
Drive Data Glove
Keyboard
Ethernet
Adapter
Human Interface Device Class
(HID)
Mass Storage Device
Class (MSD)
Communication Device
Class (CDC)
Custom Class
(Vendor Class)
Many more classes….
PICkit™ 3
Starter Kit
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 44
The Enumeration Process
DETACHED
POWERED Power
(self/bus)
DEFAULT
Bus
reset
ADDRESS
Get Device
Descriptor
CONFIGURED
Get
Descriptors
ATTACHED
Cable
Connected SUSPENDED
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 45
Descriptors
Device
Configuration 1
Interface 0
Endpoint
Interface 1
Endpoint Endpoint Endpoint
To other Configurations if any
To other
Interfaces if any
String 0
String 1
String N
Descriptors are typically stored in non-volatile/Flash memory
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 46
PICDEMTM USB
Microchip
Descriptors - Example
Device
Configuration 1
Interface 0
Endpoint
Manu. String
Prod. String
USB 2.0, VID = 0x04D8,
PID = 0x0007, Num. Configurations,
Strings?
Configuration #1: Bus-Powered,
Remote Wakeup, 500mA, Num.
Interfaces
Interface #0: HID Class, Num.
Endpoints
Endpoint 1 IN, Interrupt Transfer
Type, 64-byte buffer, Poll every 3 ms Unicode
Characters
Go USB!
Other String
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 47
Demo - Viewing Descriptor Information -
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 48
VID & PID
Vendor ID (VID): 16-bit number
Required to market your product
http://www.usb.org/developers/vendor
USD $2,000
Technical & Legal trouble if not using an approved VID
Product ID (PID): 16-bit number
Microchip’s Sub-licensing Program
Every USB Device product line is required to have a unique combination of VID and PID
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 49
USB Compliance
Compliance Testing
Must pass to use USB logo
Test fee: USD ~$1,500
Tests device for conformance to USB Framework and Class standard control requests
USB Protocol Analyzer
“USBCV” USB Command Verifier
www.usb.org/developers/tools
Electrical Signal Quality
Power Management
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 50
Compliance Testing
For USB Compliance Testing: Download appropriate checklist:
http://www.usb.org/developers/compliance/check_list/peripheral_checklist.pdf
http://www.usb.org/developers/compliance/check_list/compchk_otgeh2_0_v1.0_-_fill-in.pdf
Use certified USB receptacle and cable for testing
Know the TID (Test ID) of your components Find USB PIC® MCUs TID number on www.microchip.com/usb
For USB Compliance certification: Independent Test Labs (see www.usb.org for a list)
You need to provide them a compiled Checklist with your device
It’s a good idea to take a look at the
checklist before starting your design!
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 51
Agenda
USB Fundamentals
Microchip USB solutions
Design considerations
How to get started
Summary
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 52
PIC16F1/PIC18F Small, Low Power, Low Cost
Up to 16 MIPS 14- to 80-Pin Packages
Up to 128KB Flash Up to 4KB RAM
USB 2.0 Device Support
Migration
Perf
orm
an
ce
100+ USB PIC MCUs The industry’s strongest
scalable product, family,
and software migration path
Scalable USB PIC® MCU Portfolio
PIC24F/PIC24E/dsPIC33E Low Power, GPU, DSP Engine
Up to 70 MIPS 28- to 144-Pin Packages
Up to 512 KB Flash Up to 96KB RAM
USB 2.0 Device, Embedded Host, OTG
PIC32 High Performance, Pin Compatible to PIC24F
80 MHz, 1.53 DMIPS/MHz Up to 80 MIPS
28- to 100-Pin Packages Up to 512 KB Flash Up to 128 KB RAM
USB 2.0 Device, Embedded Host, OTG
32-bit
8-bit
16-bit
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 53
Microchip Application Libraries
Download from www.microchip.com/MLA
Contains different stacks (USB, TCP/IP, Graphics, mTouch™ Sensing Solution, MDD FS, etc.)
Default installation path: C:/Microchip Solutions vYYYY-MM-DD/
Contains libraries source code and several example firmware projects based on Microchip’s Development Tools
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 54
Microchip USB Frameworks - www.microchip.com/MLA -
MCHPFSUSB Framework PIC16F, PIC18F, PIC24F/E, dsPIC33E & PIC32 USB MCUs
XC8/XC16/XC32 Compatible
MPLAB® X IDE Project Centric
Device Stacks Audio, CCID, CDC, HID, MSD, PHDC, Custom
Polling or Interrupt driven
Embedded Host Stack PIC24F/E, dsPIC33E & PIC32 USB MCUs
Polling or Event-driven Scheme
Client drivers for Basic Android Accessory, CDC, Charger, Custom, HID, MSD, Printer
On-The-Go (OTG) Support PIC24F/E, dsPIC33E & PIC32 USB MCUs
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 55
USB Configuration Tool
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 56
MCHPFSUSB Device Class Demos Available
Smart Card
Class
Smart Card
Reader
RS-232
Basic
Communication Device
Class (CDC) Audio
Class
MIDI
Speaker
Microphone
Joystick
Mouse
UPS
Keyboard
Human Interface
Device Class (HID)
Digitizer
Custom
More demos in future releases…
MCHP
WinUSB
LibUSB
Custom Class
(Vendor Class)
WinUSB high bandwidth
HID+MSD
WinUSB+MSD
CDC+MSD
Composite
Demos
SDC Data
Logger
SD Card
Reader
Internal
Flash
Mass Storage Device
Class (MSD)
Personal Healthcare
Device Class
Weighing
Scale
Glucose
Meter
Thermometer
Blood
Pressure
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 57
MCHPFSUSB EH Client Driver Demos Available
Mouse
Keyboard
Human Interface
Device Class (HID)
MCHP
Custom Class
(Vendor Class)
Audio
Class
MIDI
Battery Charging
Class
Simple
Charger
RS-232
Communication Device
Class (CDC)
More demos in future releases…
Thumb
Drive Data
Logger
Mass Storage Device
Class (MSD)
Simple
Demo
CDC+MSD
HID+MSD
Composite
Demos
Simple POS Simple Full
Sheet
Screen
Printer Class
Dual Role Device
MSD Host + HID Device
OTG
MCHP Custom
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 58
Agenda
USB Fundamentals
Microchip USB solutions
Design considerations
How to get started
Summary
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 59
Considerations When Using Standard Classes
The Logical USB Device is pre-defined Max. bandwidth is fixed
The Device data communication protocol is defined For CDC Class the PIC® MCU looks like
a modem, or terminal connected to a COM port
Main Benefit: Cross-platform use Custom OS driver is not required!
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 60
CDC – RS-232 Emulation
PC Computer PIC® Microcontroller
USB Cable
Hyper Terminal CDC
INF File Required (Supplied in MCHPSUSB)
Standard Windows Drivers
Design Considerations:
• ~80 KB/s max
• Bulk Transfers
• PC applications can access the device as though it
is connected to a serial COM port
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 61
Human Interface Device (HID)
PC Computer PIC® Microcontroller
USB Cable
HID App HID\Mouse
Standard Windows Drivers
Design Considerations:
• 64 KB/s max
• Interrupt Transfer Type
• Standard Windows driver
• Custom PC application can access HID data
through Win32 APIs
HID Bootloader
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 62
Generic Driver Demo
Custom Class Driver
PC Computer PIC® Microcontroller
USB Cable
MCHPUSB.sys
Binary Only
MPUSBAPI.dll
Source and
Binary
Bootloader
PDFSUSB.exe
Binary Only Other C++
Examples
Source and
Binary
Design Considerations:
• ~1,088 KB/s max
• Very flexible (Control, Bulk, Interrupt transfers are
possible)
• Not a standard Windows driver
• PC programming is required
INF File Required
(Supplied in MCHPFSUSB)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 63
Agenda
USB Fundamentals
Microchip USB solutions
Design considerations
How to get started
Summary
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 64
USB Device
1641 USB2 USB Human Interface Device (HID) Class
1642 USB3 USB Communication Device Class (CDC) – Serial Port Emulation
1643 USB4 USB Device - Generic Driver Solutions
USB Classes
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 65
USB Device
1644 USB5 USB Personal Healthcare Device Class (PHDC)
1645 USB6 Using USB Interface Bridges to Enable Embedded System Communication with USB Hosts
USB Classes
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 66
USB Embedded Host
1646 USB7 USB Embedded Host and On-The-Go (OTG)
1626 FAT Using the FAT File System Library to Manipulate Files on a USB Thumb Drive
USB Classes
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 67
Microchip Technical Training
Worldwide Training Centers and live online classes
In-depth Technical Training with Hands-on
Ethernet, Motor control, Graphics, USB, etc.
Local Language Support
Live Onsite training available
www.microchip.com/training
USB classes
COM3101 – Introduction to Full- Speed USB
COM3201 – Designing a Custom USB Peripheral Application
COM3202 – Designing a USB Embedded Host Application
Wrap Up
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 68
Agenda
USB Fundamentals
Microchip USB solutions
Design considerations
How to get started
Summary
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 69
Summary
USB Fundamental Host is master
Up to 126 devices sharing bandwidth
Microchip USB solutions USB PIC® MCUs and dsPIC® DCSs
Free USB software & demo codes
Design considerations USB Classes Pros & Cons
How to get started USB classes at MASTERs 2012
Microchip Technical Training Live
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 70
Additional Resources
Microchip Design Center www.microchip.com/USB
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 71
MCHPFSUSB Framework - Supported Platforms -
Low Pin Count USB Development Kit (PIC18F14K50 Family)
PICDEM™ Full Speed USB (PIC18F4550 family)
MPLAB® Starter Kit for PIC18F MCU (PIC18F46J50 family)
PIC18FxxJ50 FS USB Demo Board (+ HPC Explorer Board)
MPLAB Starter Kit for PIC24F (PIC24FJ256GB106)
PIC24FJ64GB502 Microstick
PIC24FJ256DA210 Development Kit
PIC24F USB PIMs (+ Explorer 16 + USB PICtail™ Plus)
dsPIC33E/PIC24E PIMs (+ Explorer 16 + USB PICtail Plus)
PIC32 USB PIMs (+ Explorer 16 + USB PICtail Plus)
PIC32 USB Starter Board (PIC32MX460F512L family)
PIC32 USB Starter Board II (PIC32MX795F512L family)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 72
Contains everything you need to get started quickly
Use with any of the PIC18F4550 family microcontrollers
Includes self-directed class and lab material
The Demo Kit provides all of the hardware and software
needed to demonstrate and develop a complete USB
communication solution
Priced from $59.99
Part Numbers
DM163025
Available Now
PICDEM™ Full Speed USB Demo Kit
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 73
Contains everything you need to get started quickly
Can be plugged into PICDEM™ HPC Explorer Board or PICDEM PIC18 Explorer Board
Can be operated as a stand-alone board
Priced from $40.00
Part Numbers MA180021 - PIC18F87J50 FS USB PIM
MA180024 - PIC18F46J50 FS USB PIM
MA180029 - PIC18F47J53 FS USB PIM
DM183032 - PICDEM PIC18 EXPLORER BOARD
Available Now
PIC18FXXJ50 Full-Speed USB Plug-In Module (PIM)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 74
Low Pin Count USB Development Kit
Contains everything you need to get started quickly Use with new 20-pin PIC18F USB microcontrollers –
PIC18F13K50, PIC18F14K50
Includes self-directed class and lab material
Quickly implement common USB functions: RS-232 to Serial
Keyboard/Mouse, etc…
Priced from $39.99
Part Numbers DM164127
DV164139 (w/PICkit™ 3)
Available Now
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 75
PIC18 Starter Kit
Functions as a USB mouse, joystick or mass storage device all using the on-board capacitive touch sense pads
Includes a MicroSD™ memory card, potentiometer, acceleration sensor, and OLED display
On-board debugger/programming
Completely USB-powered
Demonstrates PIC18 Family USB communication
Priced from $59.98
Part Numbers DM180021
Available Now
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 76
16-/32-bit USB Starter Kits
PIC24F Starter Kit Part #: DM240011
PIC24FJ256GB110
Priced from $59.98
PIC32 USB Starter Kit II Part #: DM320003-2
PIC32MX795F512L
Priced from $55.00
PIC32 Ethernet Starter Kit Part #: DM320004
PIC32MX795F512L
Priced from $72.00
All Available Now
Debugger
Port
Thumb Drive
Connection
(Host)
On-The-Go Port
(Dual-Role)
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 77
16-/32-bit USB Development Boards
Explorer 16 + USB PICtail™ Plus Daughter Board + USB PIMs Part #: MA320003/MA240014
Part #: DM240001
Part #: AC164131
Priced from $214.99
All Available Now
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 78
Thank You!
Please complete the Class Evaluation Form
© 2012 Microchip Technology Incorporated. All Rights Reserved. 1640 USB1 Slide 79
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC, KeeLoq, KeeLoq logo, MPLAB,
PIC, PICmicro, PICSTART, PIC32 logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL
and The Embedded Control Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, chipKIT, chipKIT logo, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense,
HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified
logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM,
PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC,
UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.
© 2012, Microchip Technology Incorporated, All Rights Reserved.