Common prerequisites for all USB hosts.
This module is based on USB host stack full interrupt driven and supporting Sleep manager sleepmgr. For AVR and SAM3/4 devices the clk_group clock services is supported. For SAMD21 devices the SAM System Clock Management (SYSTEM CLOCK) Driver clock driver is supported.
The following procedure must be executed to setup the project correctly:
- Specify the clock configuration:
- UC3 and SAM3/4 devices without USB high speed support need 48MHz clock input.
You must use a PLL and an external OSC.
- UC3 and SAM3/4 devices with USB high speed support need 12MHz clock input.
You must use an external OSC.
- UC3 devices with USBC hardware need CPU frequency higher than 25MHz.
- SAMD21 devices without USB high speed support need 48MHz clock input.
You must use a DFLL and an external OSC.
- In conf_board.h, the define CONF_BOARD_USB_PORT must be added to enable USB lines. (Not mandatory for all boards)
- Enable interrupts
- Initialize the clock service
The usage of Sleep manager sleepmgr service is optional, but recommended to reduce power consumption:
- Initialize the sleep manager service
- Activate sleep mode when the application is in IDLE state
conf_clock.h examples with USB support.
For AVR and SAM3/4 devices, add to the initialization code:
For SAMD21 devices, add to the initialization code:
Add to the main IDLE loop: