Presentation is loading. Please wait.

Presentation is loading. Please wait.

ID 222L: Get Connected with USB on RX62N

Similar presentations


Presentation on theme: "ID 222L: Get Connected with USB on RX62N"— Presentation transcript:

1 ID 222L: Get Connected with USB on RX62N
In the market place today the myth about embedded Ethernet is that it very hard to achieve. In this presentation and lab, I will show you that Open-Source TCP/IP stacks with freely available tools are now true enablers for less costly embedded Ethernet products. Michael Thomas Applications Engineer 13 October 2010 Version: 1.8 © 2010 Renesas Electronics America Inc. All rights reserved.

2 Michael Thomas Applications Engineer PREVIOUS EXPERIENCE:
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 © 2010 Renesas Electronics America Inc. All rights reserved.

3 Renesas Technology and Solution Portfolio
Microcontrollers & Microprocessors #1 Market share worldwide * Solutions for Innovation Analog and Power Devices #1 Market share in low-voltage MOSFET** ASIC, ASSP & Memory Advanced and proven technologies In the session 110C, Renesas Next Generation Microcontroller and Microprocessor Technology Roadmap, Ritesh Tyagi introduces this high level image of where the Renesas Products fit. The big picture. * 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). © 2010 Renesas Electronics America Inc. All rights reserved.

4 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** This is where our session, 411L A Direct Drive LCD Software Solution for Driving a Color TFT-LCD Panel, is focused within the ‘Big picture of Renesas Products’ * 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.

5 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 Legacy Cores Next-generation migration to RX H8S H8SX M16C R32C Here are the MCU and MPU Product Lines, I am not going to cover any specific information on these families, but rather I want to show you where this session is focused General Purpose Ultra Low Power Embedded Security Up to 10 DMIPS, 130nm process 350 uA/MHz, 1uA standby Capacitive touch Up to 25 DMIPS, 150nm process 190 uA/MHz, 0.3uA standby Application-specific integration Up to 25 DMIPS, 180, 90nm process 1mA/MHz, 100uA standby Crypto engine, Hardware security 5 © 2010 Renesas Electronics America Inc. All rights reserved.

6 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 Legacy Cores Next-generation migration to RX H8S H8SX M16C R32C These are the products where this presentation applies RX Ethernet, CAN, USB, UART, SPI, IIC General Purpose Ultra Low Power Embedded Security Up to 10 DMIPS, 130nm process 350 uA/MHz, 1uA standby Capacitive touch Up to 25 DMIPS, 150nm process 190 uA/MHz, 0.3uA standby Application-specific integration Up to 25 DMIPS, 180, 90nm process 1mA/MHz, 100uA standby Crypto engine, Hardware security 6 © 2010 Renesas Electronics America Inc. All rights reserved.

7 Innovation Ever since it was introduced, USB has been proliferating at an exponential pace; first as the intended replacement for the serial port and then as the de-facto port on most consumer electronics... including keyboards, mice, cell-phones, mass storage devices, cameras, models, webcams, programmers, printers, gaming consoles, Every device in the pictures on this slide uses the Renesas USB IP… We also provide a free highly capable and well documented stack allowing you to easily develop your product. © 2010 Renesas Electronics America Inc. All rights reserved.

8 Renesas USB Solution USB is a widely adopted IP with Renesas provides a highly capable, free, and easy to use stack Ever since it was introduced, USB has been proliferating at an exponential pace; first as the intended replacement for the serial port and then as the de-facto port on most consumer electronics. including keyboards, mice, cell-phones, mass storage devices, cameras, models, webcams, programmers, printers, gaming consoles, Every device in the pictures on this slide uses the Renesas USB IP… We also provide a free highly capable and well documented stack allowing you to easily develop your product. © 2010 Renesas Electronics America Inc. All rights reserved.

9 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 © 2010 Renesas Electronics America Inc. All rights reserved.

10 Renesas Electronics USB MCU Family
Super-Speed USB3.0 ASSP Hi-Speed 32 bit SH4A RX600 V850Mx Full-Speed SH2A RX200** V850Jx 8/16 bit H8SX This is an overview of the USB offering from Renesas. M16C 78K0R H8S R8C** 78K0 Both Host & Peripheral Peripheral Only © 2010 Renesas Electronics America Inc. All rights reserved.

11 Stack support for all the above RX600
The RX62N USB Block Uses the USB IP 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 RX600 The USB IP on the RX is the 66597; this is the same one from the SH family. It is USB 2.0 compliant; supports full-speed and low speed and has both host and function support. The device can enunmerate a maximum of 10 devices including 2 hubs. Some MCUs also have Dual IPs allowing them to be a simultaneous host and function over dofferent ports The IP also support OTG operations All of these features need to have stack support and the USB Stack from Renesas supports/will support all of these. © 2010 Renesas Electronics America Inc. All rights reserved.

12 OS / RTOS 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 This is a quick overview of the USB software from Renesas for the RX62N. ON the Host side we support all the transport types and the stack does not require an RTOS. The Interface is uniform across families so migrating from one family to another is painless. It also uses the standard stdio interface allowing for an easy learning curve. On the Function side we have support for 4 of the most widely used USB classes viz CDC, HID, MSC and LibUSB which is a vendor defined open source Bulk Only program. We also have third party USB stack from Micrium which are equally capable and in addition also have RTOS support for people who need that. Third Party Support -Micrium USB Stack OS / RTOS © 2010 Renesas Electronics America Inc. All rights reserved.

13 Renesas USB Stack Architecture
RX62N RSK Application Software ANSI I/O Interface OTG Switching Driver OTG Driver Peri_Printer Driver Host_Printer Driver Host_MSC Driver Host_HID Driver Host_Audio Driver Peri_MSC Driver Peri_HID Driver Peri_COM Driver Class Drivers This is an architectural view of the Renesas USB stack. The USB IP on the RX is the 66597; this is the same one from the SH family. The Basic firmware is comprised of the PCD and HCD which adhere to a Control Driver Interface which is used by the class drivers to communicate with the USB IP. The Class drivers are implemented based on the user requirements. For example in this case we have the Peripheral CDC, HID and MSC and the Host MSC, CDC and Audio drivers In case of the Host drivers we use an ANSI IO interface which abstracts the driver layer as well making it easier for a programmer to use the stack. This however is just a Renesas approach and as a user you are fully free to follow your own implementation. The application softeare then uses the standard ANSI calls when using the host stack and for the function uses the driver API for each class as defined. All the interfaces are well documented so if you wanted to create drivers for additional classes you could do so easily just by following the examples and using the Control Driver API. The OTG driver also existds as two pieces and in reality is just a switching mechanism between the Host and Function stacks, All of the highlighted ones are provided from free on the RX62N RSK. API (Control Driver Interface) USB-Basic F/W USB Peripheral Control Driver (PCD) USB Host Control Driver (HCD) RX620 USB IP (66597) © 2010 Renesas Electronics America Inc. All rights reserved.

14 Lab Overview © 2010 Renesas Electronics America Inc. All rights reserved.

15 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 I this lab we will attempt to create a data logger. First the device will enumerate as a CDC class function device. It will display a menu on TerraTerm that the user can use to download a new file to the MCU and start and stop Data logging. Then when the user plugs in a mass storage device, it will be enumerated and the Host(the RX2N in this case) will transfer all the logged data from the MCu to the MSC device. © 2010 Renesas Electronics America Inc. All rights reserved.

16 Communications Class Device Designed to emulate communication devices
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 CDC stands for comms class device. It was designed to replace comms devices like Phones Models fax machines etc. The common method of operation for all these devices is that they all use a low bandwidth channel for the actual call setup and then use the high bandwidth channel for the actual data transfer. The CDC class emulates this model by using the control and Interrupt endpoints for the low bandwidth setup info and the Bulk IN/.OUT endpoints for transfer data. It is the widely used replacement for the RS232 port. The port is emulate don Windows so any app that was developed for legacy products with RS232 interface can be updated to use the USB port and the Windows app will not know the difference. © 2010 Renesas Electronics America Inc. All rights reserved.

17 Renesas USB Function API
USB Sample Code libusb_app.c HID Demo usb_hid_app.c CDC Demo usb_cdc_app.c MSC Demo usb_msc_app.c LibUSB Demo USB Function Stack Classes HID usb_hid.c CDC usb_cdc.c MSC usb_msc.c Vendor Defined Hardware Abstraction Layer (HAL) usb_hal.c USB Core Driver usb_core.c This slide shows the different layers of the USB Function stack and the files that they are contained in At the bottom level forming eh PCD or Peripheral OCntrol Driver is the HAL file and the Core Driver files The individual class drivers communicate with an API (Control API) provided by this layer. The user sample code (in this case the demo for each class) then uses the function calls to each class driver. Note that the interface to the class driver is not a standard one and varies between demos However as the user it is this interface that you will be using…unless of course you want to create a new class in which case you will be using the interface with the HAL and coredriver to create your own class. USB Hardware © 2010 Renesas Electronics America Inc. All rights reserved.

18 Renesas USB Function API
CDC usb_cdc.c This slide shows the different layers of the USB Function stack and the files that they are contained in At the bottom level forming eh PCD or Peripheral OCntrol Driver is the HAL file and the Core Driver files The individual class drivers communicate with an API (Control API) provided by this layer. The user sample code (in this case the demo for each class) then uses the function calls to each class driver. Note that the interface to the class driver is not a standard one and varies between demos However as the user it is this interface that you will be using…unless of course you want to create a new class in which case you will be using the interface with the HAL and coredriver to create your own class. © 2010 Renesas Electronics America Inc. All rights reserved.

19 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); Since we are going to be using the CD class in this lab, here is the API as defined by the CD class. A lot of the names are self explanatory. The one thing Id like to point out is the Write vs the Write_ASync and the Read vs the Read_Async functions. The Write and Read are blocking functions…meaning that the function will block until the write or read function is called…which is why they do not have a call back function, The Async functions on the other hand are non-blocking.. Meaning that they will pass the parameters to the stack and return. Note the Call-back functions in each of the Async calls… these are called by the USB stack once the read/write operation is done. In this lab you will have the opportunity to use either one….I suggest the non-blocking one. © 2010 Renesas Electronics America Inc. All rights reserved.

20 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! In this lab you will learn how to Setup the DDLCD kit, Compile the sample program, Download Resources to the SPI flash and Run the program. CDC demo from the Renesas Starter Kit (RSK) Connect, compile and run Demonstrates data transfer over RS232 emulated by CDC © 2010 Renesas Electronics America Inc. All rights reserved.

21 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. © 2010 Renesas Electronics America Inc. All rights reserved.

22 Simple File Transfer protocol Public Domain Specification
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 XModem is a simple file transfer protocol created in 1977. It is a public domain spec and a very simplistic one. There have been newer versions of it with more complicated error checking etc. However when laid over USB the error cheking is moslty redundant because USB has inbuilt error checking mechanisms. In this lab you will be using XModem to download a file to the MCU © 2010 Renesas Electronics America Inc. All rights reserved.

23 Slave sends a <NACK> when ready Host sends down 134 bytes
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 More detail on XModem Operation. The transfer is initiated by the Slave… the RX62N in this case. When it is ready it sends a NACK and the host sends down 134 bytes of data. The 134 bytes is comprised of a 1 byte start header, a 1 byte packet number, a 1 byte packet number bit complemented, 128 bytes of data and 3 byte checksum. The slave will send an ACK if the data is valid; it performs a check sum on the packet and compares to validate. The host will then send the next chunk of data IF the checksum is invalid the slave sends a NACK asking the host to resend the date Once the host has sent all the data it sends out an EOT packet. The implemetation is in the XModem.c and XModem.h files This software currently only supports sending data TO the MCU. It isnot included as part of the RSK, but is avaialble with an application note on the website. © 2010 Renesas Electronics America Inc. All rights reserved.

24 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 The XModem interface consists of a single self contained function call XmodemDownloadOverUSB() which takes as its argument a call back function. The port is fully compliant with the XModem protocol including error checking and timeouts The XModem port uses a hardware timer to keep track of time and handle timeouts The function return a success or failure after the entire transaction is completed. The callback function will be called when each 128 byte packet is received. Typically the callback is used to assemble the received data out of the buffer into a place when the application needs to use it. In this lab you will use the main function call to start the XModem transfer and then create the callback function to assemble the received data into a separate location in memory. © 2010 Renesas Electronics America Inc. All rights reserved.

25 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! Create a Menu based data logger Download a new coefficient file over XModem © 2010 Renesas Electronics America Inc. All rights reserved.

26 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. © 2010 Renesas Electronics America Inc. All rights reserved.

27 STDIO Overview C & C++ standard library Users Application / Middleware
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.) A quick overview of Stdio.. Everyone is familiar with it..the standard fopen,fclose,fprintf interface.. Provided with msot C compilers including the Renesas compilers. The standard driver model is to have the hardware layer controlled by the core stack and then an object lkevel driver if multiple instances need to be managed. By adding an STDIO interface to this, the learning curve becomes much more shallow because most developers are already familiar with it and it has a model that allows for access with permissions. Thus the same stdio interface can be used to talk to any driver in the system be it Ethernet or USB .. This also makes the system much more portable. © 2010 Renesas Electronics America Inc. All rights reserved.

28 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 Advantages Dynamic Linking of IO Resource Simple Consistent Interface Flexible operation Built in buffering (fread, fwrite) “Black Box” operation. Read and Write access control. Protection from concurrent access. Well known by C programmers Disadvantage: Larger memory.. But this is not an issue on parts like the RX interface layer reduces users application complexity and no need to understand “objects” API. In effect what we are doing her is using the built-in stdio interface to © 2010 Renesas Electronics America Inc. All rights reserved.

29 OS Free USB Host Mass Storage Demo
OS / RTOS OS Free USB Host Mass Storage Demo GPL Licensed Open Source Standard ANSI IO Interface Add more drivers like Audio Class No OS/RTOS USB Host Stack + Demo ANSI IO Interface fopen, fclose, fread, fwrite, fcontrol Renesas Owned IP USB Host Stack Audio Class DD FullFAT MS Class DD No operating system or scheduler Easy to understand, portable, documented. Fully working demonstration includes: Mass Storage Class Host Driver Licensed free (open source) implementation of FAT disk access. 66597 IP supports maximum 10 devices (8 peripherals and 2 hubs) are fully supported by stack. Completed for Bulk and Control Transfers All USB transports supported. Any compliant USB device is fully enumerated. Specific devices can be used by adding driver support. Separate class driver(s) interface based on ANSI IO. (66597) Peripheral driver is separate to allow support of newer IP. Hardware driver is separate to allow support of other platforms Write >9MByte/S Read >16MByte/S with SanDisk USB memory Any MS Device Supported Hardware Device Driver DD = Device Driver MS = Mass Storage © 2010 Renesas Electronics America Inc. All rights reserved.

30 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! In this lab you will required to edit a scheme to allow for different button effects. The total estimated time to finish this session is about 30 minutes © 2010 Renesas Electronics America Inc. All rights reserved.

31 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. © 2010 Renesas Electronics America Inc. All rights reserved.

32 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 IN this lab you learnt how to use the Renesas Host and Function APIs to communicate with a PC and a MSC class device. You also learnt how to use XModem to transfer files to your PC and how the CDC class works. This usually covers most user requirements the rest being either HID or Vendor defined both of which we have support for in the sample code on the RSKs. © 2010 Renesas Electronics America Inc. All rights reserved.

33 Questions? © 2010 Renesas Electronics America Inc. All rights reserved.

34 Innovation Ever since it was introduced, USB has been proliferating at an exponential pace; first as the intended replacement for the serial port and then as the de-facto port on most consumer electronics..including keyboards, mice, cell-phones, mass storage devices, cameras, models, webcams, programmers, printers, gaming consoles, Every device in the pictures on this slide uses the Renesas USB IP… We also provide a free highly capable and well documented stack allowing you to easily develop your product. © 2010 Renesas Electronics America Inc. All rights reserved.

35 Thank You! © 2010 Renesas Electronics America Inc. All rights reserved.

36


Download ppt "ID 222L: Get Connected with USB on RX62N"

Similar presentations


Ads by Google