[HAL][LL][USB] Improve delay management to set core mode
edit fc3cf60 [HAL][LL][USB] Improve delay management to set core mode
diff --git a/Src/stm32f7xx_hal_pcd.c b/Src/stm32f7xx_hal_pcd.c
index eb026aa..0f96496 100644
--- a/Src/stm32f7xx_hal_pcd.c
+++ b/Src/stm32f7xx_hal_pcd.c
@@ -191,8 +191,12 @@
return HAL_ERROR;
}
- /* Force Device Mode*/
- (void)USB_SetCurrentMode(hpcd->Instance, USB_DEVICE_MODE);
+ /* Force Device Mode */
+ if (USB_SetCurrentMode(hpcd->Instance, USB_DEVICE_MODE) != HAL_OK)
+ {
+ hpcd->State = HAL_PCD_STATE_ERROR;
+ return HAL_ERROR;
+ }
/* Init endpoints structures */
for (i = 0U; i < hpcd->Init.dev_endpoints; i++)