From e3e99c177bda6a29706c8821413e44a75415dc89 Mon Sep 17 00:00:00 2001 From: Kymkim Date: Thu, 4 Sep 2025 22:05:48 -0700 Subject: [PATCH] sotfware fore re-enum and clock stabilize delay --- firmware/stmf446retx/Src/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/stmf446retx/Src/main.c b/firmware/stmf446retx/Src/main.c index 2f1469da..f1d6d236 100644 --- a/firmware/stmf446retx/Src/main.c +++ b/firmware/stmf446retx/Src/main.c @@ -120,7 +120,9 @@ int main(void) /* USER CODE END Init */ /* Configure the system clock */ + SystemClock_Config(); + HAL_Delay(50); // Wait for clock to stabilize. /* USER CODE BEGIN SysInit */ @@ -130,11 +132,11 @@ int main(void) MX_GPIO_Init(); MX_CAN1_Init(); MX_USB_DEVICE_Init(); - HAL_Delay(200); - /* USER CODE BEGIN 2 */ - HAL_CAN_Start(&hcan1); - HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING); - HAL_Delay(50); + + /* Force software re-enumeration */ + USBD_Stop(&hUsbDeviceFS); + HAL_Delay(150); + USBD_Start(&hUsbDeviceFS); while (1) {