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
This commit is contained in:
Kevin Redon 2019-12-03 15:36:58 +01:00 committed by laforge
parent ed3ceec56f
commit d70836f965
1 changed files with 2 additions and 2 deletions

View File

@ -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();
}