From 615d34f1b7b363dc9c1cc79be6834e1e88c30ee8 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 21 May 2012 16:37:34 +0000 Subject: [PATCH 1/3] Turn off watchdog before jumping to the user application in the DFU and CDC based bootloaders, for the specific case of /HWB being low during reset (where the bootloader will re-enter). --- Bootloaders/CDC/BootloaderCDC.c | 6 ++++++ Bootloaders/DFU/BootloaderDFU.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 211b054e3d..7bff89994b 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -73,7 +73,13 @@ void Application_Jump_Check(void) /* If the reset source was the bootloader and the key is correct, clear it and jump to the application */ if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY)) { + /* Turn off the watchdog */ + MCUSR &= ~(1< Date: Mon, 21 May 2012 20:42:56 +0000 Subject: [PATCH 2/3] Fix AVRISP-MKII clone and XPLAINBridge projects not properly configuring the AVRISP IN endpoint when needed if RESET_TOGGLES_LIBUSB_COMPAT compile time option is used. --- Projects/AVRISP-MKII/AVRISP-MKII.c | 8 ++++---- Projects/XPLAINBridge/XPLAINBridge.c | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.c b/Projects/AVRISP-MKII/AVRISP-MKII.c index 71b6da7cd4..cbcf009c9b 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.c +++ b/Projects/AVRISP-MKII/AVRISP-MKII.c @@ -97,12 +97,12 @@ void EVENT_USB_Device_ConfigurationChanged(void) { bool ConfigSuccess = true; - /* Setup AVRISP Data Endpoint(s) */ + /* Setup AVRISP Data OUT endpoint */ ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); - #if defined(LIBUSB_DRIVER_COMPAT) - ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); - #endif + /* Setup AVRISP Data IN endpoint if it is using a physically different endpoint */ + if (AVRISP_DATA_IN_EPADDR != AVRISP_DATA_OUT_EPADDR) + ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); /* Indicate endpoint configuration success or failure */ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 3bd1fbf559..e7d9b24869 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -226,9 +226,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) { ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); - #if defined(LIBUSB_DRIVER_COMPAT) - ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); - #endif + if (AVRISP_DATA_IN_EPADDR != AVRISP_DATA_OUT_EPADDR) + ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); /* Configure the V2 protocol packet handler */ V2Protocol_Init(); From 55283475d3e1c8191b3569524d35066566ceb0e7 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 21 May 2012 20:45:16 +0000 Subject: [PATCH 3/3] Oops - mask out the endpoint address direction when comparing the IN and OUT endpoint indexes in the AVRISP-MKII clone and XPLAINBridge projects. --- Projects/AVRISP-MKII/AVRISP-MKII.c | 2 +- Projects/XPLAINBridge/XPLAINBridge.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.c b/Projects/AVRISP-MKII/AVRISP-MKII.c index cbcf009c9b..c4623fd8e3 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.c +++ b/Projects/AVRISP-MKII/AVRISP-MKII.c @@ -101,7 +101,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); /* Setup AVRISP Data IN endpoint if it is using a physically different endpoint */ - if (AVRISP_DATA_IN_EPADDR != AVRISP_DATA_OUT_EPADDR) + if ((AVRISP_DATA_IN_EPADDR & ENDPOINT_EPNUM_MASK) != (AVRISP_DATA_OUT_EPADDR & ENDPOINT_EPNUM_MASK)) ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); /* Indicate endpoint configuration success or failure */ diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index e7d9b24869..7909cc45c5 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -226,7 +226,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) { ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); - if (AVRISP_DATA_IN_EPADDR != AVRISP_DATA_OUT_EPADDR) + if ((AVRISP_DATA_IN_EPADDR & ENDPOINT_EPNUM_MASK) != (AVRISP_DATA_OUT_EPADDR & ENDPOINT_EPNUM_MASK)) ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPADDR, EP_TYPE_BULK, AVRISP_DATA_EPSIZE, 1); /* Configure the V2 protocol packet handler */