2021-12-14 02:14 AM
(Environment)
MC_SDK 5.Y.3 + STM32CubeMX 6.3.0 + IAR EWARM 8.5
(Hardware)
NUCLEO-F446RE + X-NUCLEO-IHM08M1 + Low Voltage BLDC motor
(What I found)
(Question)
SysTick initialization code looks a little messy.
Solved! Go to Solution.
2021-12-15 02:09 AM
Hello @THA.1 ,
You are right, the MX_MotorControl_Init() overwrites the SysTick priority, and this is a bug.
If you generate with HAL, you could replace the following line in MX_MotorControl_Init(void) :
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/SYS_TICK_FREQUENCY);
by this one :
HAL_SetTickFreq(HAL_RCC_GetHCLKFreq()/SYS_TICK_FREQUENCY);
Doing this will restore the SYSTick interrupt level set by HAL_Init(), and this is what we want.
Thanks for reporting.
Please note that the strategy for the systick is to be the lowest priority compared to other interrupts. As by default the MX_MotorControl_INIT() reset it to the lowest possible value, we did not catch it.
We advice our users who want to use another interrupt for there own application to set its priority level under the one of Systick, which is not possible due to this bug. We plan to fix it in the next release.
Regards
Cedric
2021-12-15 02:09 AM
Hello @THA.1 ,
You are right, the MX_MotorControl_Init() overwrites the SysTick priority, and this is a bug.
If you generate with HAL, you could replace the following line in MX_MotorControl_Init(void) :
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/SYS_TICK_FREQUENCY);
by this one :
HAL_SetTickFreq(HAL_RCC_GetHCLKFreq()/SYS_TICK_FREQUENCY);
Doing this will restore the SYSTick interrupt level set by HAL_Init(), and this is what we want.
Thanks for reporting.
Please note that the strategy for the systick is to be the lowest priority compared to other interrupts. As by default the MX_MotorControl_INIT() reset it to the lowest possible value, we did not catch it.
We advice our users who want to use another interrupt for there own application to set its priority level under the one of Systick, which is not possible due to this bug. We plan to fix it in the next release.
Regards
Cedric
2021-12-15 02:22 AM
Sorry, I answered to fast,
HAL_SetTickFreq does the job, but the prototype is not the right one.
I come back after additional tests.
Cedric
2021-12-15 10:03 PM
Thank you!
I would be able to manage this before the next release :)