USB Peripheral Module Introduction This module covers the USB peripheral, library and examples provided with the LM3S3748 evaluation kit.
Learning Ob...
USB Peripheral Module Introduction This module covers the USB peripheral, library and examples provided with the LM3S3748 evaluation kit.
Learning Objectives •
USB Basics
•
Stellaris Implementation
•
USB Library
•
USB Examples
•
Two labs
Stellaris One-Day Workshop - USB Peripheral
14 - 1
Module Topics
Module Topics USB Peripheral Module................................................................................................................................1 Module Topics.............................................................................................................................................2 USB Basics..................................................................................................................................................3 Stellaris USB ..........................................................................................................................................4 USB Stacks.............................................................................................................................................5 Stellaris MCU’s with USB .....................................................................................................................6 LM3S3748 USB Schematic....................................................................................................................7 USB Library ...........................................................................................................................................7 USB Code Examples ..............................................................................................................................8 Labs ........................................................................................................................................................9 USB Mass Storage Host Lab.....................................................................................................................11 Description: ..........................................................................................................................................11 Hardware list: .......................................................................................................................................11 Software list:.........................................................................................................................................11 Procedure..............................................................................................................................................12 USB HID Mouse Device Lab ....................................................................................................................16 Description: ..........................................................................................................................................16 Hardware list: .......................................................................................................................................16 Software list:.........................................................................................................................................16 Procedure..............................................................................................................................................17
14 - 2
Stellaris One-Day Workshop - USB Peripheral
USB Basics
USB Basics USB Basics
Multiple connector sizes
4 thpins – power, ground and 2 data lines
Configuration connects power 1st, then data Standards:
(5 pin ID for USB 2.0 connectors)
USB 1.1 • Defines Host (master) and Device (slave) • •
USB 2.0 • Speeds to 480Mbits/sec •
Speeds to 12Mbits/sec Devices can consume 500mA (100mA for startup)
OTG addendum
USB 3.0 • Speeds to 4.8Gbits/sec • •
New connector(s) Separate transmit/receive data lines
USB Tutorial: http://www.computer-solutions.co.uk/info/Embedded_tutorials/usb_tutorial.htm
USB Basics
USB Device … most USB products are slaves
USB Host … usually a PC, but can be embedded
USB OTG … On-The-Go
Allows a single port to be either a Device (a printer connected to a PC) or a Host (a printer connected to a camera)
Two connected OTG ports undergo host negotiation
Host polls each Device at power up. Info from Device includes:
Device Descriptor (Manufacturer & Product ID so Host can find driver)
Configuration Descriptor (Power consumption and Interface descriptors)
Endpoint Descriptors (Transfer type, speed, etc)
Process is called Enumeration … allows Plug-and-Play
Srellaris USB …
Stellaris One-Day Workshop - USB Peripheral
14 - 3
USB Basics
Stellaris USB
Stellaris USB USB 2.0 Full Speed (12 Mbps) operation Transfer types: Control, Interrupt, Bulk and Isochronous Stellaris collaterals Luminary Micro is a member of the USB Implementers Forum. Stellaris is approved to use the USB logo Vendor/Product ID sharing
FREE Vendor ID/ Product ID sharing program
Block Diagram …
USB Peripheral Block Diagram
Integrated USB Controller and PHY
Up to 32 Endpoints 1 dedicated control IN endpoint and 1 dedicated control OUT endpoint
14 - 4
Up to 15 configurable IN endpoints and 15 configurable OUT endpoints 4 KB Dedicated Endpoint Memory DMA capability (up to three IN Endpoints and three OUT Endpoints) 1 endpoint may be defined for double-buffered 1023-bytes isochronous packet size
Stacks …
Stellaris One-Day Workshop - USB Peripheral
USB Basics
USB Stacks
USB Stacks
USBX (H/D)
uC/USB (D)
smxUSB (O/H/D)
USB (O/H/D)
emUSB (H/D)
CMX-USB (O/H/D)
MCUs …
Stellaris One-Day Workshop - USB Peripheral
14 - 5
USB Basics
Stellaris MCU’s with USB
USB Connected MCUs
C or e
Ser ia l I nt er f ac es
Dig it al
C AN M AC
USB F u ll Spe ed
UART
I2 C
SSI/SPI
I 2S
AD C Ch an ne ls
AD C Spe ed (Ks ps)
LD O Vo ltag e R eg ulat or
Ana log C om pa ra to rs
Dig ital Com pa ra to rs
64
?
50
-
4
8
1
8
?
8
4
1
-
-
-
O/H /D
3
2
2
-
8
1 00 0
?
?
3
-
61 ?
6 4- LQ F P 1 00 -L QF P
L M 3S5 000 s
12
25 6
96
?
80
?
4
8
2
8
?
8
4
2
-
-
2
O/H /D
3
2
2
?
16
1 00 0
?
?
3
7
71 ?
6 4- LQ F P 1 00 -L QF P
L M 3S9 000 s
6
25 6
96
?
10 0
?
4
8
2
8
?
8
4
2
?
?
2
O/H /D
3
2
2
?
16
1 00 0
?
?
3
7
65 ?
1 00 -L QF P
Hib e rn a te
IEEE 1 58 8
12 8
GPIO s ( 5- V)
Q EI
4
ADC (1 0- bit)
In ter na l T em p Sens or
Fa ult Inp ut s
10 /10 0 Ethe rn et M AC+ PHY
L M 3S3 000 s
SRAM ( KB) R OM SW Lib ra ry Ma x Sp ee d ( MH z) I nte rn al Pre cisio n Osc illato r 3 2- bit T ime r
RT C
An al og
O utp ut s
C on t ro l PWM
16 -b it T im er Wat chd og T im er s CC P
M o tio n
T i m er M o du le s
Fla sh (KB)
G en e ra l Pu r p os e
MCU s i n Ser ie s
Sp ee d
Pac ka ge O pt io n s
M e m or y an d
USB 2.0 full speed (12 Mbps) support (MAC+PHY) : Host/Device/OTG – with DMA Compact 64-pin LQFP or feature-rich 100-pin LQFP options – CSTN graphics display (128x128 resolution,16-bit color)
Stellaris LM3S3748 Evaluation Kit
– User LED, navigation switch and pushbutton – Magnetic speaker – LM3S3748 I/O available on labeled break-out pads
$109
– Standard ARM® 20-pin J TAG debug connector with input and output modes – MicroSD card slot USB USB
and JTAG cables, Jumper wires Flash Drive (128MB)
Gen er al Pu r po se Tim e r M od u les
Co re
An alo g
CCP
Ou tput s
F ault I npu ts
QEI
10 /10 0 Ethe rne t M AC+PHY
IEEE 15 88
CAN M AC
USB F ull Spee d
UART
I2 C
SSI/SPI
2
ADC Chan nels
ADC Spe ed ( Ks ps)
Inte rn al T emp Sen sor
LDO Vo ltage Reg ulato r
Ana lo g Co mp ara tor s
64 ?
-
50
-
4
8
1
8 ?
8
4
1
-
-
-
O/ H/D
3
2
2
-
8
100 0
?
?
3
-
61 ?
64 -LQ FP 100 -L QFP
LM 3S50 00s
12
256
96 ?
?
80
?
4
8
2
8 ?
8
4
2
-
-
2 O/ H/D
3
2
2
?
16
100 0
?
?
3
7
71 ?
64 -LQ FP 100 -L QFP
LM 3S90 00s
6
256
96 ?
?
100
?
4
8
2
8 ?
8
4
2
?
?
2 O/ H/D
3
2
2
?
16
100 0
?
?
3
7
65 ?
100 -L QFP
G PIO s (5 -V)
Dig ital
Com par ator s
I S
Oscillato r
ADC ( 10 -bit)
Hib er na te
16 -bit Tim er
Watch dog T m i er s
128
RT C
32 -bit Tim er
4
I nter na l Pr ecisio n
Ext . Perip her al Inte rfa ce
LM 3S30 00s
ROM SW Libr ary
M ax Sp eed (M Hz)
Dig it al
SRAM ( KB)
Ser ial Int er fac es
F lash (KB)
Mo tio n Co nt ro l PWM
M CUs in Ser ies
M em or y a nd Spe ed
Pack ag e Op tio n s
Ethernet+USB OTG Connected MCUs
First MCUs featuring fully integrated 10/100 Ethernet MAC+PHY, USB OTG MAC+PHY, and up to 2 Bosch CAN 2.0 A/B MACs LM3S9B96 features SAFERTOS in ROM
Evaluation
board with LM3S9B90 (hibernate) or LM3S9B92 (max GPIOs) In-Circuit Debug Interface (BD-ICDI) board EK-LM3S9B90
$99
Connects to USB port on PC and to 10-pin ARM JTAG connector on the evaluation board 8-pin Power/UART connector provides power and virtual comm-port to the evaluation board
Cables CD
with evaluation software tools, documentation, source code, schematics
EK-L M3S9B92
14 - 6
Schematic …
Stellaris One-Day Workshop - USB Peripheral
USB Basics
LM3S3748 USB Schematic
LM3S3748 Eval Board USB Schematic
Fairchild USB Switch
TI ESD protection diode array
USBLib …
USB Library
Stellaris USB Library
Supports Host, Device and On-The-Go ports Written entirely in C User Guide: SW-UG-4781.pdf Supports the following tool chains: Keil CodeSourcery IAR Embedded Workbench Code Red Technologies Code Composer Studio
Code Examples …
Stellaris One-Day Workshop - USB Peripheral
14 - 7
USB Basics
USB Code Examples
USB Code Examples USB Boot Loader Demo 1 USB Boot Loader Demo 2 USB Generic Bulk Device USB HID Keyboard Device USB HID Mouse Device USB MSC Device USB Serial Device USB HID Keyboard Host USB HID Mouse Host USB Mass Storage Class Host Location: C:\StellarisWare\boards\ek-lm3s3748
USB Code Examples
Stellaris examples implement a custom USB “micro-stack”
Stack footprint is about 10K in most configurations