Problem with HAL_Delay function in freeRTOS

Dear Friends,

I’m using Freertos and faced a problem using HAL_Delay Function from ST HAL library.
If the HAL_Delay calls before the xTaskCreate function everything seems OK, However calling it after xTaskCreate function (without starting the scheduler) causes the update tick interrupt of HAL functions doesn’t fire again, making the HAL_Delay function freeze.

Also it’s OK to uses the HAL_Delay function after starting the scheduler.

I’m using STM32L083RZ (Cortex M0+), TIM6 for HAL Tick interrupt and SYSTick for Freertos ticks, and the code generated by CUBEMX.

HAL_Delay(100) / *Every things is OK */
xTaskCreate()
HAL_Delay(100) / *Execution freezes here, HAL ticks interrupts doesn’t fire again */

vTaskStartScheduler() /After starting the Scheduler, It’s possible to use the HAL_Delay/

Regards

The issue is that FreeRTOS INTENTIONALLY disables interrupts before the scheduler is started in many of its functions (I think anything that needs a critical section).
Basically, you shouldn’t be doing anything that NEEDS delays before starting the scheduler, just create the basic structures you need for the application and then start the scheduler.

I find that STM Hal to be not that well designed in many pieces, so I do my best to avoid it where I can.