Application Note. 8-bit Microcontrollers. AVR293: USB Composite Device



Similar documents
Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

Application Note. 8-bit Microcontrollers. AVR272: USB CDC Demonstration UART to USB Bridge

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

AVR32701: AVR32AP7 USB Performance. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1922: Xplain Board Controller Firmware. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

AVR1318: Using the XMEGA built-in AES accelerator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

AVR033: Getting Started with the CodeVisionAVR C Compiler. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1600: Using the XMEGA Quadrature Decoder. 8-bit Microcontrollers. Application Note. Features. 1 Introduction. Sensors

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

AVR2006: Design and characterization of the Radio Controller Board's 2.4GHz PCB Antenna. Application Note. Features.

AVR353: Voltage Reference Calibration and Voltage ADC Usage. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

AVR1510: Xplain training - XMEGA USART. 8-bit Microcontrollers. Application Note. Prerequisites. 1 Introduction

Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

AT89C5131A Starter Kit... Software User Guide

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

3-output Laser Driver for HD-DVD/ Blu-ray/DVD/ CD-ROM ATR0885. Preliminary. Summary. Features. Applications. 1. Description

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

Application Note. C51 Bootloaders. C51 General Information about Bootloader and In System Programming. Overview. Abreviations

Application Note. USB Microcontrollers. USB PC Drivers Based on Generic HID Class. 1. Introduction

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

AVR ONE!... Quick-start Guide. EVK Windows 32104B AVR ONE! 02/10

AT91SAM ARM-based Flash MCU. Application Note

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR030: Getting Started with IAR Embedded Workbench for Atmel AVR. 8-bit Microcontrollers. Application Note. Features.

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR2004: LC-Balun for AT86RF230. Application Note. Features. 1 Introduction

USER GUIDE. ZigBit USB Stick User Guide. Introduction

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AT88CK490 Evaluation Kit

General Porting Considerations. Memory EEPROM XRAM

Application Note. 8-bit Microcontrollers. AVR280: USB Host CDC Demonstration. 1. Introduction

AT91 ARM Thumb Microcontrollers. AT91SAM CAN Bootloader. AT91SAM CAN Bootloader User Notes. 1. Description. 2. Key Features

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR055: Using a 32kHz XTAL for run-time calibration of the internal RC. 8-bit Microcontrollers. Application Note. Features.

APPLICATION NOTE. Atmel AT02985: User s Guide for USB-CAN Demo on SAM4E-EK. Atmel AVR 32-bit Microcontroller. Features. Description.

Application Note. Atmel ATSHA204 Authentication Modes. Prerequisites. Overview. Introduction

Application Note. USB Mass Storage Device Implementation. USB Microcontrollers. References. Abbreviations. Supported Controllers

USER GUIDE EDBG. Description

AVR245: Code Lock with 4x4 Keypad and I2C LCD. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

8-bit RISC Microcontroller. Application Note. AVR910: In-System Programming

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

APPLICATION NOTE. Atmel LF-RFID Kits Overview. Atmel LF-RFID Kit. LF-RFID Kit Introduction

8-bit. Application Note. Microcontrollers. AVR273: USB Mass Storage Implementation. Features. 1. Introduction

APPLICATION NOTE. Atmel AT04389: Connecting SAMD20E to the AT86RF233 Transceiver. Atmel SAMD20. Description. Features

AVR106: C functions for reading and writing to Flash memory. 8-bit Microcontrollers. Application Note. Features. Introduction

AT91 ARM Thumb Microcontrollers. Application Note. Interfacing a PC Card to an AT91RM9200-DK. Introduction. Hardware Interface

3-output Laser Driver for HD-DVD/ Blu-ray/DVD/ CD-ROM ATR0885. Preliminary. Summary

AVR134: Real Time Clock (RTC) using the Asynchronous Timer. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

8-bit Microcontroller. Application Note. AVR461: Quick Start Guide for the Embedded Internet Toolkit. Introduction. System Requirements

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

APPLICATION NOTE. Atmel AT01095: Joystick Game Controller Reference Design. 8-/16-bit Atmel Microcontrollers. Features.

8-bit RISC Microcontroller. Application Note. AVR182: Zero Cross Detector

Application Note. Atmel CryptoAuthentication Product Uses. Atmel ATSHA204. Abstract. Overview

8-bit Microcontroller. Application Note. AVR222: 8-point Moving Average Filter

256K (32K x 8) Battery-Voltage Parallel EEPROMs AT28BV256

8-bit RISC Microcontroller. Application Note. AVR155: Accessing an I 2 C LCD Display using the AVR 2-wire Serial Interface

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

AVR32110: Using the AVR32 Timer/Counter. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR1017: XMEGA - USB Hardware Design Recommendations. 8-bit Atmel Microcontrollers. Application Note. Features.

Atmel AT32UC3A3256 microcontroller 64MBit SDRAM Analog input (to ADC) Temperature sensor RC filter

APPLICATION NOTE. AT16268: JD Smart Cloud Based Smart Plug Getting. Started Guide ATSAMW25. Introduction. Features

APPLICATION NOTE. Secure Personalization with Transport Key Authentication. ATSHA204A, ATECC108A, and ATECC508A. Introduction.

Software Prerequisites Linux Ubuntu LTS. Estimated completion time: 15min. The goal of this hands-on is to:

AT86RF230 (2450 MHz band) Radio Transceiver... User Guide

Quick Start Guide. CAN Microcontrollers. ATADAPCAN01 - STK501 CAN Extension. Requirements

AN3354 Application note

8-bit Microcontroller. Application Note. AVR415: RC5 IR Remote Control Transmitter. Features. Introduction. Figure 1.

AVR32100: Using the AVR32 USART. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

Application Note. Migrating from RS-232 to USB Bridge Specification USB Microcontrollers. Doc Control. References. Abbreviations

Atmel AVR ATxmega384C3 microcontroller OLED display with pixels resolution Analog sensors. Ambient light sensor Temperature sensor

AVR1003: Using the XMEGA Clock System. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

MODFLEX MINI GATEWAY ETHERNET USER S GUIDE

Introducing a platform to facilitate reliable and highly productive embedded developments

How to Calculate the Capacitor of the Reset Input of a C51 Microcontroller 80C51. Application Note. Microcontrollers. Introduction

Designing Feature-Rich User Interfaces for Home and Industrial Controllers

8-bit Microcontroller. Application Note. AVR105: Power Efficient High Endurance Parameter Storage in Flash Memory

AVR32737: AVR32 AP7 Linux Getting Started. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

8-bit RISC Microcontroller. Application Note. AVR236: CRC Check of Program Memory

AVR223: Digital Filters with AVR. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR32807: Getting Started with the AVR UC3 Software Framework USB Classes. 32-bit Microcontrollers. Application Note. Features.

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

APPLICATION NOTE. Authentication Counting. Atmel CryptoAuthentication. Features. Introduction

How To Design An Ism Band Antenna For 915Mhz/2.4Ghz Ism Bands On A Pbbb (Bcm) Board

Atmel AVR4905: ASF - USB Device HID Generic. 8-/32-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

CryptoAuth Xplained Pro

64K (8K x 8) Parallel EEPROM with Page Write and Software Data Protection AT28C64B

8-bit Microcontroller. Application Note. AVR400: Low Cost A/D Converter

Quest vworkspace Virtual Desktop Extensions for Linux

New Features and Enhancements

AVR106: C Functions for Reading and Writing to Flash Memory. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Transcription:

AVR293: USB Composite Device Features Combining several USB applications using ONE DEVICE No HUB needed Bus powered 1. Introduction Adding to the flexibility given to the user with the Hot Plug & Play, supplying power from the bus, the automatic detection of the insertion and remove of the device and by providing different transfer modes, the USB allows the user to manage several USB applications using ONE device called COMPOSITE DEVICE. The aim of this document is to describe how to start and implement a composite device application. A familiarity with USB Software Library for AT90USBxxx Microcontrollers (Doc 7675, Included in the CD-ROM & Atmel website) and the CDC specification (http://www.usb.org) is assumed. 8-bit Microcontrollers Application Note Figure 1-1. Composite Device Application 1 MCU USB interface = +

2. Hardware Requirements The USB CDC application requires the following hardware: 1. AVR USB evaluation board (STK525, AT90USBKey, STK526, EVK527...or your own board) 2. AVR USB microcontroller 3. USB cable (Standard A to Mini B) 4. PC running on Windows (2000, XP) with USB 1.1 or 2.0 host Note: Another STK 52x and USB port are required if the PC has no RS232 interface. 3. In system programming and Device Firmware Upgrade To program the device you can use the following methods: The JTAG interface using the JTAGICE MKII The SPI interface using the AVRISP MKII The USB interface thanks to the factory DFU bootloader and Flip software The parallel programming using the STK500 or the STK600 Please refer to the hardware user guide of the board you are using (if you are using Atmel starter kit) to see how to program the device using one of these different methods. Please refer to Flip(1) help content to see how to install the USB driver and program the device through the USB interface. (1)Flip is a software provided by atmel to allow the user to program the AVR USB devices through the USB interface (No external hardware required) thanks to the factory DFU bootloader. 2 AVR293

AVR293 4. Quick Start Once your device is programmed with hex file (depending on which composite device demo you are using), click on Start Application button on Flip or push the reset button from the used board to start the composite device demonstration. Check that your device is enumerated as composite device (see Figure 6-1), then you can use the board as a mouse, removable disk and Generic HID (you may have less or more applications depending on which demo you are using) at the same time. Figure 4-1. Composite Device enumeration 3

The figure below shows the STK525 used by the demo (you may use another kit: AT90USBKey, STK526.., depending on the AVR USB product you are working with): Figure 4-2. STK525 RS232 Connector USB Connector Joystick 4.1 Composite Device The purpose of the Composite Device demonstration is to show the user how to manage several USB applications using only one USB controller. Depending on which demonstartion you are uisng, when you cannect your device to you PC, you will see two or more of below applications appear in your device manager, and you can use each application in stand alone mode: USB mouse: you can move the mouse pointer using the joystic or the buttons of youyr board USB Mass Storage (removable disk): a new removable disk will appear, and you can transfer file with the onboard dataflash of your board (or any other memory depending on which board you are using) Generic HID device: please refer to the Generic HID application note: doc7599 4 AVR293

AVR293 5. Application Overview To implement a Composite Device application, the user has to integrate several interfaces in his device (one for each application). The figure below shows the descriptors structure: Figure 5-1. Composite Device Overview Device descriptor Configuration Descriptor Inetrface 1 Interface 2... Descriptor Descriptor Interface 'n' Descriptor To add new interface to manage an adding application using the same controller, you have to modify the number of interfaces supported by the configuration descriptor, add the interface descriptor, the endpoint descriptors and the related specific requests management. 5

6. Firmware As explained in the USB Software Library for AT90USBxxx Microcontrollers (Doc 7675, included in the USB CD-ROM ) all USB firmware packages are based on the same architecture (please refer to this document for more details). To add new interface, the follwoing files have to be modified: 6.1 usb_descriptors.h This file contains the definition of the descriptors parameters. You have to modify and add the following parameters when you want to customize one of our demo to build a composite device or add a new interface to a current composite device: Modify the VID/PID of the device descriptor. Each USB application must have its own and unique VID/PID: // USB Device descriptor #define USB_SPECIFICATION 0x0200 #define DEVICE_CLASS 0 // each configuration has its own class #define DEVICE_SUB_CLASS 0 // each configuration has its own subclass #define DEVICE_PROTOCOL 0 // each configuration has its own protocol #define EP_CONTROL_LENGTH 64 #define VENDOR_ID VID_ATMEL #define PRODUCT_ID PID_MegaMS #define RELEASE_NUMBER 0x1000 #define MAN_INDEX 0x01 #define PROD_INDEX 0x02 #define SN_INDEX 0x03 #define NB_CONFIGURATION 1 Note: The class, subclass and protocol parameter must be set to 0 in the device descriptor. Each interface will specify its own class/subclass/protocol parameter. Modify the number of interfaces supported by the configuration s descriptor: // USB Configuration descriptor #define NB_INTERFACE N // Number of interfaces #define CONF_NB 1 #define CONF_INDEX 0 #define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED #define MAX_POWER 50 // 100 ma Add the descriptor of your new interafce. Please note that the first interface start with the number 0, the next one should be number 1 and so on. So, depending on how many interfaces you have in you application, this new one should be number (n+1). n is the number of the last interface.the example hereunder shows the interface s descriptor of a Mass Storage application: // USB Interface descriptor #define INTERFACE_NB n+1 // Interface's number #define ALTERNATE 0 #define NB_ENDPOINT 2 #define INTERFACE_CLASS MS_CLASS // Mass Storage Class 6 AVR293

AVR293 #define INTERFACE_SUB_CLASS MS_SUB_CLASS6 // SCSI transparent Command Set #define INTERFACE_PROTOCOL MS_PROTOCOL // Bulk-Only Transport #define INTERFACE_INDEX 0 Than, depending on the class you added with this new interface, you have to add the related endpoint descriptors with the correct transfer mode, maximum packet lenght... and you may need to declare specific descriptors (for example, the HID class requires a HID descriptor and a report descriptor adding to the endpoint descriptors) Once all descriptors are specified and the related parameters are defined, you have to add to the structure below: typedef struct { S_usb_configuration_descriptor cfg; S_usb_interface_descriptor ifc0; S_usb_endpoint_descriptor ep1; S_usb_endpoint_descriptor ep2; S_usb_interface_descriptor S_usb_endpoint_descriptor S_usb_endpoint_descriptor ifc1; ep3; ep4; } S_usb_user_configuration_descriptor; Now, you have to complete the usb_descriptors.c file with the new descriptors values. Please, see hereunder: 6.2 usb_descriptors.c In this file, you have to add the new descriptors values in the correct order, as specified by the USB. 6.3 usb_specific_request.c As Mentioned above, a new interface may require a specific requests management. These requests have to be manage by the usb_specific_request.c and specially the function usb_user_read_request(). A new functions may be added to this file to handle a specific tasks related to these specific requests. This new interface has one or more endpoints. These endpoints has to be configured using the function usb_configure_endpoint() used by the function usb_user_endpoint_init(). These modifications will allow the device to enumerate as a composite device with the new class/subclass/protocol defined by the new interface. To use this interface you have now to add the application layer by creating an xxx_task.c to manage your application. 7. PC Software Depending on which interfaces you are using, you may or not need to develop a PC application. 7

8. Limitations The number of interfaces is limited by the number and the size of the endpoints. Each interface requires its own physical endpoints, so the user has to check that the device has enough endpoints and DPRAM to handle the endpoints of all interfaces. Some Operating Systems does not support the composite device by default. 9. Related Documentation AVR USB Datasheet USB Software Library for AT90USBxxx Microcontrollers 8 AVR293

Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Atmel Europe Le Krebs 8, Rue Jean-Pierre Timbaud BP 309 78054 Saint-Quentin-en- Yvelines Cedex France Tel: (33) 1-30-60-70-00 Fax: (33) 1-30-60-71-11 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Product Contact Web Site www.atmel.com Technical Support avr@atmel.com Sales Contact www.atmel.com/contacts Literature Requests www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL S TERMS AND CONDI- TIONS OF SALE LOCATED ON ATMEL S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDEN- TAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. 2008 Atmel Corporation. All rights reserved. Atmel, logo and combinations thereof, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.