AVR32 USB software framework for HID

License

Use of this program is subject to Atmel's End User License Agreement.

Please read the Copyright notice at the bottom of this page.

Description

This embedded application source code illustrates how to implement a USB HID-mouse application on the AVR32 microcontroller.

As the AVR32 implements a device/host USB controller, the embedded application can operate in one of the following USB operating modes:

To optimize embedded code/RAM size and reduce the number of source modules, the application can be configured to use one and only one of these operating modes.

About the Sample Application

By default the sample code is delivered with a simple preconfigured dual-role USB application. It means that the code generated allows to operate as a device or a host depending on the USB ID pin:

appli_evk1100_device.jpg

EVK1100 USB Device Mode

appli_evk1101_device.jpg

EVK1101 USB Device Mode

The mouse can be controlled thanks to the joystick and the buttons (shown in a red box in the above pictures).

appli_evk1100_host.jpg

EVK1100 USB Host Mode

appli_evk1101_host.jpg

EVK1101 USB Host Mode

In this mode, a mouse ascii pointer is output on the USART1 connector. Open a serial terminal (e.g. HyperTerminal under Windows systems or minicom under Linux systems; USART settings: 57600 bauds, 8-bit data, no parity bit, 1 stop bit, no flow control). Make sure that the serial terminal takes in charge the ANSI codes.

terminal.JPG

Debug output in terminal

Using the USB Device Mode

Connect the application to a USB host (e.g. a PC) with a mini-B (embedded side) to A (PC host side) cable. The application will behave as a mouse peripheral. The mouse can be controlled thanks to the joystick and the buttons of the EVK110x.

Using the USB Host Mode

Connect the application to a USB mouse device. The application will behave as a USB mouse reduced host. Leds will blink according to the mouse eactivity and a mouse ascii pointer is output on the USART1 connector.

Architecture

As illustrated in the figure bellow, the application entry point is located is the hid_example.c file. The application can be ran using the FreeRTOS operating system, or in standalone mode. In the standalone mode, the main function runs the usb_task and device_mouse_hid_task tasks in an infinite loop.

The application is based on three different tasks:

arch_full.jpg

Architecture Overview

Main Files

Copyright notice

Copyright (c) 2009 Atmel Corporation. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. The name of Atmel may not be used to endorse or promote products derived from this software without specific prior written permission.

4. This software may only be redistributed and used in connection with an Atmel AVR product.

THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE


Generated on Fri Feb 19 02:33:14 2010 for AVR32 - USB HID Stand-alone Example by  doxygen 1.5.5