Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ASF USB host MSC and HID mouse example

Human interface on EVK1101 :

Introduction

This example shows how to implement a USB host mass storage and host mouse on Atmel MCU with USB module.

Startup

After loading firmware, connect the board (EVKxx,Xplain,...) to a USB device mouse or a U-disk (FAT/FAT32 are supported). This example creates a file "uhi_msc_test.txt" on all present U-disks.

  • PWR led is on when power present
  • Led 0 is continuously on when a device is connected
  • Led 0 blinks when a HID mouse is enumerated and USB in idle mode
    • The blink is slow (1s) with low speed device
    • The blink is normal (0.5s) with full speed device
    • The blink is fast (0.25s) with high speed device
  • Led 1 blinks when a MSC is enumerated and USB in idle mode
    • The blink is slow (1s) with low speed device
    • The blink is normal (0.5s) with full speed device
    • The blink is fast (0.25s) with high speed device
  • Led 2 is on when a HID mouse button is pressed
  • Led 3 is on when a LUN test is success
  • Led 3 blinks when a LUN test is unsuccessful
  • Joystick press allows to enter the device in suspend mode with remote wakeup feature authorized
  • The PB0 and PB1 button can be used to wakeup the USB devices in suspend mode

About example

The example uses the following module groups:

  • Basic modules: Startup, board, clock, interrupt, power management
  • USB host stack, MSC and HID modules:
    services/usb/
    services/usb/uhc/
    services/usb/class/msc/host/
    services/usb/class/hid/host/mouse/
  • 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)