[FL-1338] Initialize USB as soon as possible, fix usb stack lockup #525

This commit is contained in:
あく 2021-06-18 14:27:50 +03:00 committed by GitHub
parent c54653223e
commit 045cb94eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -27,7 +27,11 @@ int main(void) {
// Initialize FURI layer // Initialize FURI layer
furi_init(); 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(); HAL_Init();
SystemClock_Config(); SystemClock_Config();
MX_USART1_UART_Init(); MX_USART1_UART_Init();
@ -42,8 +46,6 @@ int main(void) {
FURI_LOG_I("HAL", "SPI1 OK"); FURI_LOG_I("HAL", "SPI1 OK");
MX_SPI2_Init(); MX_SPI2_Init();
FURI_LOG_I("HAL", "SPI2 OK"); FURI_LOG_I("HAL", "SPI2 OK");
MX_USB_Device_Init();
FURI_LOG_I("HAL", "USB OK");
MX_TIM1_Init(); MX_TIM1_Init();
FURI_LOG_I("HAL", "TIM1 OK"); FURI_LOG_I("HAL", "TIM1 OK");
MX_TIM2_Init(); MX_TIM2_Init();

View File

@ -30,6 +30,12 @@ int main(void) {
// Initialize ST HAL hardware // Initialize ST HAL hardware
HAL_Init(); HAL_Init();
SystemClock_Config(); 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(); MX_USART1_UART_Init();
FURI_LOG_I("HAL", "USART OK"); FURI_LOG_I("HAL", "USART OK");
MX_RTC_Init(); MX_RTC_Init();
@ -42,8 +48,6 @@ int main(void) {
FURI_LOG_I("HAL", "SPI1 OK"); FURI_LOG_I("HAL", "SPI1 OK");
MX_SPI2_Init(); MX_SPI2_Init();
FURI_LOG_I("HAL", "SPI2 OK"); FURI_LOG_I("HAL", "SPI2 OK");
MX_USB_Device_Init();
FURI_LOG_I("HAL", "USB OK");
MX_TIM1_Init(); MX_TIM1_Init();
FURI_LOG_I("HAL", "TIM1 OK"); FURI_LOG_I("HAL", "TIM1 OK");
MX_TIM2_Init(); MX_TIM2_Init();