Atmel Software Framework

Bus power application recommendations

In this use case, the USB device BUS power feature is enabled.

This feature requires a correct power consumption management.

Setup steps

Prior to implement this use case, be sure to have already apply the UDI module "basic use case".

Usage steps

Example code

Content of conf_usb.h:

#define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED)
#define UDC_SUSPEND_EVENT() user_callback_suspend_action()
extern void user_callback_suspend_action(void)
#define UDC_RESUME_EVENT() user_callback_resume_action()
extern void user_callback_resume_action(void)

Add to application C-file:

void user_callback_suspend_action(void)
{
// Disable hardware component to reduce power consumption
}
void user_callback_resume_action(void)
{
// Re-enable hardware component
}

Workflow

  1. Ensure that conf_usb.h is available and contains the following parameters:
    • // Authorizes the BUS power feature
      #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED)
    • // Define callback called when the host suspend the USB line
      #define UDC_SUSPEND_EVENT() user_callback_suspend_action()
      extern void user_callback_suspend_action(void);
    • // Define callback called when the host or device resume the USB line
      #define UDC_RESUME_EVENT() user_callback_resume_action()
      extern void user_callback_resume_action(void);
  2. Reduce power consumption in suspend mode (max. 2.5mA on Vbus):
    • void user_callback_suspend_action(void)
      {
      turn_off_components();
      }