Added workaround for broken VBUS detection on AVR8 devices when a bootloader starts...
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 12 Aug 2012 13:46:24 +0000 (13:46 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 12 Aug 2012 13:46:24 +0000 (13:46 +0000)
LUFA/DoxygenPages/ChangeLog.txt
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c

index ed0e9e8..4f361c5 100644 (file)
@@ -15,7 +15,8 @@
   *
   *  <b>Changed:</b>
   *  - Core:
   *
   *  <b>Changed:</b>
   *  - Core:
-  *   - <i>None</i>
+  *   - Added workaround for broken VBUS detection on AVR8 devices when a bootloader starts the application
+  *     via a software jump without first turning off the OTG pad (thanks to Simon Inns)
   *  - Library Applications:
   *   - <i>None</i>
   *
   *  - Library Applications:
   *   - <i>None</i>
   *
index 1f37dfd..8285f7e 100644 (file)
@@ -63,6 +63,13 @@ void USB_Init(
        USB_Options = Options;
        #endif
 
        USB_Options = Options;
        #endif
 
+       #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
+       /* Workaround for AVR8 bootloaders that fail to turn off the OTG pad before running
+        * the loaded application. This causes VBUS detection to fail unless we first force
+        * it off to reset it. */
+       USB_OTGPAD_Off();
+       #endif
+
        if (!(USB_Options & USB_OPT_REG_DISABLED))
          USB_REG_On();
        else
        if (!(USB_Options & USB_OPT_REG_DISABLED))
          USB_REG_On();
        else