From d70836f96523d27582b89a1e4bebedcc19767d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Redon?= Date: Tue, 3 Dec 2019 15:36:58 +0100 Subject: [PATCH] DFU: restart bootloader when USB conf failed when starting the DFU bootloader, but USB configuration (e.g. enumeration) failed, the MCU restarted in the main application. this occured after a DFU detach and were the USB host missed the USB reset. now after MCU reset, the bootloader is started again, since this is what was requested to begin with. the bootloader will always restart in the bootloader until USB enumeration succeeded. this boot loop can be stopped by unplugging/removing power from the device. Change-Id: I4062a7d8a7934af2119c169759b614dc45990651 --- firmware/apps/dfu/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/apps/dfu/main.c b/firmware/apps/dfu/main.c index 36f80a8b..3d0cc1ef 100644 --- a/firmware/apps/dfu/main.c +++ b/firmware/apps/dfu/main.c @@ -318,8 +318,8 @@ extern int main(void) check_exec_dbg_cmd(); #if 1 if (i >= MAX_USB_ITER * 3) { - TRACE_ERROR("Resetting board (USB could " - "not be configured)\n\r"); + TRACE_ERROR("Resetting board (USB could not be configured)\n\r"); + g_dfu->magic = USB_DFU_MAGIC; // start the bootloader after reboot USBD_Disconnect(); NVIC_SystemReset(); }