USB_LP_CAN1_RX0 interrupt before task scheduler started

Hi I’m still new in FreeRTOS, I have used interrupts with UART and timers, everything just fine, but on my recent project, I used HW interrupts for timers and CAN1.
Timer interrups works as normal: I can enable interrupt by “TIMITConfig(TIM3, TIMITCC1, ENABLE);” in prvSetupHardware function and the interrupt ISR will not called until I start the task scheduler. However for the CAN interrupt, as soon as I called “CANITConfig(CAN1, CANITFMP0, ENABLE);” in the prvSetupHardware function, the interrupt ISR will be enabled and if there are messages received the ISR will be called and then in the ISR it will give semaphore which was not created yet and end up with a hard fault. Anyone has any idea about this? should I make another task just to enable the interrupt after the scheduler started? Thanks

USB_LP_CAN1_RX0 interrupt before task scheduler started

will be called andl then use give semaphore which was not created yet and end up with a hard fault
Isn’t that your problem? You cannot use a semaphore that has not been created.