2026-02-04 11:25 PM - last edited on 2026-04-08 3:41 AM by mƎALLEm
Hello all, I explain you my problem the best I can.
I have a project with the MCU STM32U575RGT6 The project has TouchGFX and FreeRTOS. After the initializations of the peripherals, I have the next calls, so the while(1) in main.c is not executed. As you can see in the next image.
So for the moment the only main loop I have detected in the application is the timer interruption.
In CubeMX I have 3 timers defined: TIM17, which is been assigned to the system as the timebase source:
And timers 2 and 4 with the same exact parameters in CubeMX: (timer3 is related to an encoder....)
I initialize the corresponding interruptions.
The problem is that in the interruption HAL_TIM_PeriodElapsedCallback I never get the call of the timer 4 instance.
Any help will be welcome.
2026-02-05 12:06 AM - edited 2026-02-05 12:10 AM
Hello @Refused_HC
Can you check please Timer4 registers (TIM4_CR1,TIM4_ARR,TIM4_PSC,TIM4_CNT),are they getting initialized and working like they should be?
Additionally, monitor the related pin to determine whether the timer generates a signal if possible.
BR
Gyessine
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-04-08 3:26 AM
Hi @Refused_HC
In you main(), before anything else, try to call __set_BASEPRI(0)
int main(void)
{
/* USER CODE BEGIN 1 */
__set_BASEPRI(0);
/* USER CODE END 1 */
see this discussion
https://community.st.com/t5/stm32-mcus-embedded-software/stm32f4-tim6-initialization/m-p/888102
2026-04-08 5:06 AM
Hi @Refused_HC
please ignore my previous reply, I got confused.
>>"After the initializations of the peripherals, I have the next calls, so the while(1) in main.c is not executed"
This is correct behaviour as RTOS is running its scheduler/idle task thread. Not sure now. okKernelStart() does not return.
How can you have HAL_IncTick() called from TIM4 IRQ when you assigned TIM17 as the HAL tick base timer ?
And your TIM4 is RTOS aware. Does not make sense.