• No results found

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

N/A
N/A
Protected

Academic year: 2021

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

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2

Features

• Advantages

• Implementation differences

• Integration

• Migration from stack V1 to stack V2

1 Introduction

Atmel® has always provided a USB device stack to support AVR® products with a USB hardware interface. The Atmel AT32UC3A and Atmel AT32UC3B products are supported in Atmel AVR Software Framework (ASF) version 1 (V1) with a specific USB device stack. Since ASF version 2 (V2), a new USB device stack has been delivered to support all AVR products. The aim of this document is to explain the implementation advantages of the new USB device stack for AT32UC3A and AT32UC3B MCUs as well as the major differences from the former USB device stack.

NOTE In the rest of the document, the former USB stack will be referred to as USB Device stack V1, while new stack will be referred to as USB device stack V2.

8-bit Atmel

Microcontrollers Application Note

Rev. 8411A-AVR-08/11

(2)

2 Abbreviations

ASF AVR Software Framework USB Universal serial bus

(3)

Atmel AVR4921

3 Advantages

The following list shows the advantages of USB device stack V2 over USB device stack V1:

• All Atmel AVR products are supported: Atmel megaAVR®, Atmel AVR XMEGA®, and Atmel AVR UC3

­ Eases migration between all AVR products

• DMA is used when applicable for all USB transfers

­ Increases speed and reduces CPU usage

• The stack is managed only by interrupt

­ Reduces latency

­ Avoids any task scheduler

• The implementation supports all AVR power reduction features

­ Helps to create a very low-power device

• All USB protocol errors are taken into account

­ Robust software solution

• Better software architecture

­ Easiest to use

­ No USB-specific code in the application

­ Reduces development time

• Various detailed application notes are available

­ Reduces development time

• A new USB class implementation is supported

­ Provides peripheral health device class (PHDC)

• The V2 and V1 footprints (code/RAM size) are the same

­ Does not require a larger memory target space

All classes available in USB device stack V1 will be supported by USB device stack V2.

Table 3-1. USB device class status.

Class ASF V1 status ASF V2 status

Template No Q3 2011

Composite (HIDs, CDC, MSC) No ASF2.3.2

HID mouse Available ASF2.3.2

HID keyboard No ASF2.3.2

HID generic No ASF2.3.2

Mass storage (MSC) Available ASF2.3.2

Communication (CDC) Available ASF2.3.2

Personal health device (PHDC) No ASF2.3.2

Audio Available Q4 2011

Device firmware upgrade (DFU) Available Q3 2011

(4)

4.1 File organization

4.1.1 USB device stack V1

The specific USB device stack for Atmel AVR UC3 A and Atmel AVR UC3 B 32-bit products is prefixed by a _asf_v1 folder in the ASF package, and is stored in the following folders:

File Path

• USB constant defines avr32/services/usb/_asf_v1/class/

usb_ids.h

• USB device core files avr32/drivers/usbb/_asf_v1/enum/

usb_task.c/h

device/usb_device_task.c/h device/usb_standard_request.c/h

• Class protocol files avr32/services/usb/_asf_v1/class/foo/

foo.h

• Class and USB descriptor files duplicated in application folder device_class_task.c/h

usb_specific_request.c/h usb_descriptors.c/h

• Driver files for AVR UC3 avr32/drivers/usbb/_asf_v1/

usb_drv.c/h usbb.h

• Configuration files

usb_conf.h (This configuration file is mandatory) 4.1.2 USB device stack V2

The USB device stack V2 for all AVR products is stored in the following folders:

File Path

• USB constant defines common/services/usb/

usb_protocol.h (from usb.org) usb_atmel.h (from Atmel)

• USB device core files common/services/usb/udc/

udc.c/h udc_desc.h udi.h udd.h

• Class protocol files common/services/usb/class/foo/

usb_protocol_foo.h

• Class and USB descriptor files common/services/usb/class/foo/device/

(5)

Atmel AVR4921

udi_foo.c/h udi_foo_desc.c udi_foo_conf.h

• Driver files for AVR UC3 avr32/drivers/

usbb/usbb_device.c/h usbb/usbb_otg.h usbc/usbc_device.c/h usbc/usbc_otg.h

• Driver files for AVR XMEGA xmega/drivers/

usb/usb_device.c/h

• Configuration files

usb_conf.h (This configuration file is mandatory)

4.2 Integration

4.2.1 USB device stack V1

The USB device stack V1 requires the initialization and scheduling of USB core tasks and class tasks in the main code section. It also requires the class implementation and USB descriptors in the user application:

Main code section

// Initialize USB clock (on PLL1) pcl_configure_usb_clock();

// Initialize USB task usb_task_init();

// Initialize device mouse USB task device_mouse_hid_task_init();

// No OS here. Need to call each task in round-robin mode.

while (true) {

usb_task();

device_mouse_hid_task();

}

Class implementation and user interface, for example:

device_class_task.c/h Class setup implementation:

usb_specific_request.c/h USB descriptors:

usb_descriptors.c/h 4.2.2 USB device stack V2

The USB device stack V2 requires the clock manager software module (/common/services/clock) and sleep manager software module (/common/services/sleepmgr) from ASF. Intialization of the clock, sleep manager and

(6)

interface.

For more information concerning integration, refer to the Atmel AVR4903 to AVR4909 USB device class application notes.

Main code section

// Initialize the sleep manager service sleepmgr_init();

// Initialize the clock service sysclk_init();

// Enable USB Stack Device udc_start();

User interface only, for example:

ui.c/h

(7)

Atmel AVR4921

5 Migration from stack V1 to stack V2

The USB device stack V2 requires the clock manager software module and sleep manager software module from ASF V2. In the USB device stack V1 applications, however, clock configuration and sleep mode control are done by the user application code, which calls UC3 clock and sleep drivers.

Because of this fundamental difference between stack V1 and stack V2, there can be no straightforward migration. It is recommended to start again from existing V2 example projects.

(8)

Moving to USB device stack V2 in ASF offers greater robustness as well as ease of use for both beginners and advanced users when developing firmware with USB. It also adds performance in managing low-level USB, and takes advantage of all USB hardware features implemented in Atmel AVR products.

The stack provides full support of many USB classes, with example projects in ASF and Atmel AVR Studio® 5.

The stack allows the sharing of code among Atmel megaAVR, AVR XMEGA and AVR UC3 products. Maintenance and portability from one architecture to another is also improved.

(9)

Atmel AVR4921

7 Table of contents

Features... 1

1 Introduction ... 1

2 Abbreviations ... 2

3 Advantages... 3

4 Implementation ... 4

4.1 File organization ... 4

4.1.1 USB device stack V1... 4

4.1.2 USB device stack V2... 4

4.2 Integration... 5

4.2.1 USB device stack V1... 5

4.2.2 USB device stack V2... 5

5 Migration from stack V1 to stack V2 ... 7

6 Conclusion ... 8

7 Table of contents ... 9

(10)

Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA

Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com

Atmel Asia Limited Unit 01-5 & 16, 19F

BEA Tower, Milennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369

Atmel Munich GmbH Business Campus Parkring 4

D-85748 Garching b. Munich GERMANY

Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621

Atmel Japan

9F, Tonetsu Shinkawa Bldg.

1-24-8 Shinkawa Chou-ku, Tokyo 104-0033 JAPAN

Tel: (+81) 3523-3551 Fax: (+81) 3523-7581

© 2011 Atmel Corporation. All rights reserved.

Atmel®, Atmel logo and combinations thereof, AVR®, AVR Studio®, megaAVR®, XMEGA®, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.

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 THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, 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 INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND 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 products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.

References

Related documents

• Reduce the power consumption of external components/resources (through chip select and power reduction lines, and by shutting down unused power supplies) NOTE When

Here in atmel studio by atmel asf software and gateways along with the atmel evaluation board tutorial circuit complexity of waiting for thousands of what is working as led

Dies are placed bump side down on the substrate metal lands and the electrical connection is then made using a reflow process to melt the solder and form the joint.. Atmel WLCSP

 Prioritize: The campaign had a small or negative net branding effect on the branding targets that have a high impact on the probability of holidays in Norway.  Adequate:

In the final analysis of this randomized clinical trial of patients with glioblastoma who had received standard radio- chemotherapy, the addition of TTFields to maintenance

In the worm case, the profiling-aware filtering algorithm also successfully reduces CPU and memory cost of the pro- filing system, while maintaining high profiling accuracy in terms

Where Tobin’s Q is Chung and Pruitt’s (1994) proxy for Tobin’s Q, Hedge is the percent of next year’s fuel requirement hedged for airline “i" in period “t”, Fleet

To this end, we considered a large dataset of traffic traces that we split according to the type of IP address assigned to users’ home routers, i.e., public or private. Then,