Why does the HAL Tick timer stop incrementing after creating a FreeRTOS mutex in STM32CubeIDE?

I've been working on an STM32 project using STM32CubeIDE 1.11.2 with CubeMX 6.7.0, and I'm testing on the Nucleo-F767ZI board. After creating a FreeRTOS mutex, I've noticed that the HAL Tick timer stops incrementing. Here's what I've done so far: 1. I started a new STM32 project in STM32CubeIDE with all default settings. 2. I opened the .ioc file in the MX perspective and enabled FreeRTOS support using the CMSIS_V2 interface. 3. In main.c, right after osKernelInitialize(), I added the following code:
osMutexId_t mutex = osMutexNew(0);
HAL_Delay(100);

osMutexId_t mutex = osMutexNew(0);
HAL_Delay(100);

The issue is that the code gets stuck in HAL_Delay()—the SysTick_Handler is never called, and HAL_GetTick() always returns the same value (10 in my case). I've tried using both CMSIS and FreeRTOS mutex functions with the same result. I've also experimented with changing the SysTick time base and tested on another Nucleo board, but the issue persists. What could I be missing?
Solution:
FreeRTOS and HAL driver timeout issue
Posted on November 21, 2014 at 19:54 Hello, in xPortStartScheduler routine, the systick priority is forced to /* Make PendSV and SysTick the lowest priority interrupts. */ Some HAL interrupt drivers implement a time out based upon systick value. With systick priority set to lowest priority the ...
Jump to solution
5 Replies
ZacckOsiemo
ZacckOsiemo4mo ago
HAL systick and FreeRtos tick dont play well together you may need to modify your timebase for HAL so freertos uses systick
Sterling
Sterling4mo ago
Thank you for the suggestion @ZacckOsiemo . I've tried changing the timebase for SysTick, but the issue persists. Could you clarify how exactly I should modify the timebase for HAL to ensure FreeRTOS and HAL SysTick work together? Are there specific settings or configurations I should adjust?
ZacckOsiemo
ZacckOsiemo4mo ago
Ill check for you when I get home this evening
Solution
ZacckOsiemo
ZacckOsiemo4mo ago
FreeRTOS and HAL driver timeout issue
Posted on November 21, 2014 at 19:54 Hello, in xPortStartScheduler routine, the systick priority is forced to /* Make PendSV and SysTick the lowest priority interrupts. */ Some HAL interrupt drivers implement a time out based upon systick value. With systick priority set to lowest priority the ...
ZacckOsiemo
ZacckOsiemo4mo ago
@Sterling see above, as well HAL and RTOS don't work well together. Buyer beware
Want results from more Discord servers?
Add your server