2021-08-13 07:09 AM
Hello dear Engineers,
Before this upgrade(downgrade?????), I was able to use FREERTOS successfully. The main procedure was to change the time base from SYSTICK to TIM1 and then everything was working. Now in this upgrade even without FREERTOS, when the time base is set to any timer but SYSTICK, it gets stuck at HAL_Init();.
The project is attached for further analysis. The board is a custom board.
sincerely yours
2021-12-03 07:55 AM
> And I wonder how to solve the TICK_INT_PRIORITY invalid value bug?
This isn't the thread I was thinking of, but it does explain the getting stuck in HAL_InitTick issue:
2021-12-03 09:27 PM
@TDK @Khouloud OTHMAN
The source of this problem is V1.26.0 "system_stm32f4xx.c" file.
The procedure I followed to find the source of the problem is as follows.
1) Only Replaced the "startup_stm32f429igtx.s" of V1.25.2 (Working1) to V1.26.0 (NotWorking), rebuild, debug --->>>> made no change. still not working. removed the debug folder, rebuild, debug --->>>> made no change. still not working.
2) Restored "startup_stm32f429igtx.s" of V1.26.0. Only Replaced the ""system_stm32f4xx.c" of V1.25.2 (Working1) to V1.26.0 (NotWorking), rebuild, debug --->>>> made no change. Still not working. Removed the debug folder, rebuild, debug --->>>> Now its working in the debug. The most important difference between these two files is in the external memory section.
2021-12-06 03:49 AM
Hello @Vahid Ajallooeian ,
First let me apologize for the somewhat late reply.
Actually, as far as I can see from what have been said, the issue is mainly related to the use of a time base other than Systick (tim1 for example).
To explain briefly the situation, starting from the firmware version STM32Cube_FW_F4_V1.25.0, The time base has been reworked in order to change dynamically the Timebase tick frequency (10, 100 and 1000 Hz) following the system frequency. To achieve this change the following functions have been already added in the stm32ynxx_hal.c:
In addition to the following exportable variables
When using only the default time base i.e. the systick, HAL_Init calls the first time HAL_InitTick(). Upon system clock change, the RCC_ClockConfig calls HAL_InitTick().
However, when using another time base, the HAL_InitTick is not correct: The priority is not stored:
HAL_Init calls the first time HAL_InitTick(), then the frequency of the time base will be changed by calling HAL_SetTickFreq(), and upon system clock change, the RCC_ClockConfig calls HAL_InitTick().
Focusing on the generated stm32f4xx_hal_timebase_tim.c file, the HAL_InitTick is not correct:
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
//....
/*Configure the TIM1 IRQ priority */
HAL_NVIC_SetPriority(TIM1_UP_TIM10_IRQn, TickPriority ,0);
/* Enable the TIM1 global Interrupt */
HAL_NVIC_EnableIRQ(TIM1_UP_TIM10_IRQn);
//...
/* Return function status */
return HAL_ERROR;
}
And thus when calling the HAL_SetTickFreq(); this later will rather use the default prio (defined in the stm32f4xx_hal.c:( uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */
The HAL_SetTickFreq() use a wrong Priority and the HAL hangs.
Unfortunately, CubeMX code generation wasn't updated to match this rework. this issue was reported internally to be fixed as soon as possible. I'll keep you posted with the updates.
Sorry for any inconvenience that this may cause.
To overcome this problem, please check stm32f4xx_hal_timebase_tim_template.c file delivered in the latest STM32Cube_FW_F4_V1.26 and edit HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority) function accordingly.
Hoping that I've answered your question.
Khouloud.
2021-12-08 09:44 AM
Dear @Khouloud OTHMAN
Hope this will be solved in near future.
Sincerely yours.
2022-03-15 09:20 AM
Dear @Khouloud OTHMAN (Employee)
It seems the ST F4 team doesn't want to solve this problem anymore. Yet it has not been solved in CUBE Micro Xplore 6.5 and F4CUbE 1.27.
Sincerely yours.
2022-03-15 09:49 AM
Dear @Khouloud OTHMAN
beachmiles has a solution to this problem and worked for me.
https://github.com/STMicroelectronics/STM32CubeF4/issues/113