ID_222L_Thomas_RXUSB - Renesas e

Download Report

Transcript ID_222L_Thomas_RXUSB - Renesas e

ID 222L: Get Connected with
USB on RX62N
Renesas Electronics America Inc.
Michael Thomas
Applications Engineer
13 October 2010
Version: 1.8
© 2010 Renesas Electronics America Inc. All rights reserved.
Michael Thomas
 Applications Engineer
 Customer and market segment projects.
 Support and Collateral for Renesas
solutions:
– USB
– Direct Drive LCD
– IKAP
 PREVIOUS EXPERIENCE:
 Engineer at D-Link
 I hold an MSEE from the University of
North Carolina
2
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Technology and Solution Portfolio
Microcontrollers
& Microprocessors
#1 Market share
worldwide *
ASIC, ASSP
& Memory
Advanced and
proven technologies
Solutions
for
Innovation
Analog and
Power Devices
#1 Market share
in low-voltage
MOSFET**
* MCU: 31% revenue
basis from Gartner
"Semiconductor
Applications Worldwide
Annual Market Share:
Database" 25
March 2010
** Power MOSFET: 17.1%
on unit basis from
Marketing Eye 2009
(17.1% on unit basis).
3
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Technology and Solution Portfolio
Microcontrollers
& Microprocessors
#1 Market share
worldwide *
Solutions
for
Innovation
ASIC, ASSP
& Memory
Advanced and
proven technologies
Analog and
Power Devices
#1 Market share
in low-voltage
MOSFET**
* MCU: 31% revenue
basis from Gartner
"Semiconductor
Applications Worldwide
Annual Market Share:
Database" 25
March 2010
** Power MOSFET: 17.1%
on unit basis from
Marketing Eye 2009
(17.1% on unit basis).
4
© 2010 Renesas Electronics America Inc.
All rights reserved.
Microcontroller and Microprocessor Line-up
Superscalar, MMU, Multimedia
High Performance CPU, Low Power
High Performance CPU, FPU, DSC
 Up to 1200 DMIPS, 45, 65 & 90nm process
 Video and audio processing on Linux
 Server, Industrial & Automotive
 Up to 500 DMIPS, 150 & 90nm process
 600uA/MHz, 1.5 uA standby
 Medical, Automotive & Industrial
 Up to 165 DMIPS, 90nm process
 500uA/MHz, 2.5 uA standby
 Ethernet, CAN, USB, Motor Control, TFT Display
 Legacy Cores
 Next-generation migration to RX
General Purpose
 Up to 10 DMIPS, 130nm process
 350 uA/MHz, 1uA standby
 Capacitive touch
5
© 2010 Renesas Electronics America Inc.
All rights reserved.
Ultra Low Power
Embedded Security
 Up to 25 DMIPS, 150nm process  Up to 25 DMIPS, 180, 90nm process
 190 uA/MHz, 0.3uA standby
 1mA/MHz, 100uA standby
 Application-specific integration  Crypto engine, Hardware security
Microcontroller and Microprocessor Line-up
 Up to 1200 DMIPS, 45, 65 & 90nm process
 Video and audio processing on Linux
 Server, Industrial & Automotive
Superscalar, MMU, Multimedia
 Up to 500 DMIPS, 150 & 90nm process
 600uA/MHz, 1.5 uA standby
 Medical, Automotive & Industrial
High Performance CPU, Low Power
 Up to 165 DMIPS, 90nm process
 500uA/MHz, 2.5 uA standby
 Ethernet, CAN, USB, Motor Control, TFT Display
High Performance CPU, FPU, DSC
RX
 Legacy Cores
 Next-generation migration to RX
Ethernet, CAN, USB, UART, SPI, IIC
General Purpose
 Up to 10 DMIPS, 130nm process
 350 uA/MHz, 1uA standby
 Capacitive touch
6
© 2010 Renesas Electronics America Inc.
All rights reserved.
Ultra Low Power
Embedded Security
 Up to 25 DMIPS, 150nm process  Up to 25 DMIPS, 180, 90nm process
 190 uA/MHz, 0.3uA standby
 1mA/MHz, 100uA standby
 Application-specific integration  Crypto engine, Hardware security
Innovation
7
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas USB Solution
USB is a widely adopted IP with Renesas provides a highly
capable, free, and easy to use stack
8
© 2010 Renesas Electronics America Inc.
All rights reserved.
Agenda
 Renesas USB Family and Stack Architecture
 What is CDC?
 Renesas USB Function API
 Lab Session 1
 Create and run CDC program
 Lab Session 2
 Use XModem
 Renesas USB Host API
 Lab Session 3
9
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Electronics USB MCU Family
Super-Speed
Hi-Speed
USB3.0
ASSP
32 bit
Full-Speed
SH4A
RX600 V850Mx
SH2A
RX200** V850Jx
8/16 bit
H8SX
M16C 78K0R H8S
R8C**
78K0
Both Host & Peripheral
Peripheral Only
10
© 2010 Renesas Electronics America Inc.
All rights reserved.
The RX62N USB Block
 Uses the 66597 USB IP
RX600
 Host and Function support
 USB 2.0 compliant
 Maximum 10 devices
 Dual IP
 Simultaneous Host and Function
 OTG capability
 Stack support for all the above
11
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas USB software
Function Stack
Four classes of USB
devices:
Serial (CDC)
Human Interface (HID)
Mass Storage (MSC)
LibUSB
USB Host Stack
Standard ANSI IO interface.
Same interface across
families
No RTOS or OS required
All transport types supported
Third Party Support
-Micrium USB Stack
OS / RTOS
12
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas USB Stack Architecture
RX62N RSK
Host_Printer Driver
Host_Audio Driver
Host_HID Driver
Host_MSC Driver
Peri_MSC Driver
Peri_HID Driver
Peri_COM Driver
Peri_Printer Driver
OTG Switching Driver
Application Software
ANSI I/O Interface
Class Drivers
API (Control Driver Interface)
OTG
Driver
USB Peripheral Control
Driver (PCD)
USB Host Control Driver
(HCD)
RX620 USB IP (66597)
13
© 2010 Renesas Electronics America Inc.
All rights reserved.
USB-Basic F/W
Lab Overview
14
© 2010 Renesas Electronics America Inc.
All rights reserved.
USB Data Logger
 Enumerate as a CDC class function device
 Display a menu to control device activity




Start Logging
Stop Logging
Erase data
Download new coefficients over XModem
 Enumerate a Mass Storage Class device
 Create a new file
 Transfer logged data to Mass Storage device
15
© 2010 Renesas Electronics America Inc.
All rights reserved.
What is CDC?
 Communications Class Device
 Designed to emulate communication devices
 Telecom applications: Phones, Modems. Fax machines
 Networking applications: Ethernet
 Composite Class comprised of
 Communications Interface: INTERRUPT endpoint
 Data Interface: BULK IN/OUT endpoints
16
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas USB Function API
USB Sample
Code
HID
Demo
CDC
Demo
MSC
Demo
usb_hid_app.c
usb_cdc_app.c
usb_msc_app.c
LibUSB
Demo
libusb_app.c
USB Function
Stack
HID
CDC
MSC
usb_hid.c
usb_cdc.c
usb_msc.c
Hardware
Abstraction
Layer (HAL)
usb_hal.c
USB Hardware
17
© 2010 Renesas Electronics America Inc.
All rights reserved.
Vendor
Defined
USB Core Driver
usb_core.c
Classes
Renesas USB Function API
CDC
usb_cdc.c
18
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas USB API: CDC
(usb_cdc.h, usb_cdc.c)
 USBCDC_Init(void);
 USBCDC_IsConnected(void);
 USBCDC_Write(UINT32 _NumBytes, UINT8* _Buffer);
 USBCDC_Write_Async(UINT32 _NumBytes, UINT8*_Buffer, CB_DONE _cb);
 USBCDC_WriteString(const char* const _sz);
 USBCDC_PutChar(UINT8 _Char);
 USBCDC_Read(UINT32 _BufferSize, UINT8* _Buffer, UINT32*
_pNumBytesRead);
 USBCDC_Read_Async(UINT32 _BufferSize, UINT8* _Buffer, CB_DONE_OUT
_cb);
 USBCDC_GetChar(UINT8* _pChar);
 USBCDC_Cancel(void);
19
© 2010 Renesas Electronics America Inc.
All rights reserved.
Start the Lab: Using the CDC API
 Keep your dice turned to 1. (Instructions
are provided in the lab handout)
 Please refer to the Lab Handout and let’s get started!
20
© 2010 Renesas Electronics America Inc.
All rights reserved.
Checking Progress of Session 1
 We are using the die to keep track of where everyone is in
the lab. Make sure to update it as you change sections.
 When done with the lab session, have the die 6 pointing up
as shown here.
21
© 2010 Renesas Electronics America Inc.
All rights reserved.
XModem
 Simple File Transfer protocol
 Public Domain Specification
 Packet data transfer model (128+4 bytes)
 Supported by TerraTerm, HypterTerminal etc
 Written in 1977; updated to YModem and ZModem
 Used as a method to download files over USB in this lab
22
© 2010 Renesas Electronics America Inc.
All rights reserved.
XModem Operation
 Slave sends a <NACK> when ready
 Host sends down 134 bytes





1 start of header byte <SOH>
Packet number in binary; wraps around at 0xFF
Packet number (bit complemented)
128 bytes of data
Checksum
 Slave sends <ACK/NACK> for new/repeat data if checksum
valid/invalid
 Host sends End of transfer <EOT> when done
 Xmodem.h contains definitions
 Xmodem.c contains implementation
 Available with application note on the website
23
© 2010 Renesas Electronics America Inc.
All rights reserved.
XModem API: CDC (xmodem.h, xmodem.c)
 Single function call
 char XmodemDownloadOverUSB(_cb CopyRxPackets);
 Fully compliant with XModem protocol
 Hardware timer to track time
 Returns a success or failure
 Callback function called when every 128 byte packet received
24
© 2010 Renesas Electronics America Inc.
All rights reserved.
Start the Lab : Using XModem over CDC
 Keep your dice turned to 2. (Instructions
are provided in the lab handout)
 Please refer to the Lab Handout and let’s get started!
25
© 2010 Renesas Electronics America Inc.
All rights reserved.
Checking Progress of Session 2
 We are using the die to keep track of where everyone is in
the lab. Make sure to update it as you change sections.
 When done with the lab session, have the die 6 pointing up
as shown here.
26
© 2010 Renesas Electronics America Inc.
All rights reserved.
STDIO Overview
 C & C++ standard library
 supplied with all C & C++
compilers.
 Allows standard IO functions to
be used
(printf, fprintf, cin, cout)
 Generic access layer for
accessing an object of any type.




Files,
Devices
Protocol Drivers
Peripherals
Users Application / Middleware
STDIO
(Open, Close, Read, Write, Control)
Object
(File, Device Driver, Class, etc)
Core Stack
Hardware Control
(HAL, VLLD, RPDL, etc.)
27
© 2010 Renesas Electronics America Inc.
All rights reserved.
STDIO Overview
 Defined interface
 Open
– Initialise an object to enable read and/or write access
 Close
– Close and disable an object – releasing any resources.
 Read
– Using the identifier from “Open” read data from the object.
 Write
– Using the identifier from “Open” write data to the object.
 (Control)
– Extension to the STDIO interface to allow configuration of
the object.
 Adds abstraction layer for easy portability
28
© 2010 Renesas Electronics America Inc.
All rights reserved.
OS Free USB Host Mass Storage Demo
Write >9MByte/S
Read >16MByte/S
USB Host Stack + Demo
Renesas Owned IP
 GPL Licensed Open
Source
 Standard ANSI IO
Interface
 Add more drivers like
Audio Class
 No OS/RTOS
OS / RTOS
ANSI IO Interface
fopen, fclose,
fread, fwrite, fcontrol
USB
Host
Stack
FullFAT
Audio Class
DD
MS Class DD
Hardware Device Driver
with SanDisk USB memory
Any MS Device Supported
DD = Device Driver
MS = Mass Storage
29
© 2010 Renesas Electronics America Inc.
All rights reserved.
Start the Lab: Using the Mass Storage Host API
 Keep your dice turned to 3. (Instructions
are provided in the lab handout)
 Please refer to the Lab Handout and let’s get started!
30
© 2010 Renesas Electronics America Inc.
All rights reserved.
Checking Progress of Session 3
 We are using the die to keep track of where everyone is in
the lab. Make sure to update it as you change sections.
 When done with the lab session, have the die 6 pointing up
as shown here.
31
© 2010 Renesas Electronics America Inc.
All rights reserved.
Agenda
 Renesas USB Family and Stack Architecture
 What is CDC?
 Renesas USB Function API
 Lab Session 1
 Create and run CDC program
 Lab Session 2
 Use XModem
 Renesas USB Host API
 Lab Session 3
32
© 2010 Renesas Electronics America Inc.
All rights reserved.
Questions?
33
© 2010 Renesas Electronics America Inc.
All rights reserved.
Innovation
34
© 2010 Renesas Electronics America Inc.
All rights reserved.
Thank You!
35
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Electronics America Inc.