usb - what would the guru do? - nxp.com

50
Measuring USB bus performance on the LPC1347 (What would the USB Guru do?)

Upload: others

Post on 10-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: USB - What would the Guru do? - NXP.com

Measuring USB bus performance on the LPC1347

(What would the USB Guru do?)

Page 2: USB - What would the Guru do? - NXP.com

NXP MCU LPC Lines

2

LPC Go LPC800

LPC1100 LPC1100LV LPC11E00 LPC131x LPC210x

LPC Connect LPC11Uxx LPC11Cxx LPC11A00 LPC1200 LPC134x LPC213x LPC214x

LPC ConnectPlus

LPC4000 LPC1700 LPC2200 LPC2300 LPC2400

LPC ConnectTurbo

LPC1800 LPC4300 LPC2900

LPC Command LPC3100 LPC3200

10 years of ARM experience

Page 3: USB - What would the Guru do? - NXP.com

LPC134x: USB Cortex-M3

High performance - 72MHz (Cortex-M3)

12-bit ADC support for higher end derivatives (LPC1345/6/7)

USB ROM Drivers- MSC, HID, CDC, Composite

Pin-compatible with LPC11U00 & LPC1100 series

3

LPC134x

SYSTEM

SERIAL INTERFACES

ANALOG

AHB-

LITE

Bus

EEPROM* Up tp 4 kB

Flash Up to 64 kB

SRAM Up to 12 kB

ROM (USB drivers*)

APB

Bus

Bridge

*Applies to LPC1347/46/45 only

Part Number

Flash (kB)

SRAM (kB)

EEPROM (kB)

SSP/ SPI

GPIO ADC Ch/Bits

Packages

LPC1342 16 4 - 1 28 8/10 HVQFN33 LPC1343 32 8 - 1 28-40 8/10 LQFP48, HVQFN33 LPC1345 32 10 2 2 26-40 8/12 LQFP48, HVQFN33 LPC1346 48 10 4 2 26-40 8/12 LQFP48, HVQFN33 LPC1347 64 12 4 2 26-51 8/12 LQFP48/64,

HVQFN33

TIMERS

Systick Timer

32-bit Timers (2)

WWDT

16-bit Timers (2)

ARM CORTEX-M3 Up to 72 MHz

High-Speed GPIO Up to 51

Clock Generation Unit 12MHz, 1% IRC osc.,

Watchdog osc., 1-25 MHz System osc., System PLL (1 main PLL and 2nd USB

PLL*)

Power Control PMU, power modes, BOD, single Vdd power supply,

POR

ADC 10-bit/12-bit

I2C FM+

USART

SSP (2)

USB

Page 4: USB - What would the Guru do? - NXP.com

LPC Connect 2-yr Roadmap

4

Cortex-M4 +1MB Flash

Ethernet

Q1’13 Q3’12 Q2’13 Q4’12 Q3’13 Q4’13 Q1’14 Q2’14

Cortex-M3 24-bit Sigma-Delta ADC + other analog features

LPC11A1x Cortex-M0 50MHz

8K SRAM, 32K FLASH 4kB EEPROM, DAC, Comparator

LPC11U3x Cortex-M0 50MHz 32-128kB FLASH

USB, EEPROM

LPC13Axx Cortex-M3, 2x 12-bit ADC

Analog Sub-system

Morpheus LPC21xx next gen 512kB Flash, USB

Concept projects can change without notice

LPC213x/4x ARM7 72MHz, 32-512kB Flash

2xADC, DAC, RTC, USB

Cortex-M0 16-bit Sigma-Delta

+ other analog features

LPC1300

MASS PRODUCTION

DEVELOPING

SAMPLING

CONCEPT

LPC134x Cortex-M3 72MHz, 12b ADC

12kB SRAM, 64kB FLASH 256B Flash sector, 4kB EEPROM

Page 5: USB - What would the Guru do? - NXP.com

5

LPCUSBlib

NXP’s full featured USB stack

for LPC microcontrollers

integrated in the LPCOpen

Platform

Page 6: USB - What would the Guru do? - NXP.com

Supported controllers – Full-speed, device mode controller – Full-speed, host and device mode

controller – High-speed, host and device mode

controller – Dual host and device controllers *

Supported transfer types – Control – Bulk – Interrupt – Isochronous

Supported tool chains – Keil uVision 4 – LPCXpresso 5 – IAR EWARM 6

What is included in LPCOpen/LPCUSBlib?

6

Supported boards (BSP) – LPCXpresso LPC11U1x/2x/3/, LPC1769,

LPC1347 and Rev B base board – Hitex LPC1850/4350 Evaluation Board (rev A4) – NGX Xplorer (both LPC1830 and LPC4330) – Keil MCB1000, MCB1700, MCB1800, MCB4300 – Embedded Artists LPC177x/8x/407x/8x

Included examples – Audio output host and device – Audio input device – Keyboard host and device – Mass storage host and device – Mouse device – VCOM device – Dual role

ROM device class drivers – HS: LPC1800, LPC4300 – FS: LPC11U2x, LPC134x

*coming soon!

Page 7: USB - What would the Guru do? - NXP.com

Where to get LPCOpen/LPCUSBlib?

LPCOpen website: http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers

Latest version of LPCOpen/LPCUSBlib Links to development board vendors Links to compilers/debuggers and other tools Build and configuration documentation Forum

7

Page 8: USB - What would the Guru do? - NXP.com

What is available in the download?

One zip file: – Full source to a complete USB stack – 10 example applications – Android Accessory project from

Embedded Artists – Bandwidth tuning project – Project files for uVision4, LPCXpresso

5, and IAR 6 – Documentation

8

Page 9: USB - What would the Guru do? - NXP.com

Class Support

9

HID

Audio

VCOM

MSC

Smart Card*

Device Firmware Update (DFU)

*Smart Card Interface coming soon!

Page 10: USB - What would the Guru do? - NXP.com

On-Chip USB ROM Drivers

10

Customer benefits: – Savings of 6kB code

space or more – API driven approach – Programming via USB

using Mass Storage Class

– Ease of use as a Virtual COM port

– Custom class benefits

Page 11: USB - What would the Guru do? - NXP.com

LPCOpen/LPCUSBlib supports on-chip USB ROM Drivers

Same API LPC11U2x/3x LPC13xx

LPC18xx/43xx

LPC11U1x LPC17xx

11

Page 12: USB - What would the Guru do? - NXP.com

Setting up LPCOpen/LPCUSBlib with just a few API calls!

12

ROM drivers- HID, MSC, CDC, custom

Setup using just 6 APIs: • USB_Init(); • *USB_Connect(); • <class>_DeviceTask(); • <class>_HostTask(); • USB_USBTask(); • Event_functions();

Events ……

.

* Device only

Page 13: USB - What would the Guru do? - NXP.com

What to get and where to get it

LPCXpresso integrated development environment: http://lpcxpresso.code-red-tech.com/LPCXpresso/ LPCUSBlib USB software library in the LPCOpen platform: http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers Total Phase Data Center software for the Beagle USB 480: http://www.totalphase.com/products/data_center/

Other resources: http://www.nxp.com/technicalsupport

Page 14: USB - What would the Guru do? - NXP.com

Measuring USB bus performance

Page 15: USB - What would the Guru do? - NXP.com

LPCXpresso board with the LPC1347 Cortex-M3

LPC-Link JTAG debugger LPC1347 target

To LPCXpresso IDE To Beagle USB 480 Target Device Port

Page 16: USB - What would the Guru do? - NXP.com

Non-intrusively monitor high-, full-, low-speed USB 2.0

– Interactive real-time display, filter, and search

– Real-time class-level decoding

– 64 MB on-board hardware buffer

Beagle USB 480 Protocol Analyzer

Page 17: USB - What would the Guru do? - NXP.com

Hardware Set Up

Host PC Beagle USB 480

Analyzer Target Device Port

LPC1347 LPCXpresso Board

Target Host Port Analysis Port

LPCXpresso Debug Port

LPCXpresso USB Port

Page 18: USB - What would the Guru do? - NXP.com

Data logger

18

Sensor

LPC1347

Laptop SPI USB

Filters

Buffer

Page 19: USB - What would the Guru do? - NXP.com

Performance Tuning Demo

19

LPC1347 • Cortex M3 core @ 72MHz

• 21 MBps internal RAM copy

• 4 MBps CRC32 calculation

• 2.5 MBps FIR filter

USB 2.0 full speed controller • 1.2 Mbits / second overall bandwidth

• ~1 MBps bulk transfer rate

Page 20: USB - What would the Guru do? - NXP.com

Bulk transfers from function to host

20

Page 21: USB - What would the Guru do? - NXP.com

Bulk transfers from host to function

21

Page 22: USB - What would the Guru do? - NXP.com

Description of Performance Tuning Demo

Foreground rate 0.10 ms Foreground load 24.65 Irq load 1.08 Remaining 74.27 Foreground rate 0.10 ms Foreground load 24.96 Irq load 1.10 Remaining 73.94 Foreground rate 1.00 ms Foreground load 14.31 Irq load 0.72 Remaining 84.97 Foreground rate 1.00 ms Foreground load 14.28 Irq load 0.72 Remaining 85.00 Foreground rate 10.00 ms Foreground load 1.25 Irq load 0.06 Remaining 98.69 Foreground rate 10.00 ms Foreground load 1.26 Irq load 0.06 Remaining 98.68

USB VENDOR SPECIFIC DEVICE

Endpoint Buffer

512 bytes

USB HOST

160k bytes Bulk OUT

SysTick() USBForegroundTask() { If (Buffer == Full) crc32(Buffer); }

64 64 64 64

USB_ProcessInterrupt() { Buffer = Full; }

Page 23: USB - What would the Guru do? - NXP.com

Data Center Overview

Page 24: USB - What would the Guru do? - NXP.com

Number of NAKs varies based on how frequently the foreground task empties the buffer

– 0.10 ms frequency: 1-3 NAKs (or none) – 1.00 ms frequency: about 7 NAKs – 10.0 ms frequency: about 150 NAKs

Measuring Bus Performance

Bulk transfer rate

Page 25: USB - What would the Guru do? - NXP.com

Bulk Transfers Showing NAKs

NAKs

Page 26: USB - What would the Guru do? - NXP.com

Simple USB HID class example

Page 27: USB - What would the Guru do? - NXP.com

Generic HID Example

Page 28: USB - What would the Guru do? - NXP.com

Build and debug an example application in 4 easy steps

Step 1. Import projects

Step 2. Configure projects

Step 3. Build application

Step 4. Debug application

Page 29: USB - What would the Guru do? - NXP.com

Step 1. Import projects

Page 30: USB - What would the Guru do? - NXP.com

Step 1. Import projects

IMPORTANT! Be sure to actively build the indexes when working with LPCUSBlib projects. This ensures build dependencies work across libraries.

You can find the index in the following menu: Windows>Preferences>C/C++>Indexer

The Build configuration for the indexer should be set to “Use active build configuration”

Press the “OK” button

Page 31: USB - What would the Guru do? - NXP.com

Step 2. Configure projects Right-click on BSP (Board Support Package) and select:

– Build Configurations-> Manage – Select “LPC13Uxx_LPCXpressoRevB” – Press the “Set Active” button – Press OK

Page 32: USB - What would the Guru do? - NXP.com

Step 2. Configure projects Right-click on CDL (Common Driver Library) and select:

– Build Configurations-> Manage – Select “LPC13Uxx” – Press the “Set Active” button – Press OK

Page 33: USB - What would the Guru do? - NXP.com

Step 2. Configure projects

Right-click on LPCUSBlib and select: – Build Configurations-> Manage – Select “LPC13Uxx_Device” – Press the “Set Active” button – Press OK

Page 34: USB - What would the Guru do? - NXP.com

Step 2. Configure projects

Right-click on Example_GenericHIDDevice and select: – Build Configurations-> Manage – Select “LPC13Uxx” – Press the “Set Active” button – Press OK

Page 35: USB - What would the Guru do? - NXP.com

Step 2. Configure projects Right-click on the “Example_GenericHIDDevice” in the Project Explorer, and select “Properties” from the context menu

In Properties, under C/C++ Build->MCU Settings, select LPC1347

Press “OK”

Page 36: USB - What would the Guru do? - NXP.com

Step 3. Build application

Highlight the project in the Project window and click Build

Page 37: USB - What would the Guru do? - NXP.com

Step 4. Debug application

Highlight the project in the Project window and click Debug

This will load the program into memory and run to a breakpoint at main()

Page 38: USB - What would the Guru do? - NXP.com

Step 4. Debug application Connect to the USB Analyzer and press the Run Capture button to begin capturing USB traffic

Page 39: USB - What would the Guru do? - NXP.com

Step 4. Debug Application

Press the Resume button or press F8 to start the program running after the breakpoint at main()

F8 or

Page 40: USB - What would the Guru do? - NXP.com

Step 4. Debug Application Start up the HID Client PC application. It can be found at:

nxpUSBlib v0.97\applications\examples\nxpUSBlib\Example_GenericHIDDevice\HIDClient.exe

In the drop-down list, you should see “nxpUSBlib Generic HID Demo”

Pressing button SW2 on the Xplorer baseboard will send the button press to bit 5 of the input (checked/unchecked)

Checking/unchecking outputs 0 - 2 will turn on and off the LEDs on the Xplorer baseboard. 3 will turn on and off the LED on the target board.

Descriptors.c

Page 41: USB - What would the Guru do? - NXP.com

GETTING STARTED SOFTWARE DEVELOPMENT PLATFORMS HW DEBUGGERS EVALUATION/DEBUG BOARDS NXP FREE SOFTWARE

41

Page 42: USB - What would the Guru do? - NXP.com

Choose a Software Development Platform

IDEs/Compilers NXP LPCXpresso

– Free up to 128 kB code space

Keil/ARM MDK

IAR Embedded Workbench

Code_Red Red Suite

Rowley Crossworks compilers

42

Most embedded programmers write in C code. The ‘ARM ecosystem’ provides a lot of choices for a C Compiler and Integrated Design Environment so embedded programs can start code development on a PC, Linux system or MAC.

Page 43: USB - What would the Guru do? - NXP.com

Combine with a Hardware Debugger Hardware Debuggers

NXP LPCLink (on LPCXpresso Boards)

Segger J-Link

IAR/Signum I-Jet/JTAGjet

Keil/ARM ULink2

Code Red Red Probe

Hitex Tantino

Lauterbach Trace32

Any debugger supporting ARM

43

A hardware debugger or debug adapter connects a PC's USB port to a developer’s target system (via JTAG or SWD interfaces) allowing developers to code and debug embedded software on target hardware. Some debuggers are integrated into development boards (like LPCXpresso)

Page 44: USB - What would the Guru do? - NXP.com

Add an Evaluation/Development Board

Boards available from: – NXP LPCXpresso – Embedded Artists – IAR – Keil/ARM (including mbed) – Code Red – Hitex – Embest – NGX

Purchase from NXP distributors or directly from vendors

Other boards are available directly from various vendors

Specialty boards available for motor control, Android accessories, and more

44

Evaluation and development boards provide developers a hardware platform for testing software before customer prototypes are available

Page 45: USB - What would the Guru do? - NXP.com

Or a Rapid Prototyping / Evaluation Board

NXP’s LPCXpresso – Combines with LPCXpresso IDE for a low cost

evaluation/development platform

– Over 1,000 community members on the LPCXpresso forum

– Various Baseboards available

mbed Rapid Prototyping – More than 15,000 mbed boards shipped! – LPC1768 and LPC11U24 mbed boards available – Compatible with LPCXpresso form-factor – Various base boards shipping

http://lpcxpresso.com

http://mbed.org/ Rapid prototyping

boards are low cost and time efficient ways to evaluate microcontrollers

NGX Xplorer – Low cost evaluation board based

on LPC1800/LPC4300) – Bundled with Keil’s UlinkME

debugger NGX LPC4330 Xplorer Board

45

Page 46: USB - What would the Guru do? - NXP.com

Take Advantage of Free NXP software Free USB Libraries – LPCUSBlib

Full-featured, open-source USB library designed to run on all USB capable LPC microcontrollers from NXP

Host (OHCI and EHCI) and device modes

Low, full and high speed transfer rates

Control, bulk, interrupt, and isochronous transfer types

46

Free Lightweight IP (LWIP) Networking Stack Ideal for networking applications that require a low memory footprint Supports standalone (unthreaded) operation using the LWIP raw API For threaded LWIP support, see the FreeRTOS LWIP port

Free Graphic Libraries emWin by Segger -- Robust, efficient GUI for any application operating with a graphical LCD. FREE when used on any LPC MCUs! Simple Windows Interface Manager (SWIM) – free ‘basic’ graphics library. Very low overhead required

These and more code for LPC micros available at www.lpcware.com

Page 47: USB - What would the Guru do? - NXP.com

GETTING SUPPORT

47

LPCWARE.COM LPCZONE e-learning and books More support

Page 48: USB - What would the Guru do? - NXP.com

LPCware.com

NXP sponsored technical site for engineers interested in all things LPC!

Resources for getting you up and running with your new hardware, including:

– Tutorials – Software or driver packages – Forums – Schematics – Tools – FAQs – Design tips, and much more

48

LPCware.com

Page 50: USB - What would the Guru do? - NXP.com

For more information visit:

www.nxp.com/microcontrollers

50

Thank You