Make sure that USB_STREAM_TIMEOUT_MS is set in the MassStorageHost ClassDriver demo...
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 8 Dec 2009 07:43:33 +0000 (07:43 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 8 Dec 2009 07:43:33 +0000 (07:43 +0000)
Fix TeensyHID bootloader not properly shutting down the USB interface to trigger a disconnection on the host before resetting the AVR.

Bootloaders/TeensyHID/TeensyHID.c
Demos/Host/ClassDriver/MassStorageHost/makefile
Demos/Host/LowLevel/MassStorageHost/makefile
LUFA/ManPages/ChangeLog.txt
Projects/AVRISP/Lib/PDIProtocol.c

index 4b9224a..84ec7aa 100644 (file)
@@ -51,9 +51,9 @@ int main(void)
        \r
        while (RunBootloader)\r
          USB_USBTask();\r
        \r
        while (RunBootloader)\r
          USB_USBTask();\r
-\r
-       /* Wait 100ms to give the host time to register the disconnection */\r
-       _delay_ms(100);\r
+       \r
+       /* Turn off the USB interface, disconnect from the host */\r
+       USB_ShutDown();\r
 \r
        /* Enable the watchdog and force a timeout to reset the AVR */\r
        wdt_enable(WDTO_250MS);\r
 \r
        /* Enable the watchdog and force a timeout to reset the AVR */\r
        wdt_enable(WDTO_250MS);\r
index 24d9ee0..88d5cf2 100644 (file)
@@ -118,6 +118,7 @@ LUFA_PATH = ../../../..
 # LUFA library compile-time options\r
 LUFA_OPTS  = -D USB_HOST_ONLY\r
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 # LUFA library compile-time options\r
 LUFA_OPTS  = -D USB_HOST_ONLY\r
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=5000\r
 \r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
 \r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
index 43309a3..7567632 100644 (file)
@@ -119,7 +119,7 @@ LUFA_PATH = ../../../..
 LUFA_OPTS  = -D NO_STREAM_CALLBACKS\r
 LUFA_OPTS += -D USB_HOST_ONLY\r
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 LUFA_OPTS  = -D NO_STREAM_CALLBACKS\r
 LUFA_OPTS += -D USB_HOST_ONLY\r
 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=2000\r
+LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=5000\r
 \r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
 \r
 \r
 # List C source files here. (C dependencies are automatically generated.)\r
index e68bf89..1fdd966 100644 (file)
@@ -11,7 +11,8 @@
   *  <b>New:</b>\r
   *  - Added activity LED indicators to the AVRISP project to indicate when the device is busy processing a command\r
   *  - The USB target family and allowable USB mode tokens are now public and documented (USB_CAN_BE_*, USB_SERIES_*_AVR)\r
   *  <b>New:</b>\r
   *  - Added activity LED indicators to the AVRISP project to indicate when the device is busy processing a command\r
   *  - The USB target family and allowable USB mode tokens are now public and documented (USB_CAN_BE_*, USB_SERIES_*_AVR)\r
-  *  - Added new XPLAIN USB to Serial Bridge project (thanks to John Steggall for initial proof-of-concept)\r
+  *  - Added new XPLAIN USB to Serial Bridge project (thanks to John Steggall for initial proof-of-concept, David Prentice\r
+  *    and Peter Danneger for revised software USART code)\r
   *  - Added new RNDIS Ethernet Host LowLevel demo\r
   *  - Added new RNDIS Ethernet Host Class Driver\r
   *  - Added new RNDIS Ethernet Host ClassDriver demo\r
   *  - Added new RNDIS Ethernet Host LowLevel demo\r
   *  - Added new RNDIS Ethernet Host Class Driver\r
   *  - Added new RNDIS Ethernet Host ClassDriver demo\r
index 93634a0..d98c51c 100644 (file)
@@ -109,7 +109,10 @@ static void PDIProtocol_EnterXPROGMode(void)
        \r
        /* Must hold DATA line high for at least 90nS to enable PDI interface */\r
        PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;\r
        \r
        /* Must hold DATA line high for at least 90nS to enable PDI interface */\r
        PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;\r
-       _delay_us(1);\r
+       asm volatile ("NOP"::);\r
+       #if (F_CPU > 8000000)\r
+       asm volatile ("NOP"::);\r
+       #endif\r
        \r
        /* Toggle CLOCK line 16 times within 100uS of the original 90nS timeout to keep PDI interface enabled */\r
        for (uint8_t i = 0; i < 16; i++)\r
        \r
        /* Toggle CLOCK line 16 times within 100uS of the original 90nS timeout to keep PDI interface enabled */\r
        for (uint8_t i = 0; i < 16; i++)\r