Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ASF USB Device HID Generic

Human interface on EVK1101 :

Introduction

This example shows how to implement a USB Device HID Generic on Atmel MCU with USB module. The application note AVR4905 http://ww1.microchip.com/downloads/en/AppNotes/doc8499.pdf provides information about this implementation.

Startup

The example uses the buttons or sensors available on the board to simulate a standard generic. After loading firmware, connect the board (EVKxx,Xplain,...) to the USB Host. When connected to a USB host system this application provides a HID generic application in the Unix/Mac/Windows operating systems. This example uses the native HID driver for these operating systems.

A Atmel PC tool allows to communicate with the HID generic device. This document gives information on integrating the Atmel USB HID DLL functions. Simple code examples that demonstrate different types of implementation are given. http://ww1.microchip.com/downloads/en/AppNotes/doc7645.pdf The PC tool is available here: http://ww1.microchip.com/downloads/en/AppNotes/AVR153.zip Note: Use the PID 0x2402 in tool graphical interface, and the button Firmware Upgrade only disconnects the USB device.

  • PWR led is on when power present
  • Led 0 is on when USB line is in IDLE mode, and off in SUSPEND mode
  • Led 1 blinks when USB host has checked and enabled HID generic interface
  • Led 2 and 3 are linked on HID events LED 2 and 3
  • Event buttons are linked to switch PB0, PB1
  • The PB0 and PB1 can be used to wakeup USB Host in remote wakeup mode.

About example

The example uses the following module groups:

  • Basic modules: Startup, board, clock, interrupt, power management
  • USB Device stack and HID modules:
    services/usb/
    services/usb/udc/
    services/usb/class/hid/
    services/usb/class/hid/generic/
  • Specific implementation:
    • main.c,
      initializes clock
      initializes interrupt
      manages UI
    • specific implementation for each target "./examples/product_board/":
      • conf_foo.h configuration of each module
      • ui.c implement of user's interface (buttons, leds)