From 045cb94eec42db6ac655ef0e12d9883eb52722e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Fri, 18 Jun 2021 14:27:50 +0300 Subject: [PATCH] [FL-1338] Initialize USB as soon as possible, fix usb stack lockup #525 --- firmware/targets/f5/Src/main.c | 8 +++++--- firmware/targets/f6/Src/main.c | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/firmware/targets/f5/Src/main.c b/firmware/targets/f5/Src/main.c index 45a6ce36..9cf853d7 100644 --- a/firmware/targets/f5/Src/main.c +++ b/firmware/targets/f5/Src/main.c @@ -27,7 +27,11 @@ int main(void) { // Initialize FURI layer furi_init(); - // Initialize ST HAL hardware + // USB must be initialized as soon as possible + MX_USB_Device_Init(); + FURI_LOG_I("HAL", "USB OK"); + + // Initialise the rest of HAL HAL_Init(); SystemClock_Config(); MX_USART1_UART_Init(); @@ -42,8 +46,6 @@ int main(void) { FURI_LOG_I("HAL", "SPI1 OK"); MX_SPI2_Init(); FURI_LOG_I("HAL", "SPI2 OK"); - MX_USB_Device_Init(); - FURI_LOG_I("HAL", "USB OK"); MX_TIM1_Init(); FURI_LOG_I("HAL", "TIM1 OK"); MX_TIM2_Init(); diff --git a/firmware/targets/f6/Src/main.c b/firmware/targets/f6/Src/main.c index 45a6ce36..ec0fed26 100644 --- a/firmware/targets/f6/Src/main.c +++ b/firmware/targets/f6/Src/main.c @@ -30,6 +30,12 @@ int main(void) { // Initialize ST HAL hardware HAL_Init(); SystemClock_Config(); + + // USB must be initialized as soon as possible + MX_USB_Device_Init(); + FURI_LOG_I("HAL", "USB OK"); + + // Initialise the rest of HAL MX_USART1_UART_Init(); FURI_LOG_I("HAL", "USART OK"); MX_RTC_Init(); @@ -42,8 +48,6 @@ int main(void) { FURI_LOG_I("HAL", "SPI1 OK"); MX_SPI2_Init(); FURI_LOG_I("HAL", "SPI2 OK"); - MX_USB_Device_Init(); - FURI_LOG_I("HAL", "USB OK"); MX_TIM1_Init(); FURI_LOG_I("HAL", "TIM1 OK"); MX_TIM2_Init();