From ce85e473b3f64748a00ce118384f2f5bb524fc3f Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Mon, 15 Jun 2026 14:11:11 +0200 Subject: [PATCH] Move before starting scheduler to avoid race condition - If a CAN message arrives during boot time ISR will fire and try to put data into xCAN1RxQueue. At that time queue is NULL: calling RTOS APIs on NULL handles will cause a HardFault --- Core/Src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Src/main.c b/Core/Src/main.c index 3f926a9..a72f6e6 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -110,7 +110,6 @@ int main(void) MX_SDIO_SD_Init(); /* USER CODE BEGIN 2 */ - CAN_Logger_Init(&hcan1, &hcan2); /* USER CODE END 2 */ /* Init scheduler */ @@ -185,6 +184,7 @@ int main(void) /* USER CODE END RTOS_EVENTS */ /* USER CODE BEGIN 3 */ + CAN_Logger_Init(&hcan1, &hcan2); /* USER CODE END 3 */ /* Start scheduler */