Call USBD_Disconnect before software-triggered CPU reset

This makes sure that we'll re-enumerate on the USB, as a CPU reset
apparently doesn't automatically release the pull-up and notify the hub
that we were gone?
This commit is contained in:
Harald Welte 2017-03-03 01:51:43 +01:00
parent ec0837c463
commit f415d7163b
4 changed files with 4 additions and 0 deletions

View File

@ -154,6 +154,7 @@ extern int main(void)
if (i >= MAX_USB_ITER * 3) {
TRACE_ERROR("Resetting board (USB could "
"not be configured)\n\r");
USBD_Disconnect();
NVIC_SystemReset();
}
#endif

View File

@ -161,6 +161,7 @@ extern int main(void)
if (i >= MAX_USB_ITER * 3) {
TRACE_ERROR("Resetting board (USB could "
"not be configured)\n\r");
USBD_Disconnect();
NVIC_SystemReset();
}
#endif

View File

@ -154,6 +154,7 @@ extern int main(void)
if (i >= MAX_USB_ITER * 3) {
TRACE_ERROR("Resetting board (USB could "
"not be configured)\r\n");
USBD_Disconnect();
NVIC_SystemReset();
}
#endif

View File

@ -112,6 +112,7 @@ void board_exec_dbg_cmd(int ch)
break;
case 'R':
printf("Asking NVIC to reset us\n\r");
USBD_Disconnect();
NVIC_SystemReset();
break;
case 'O':