Hello!
I have the following problem:
A few years ago, I was using CubeMX to configure my programs and it worked fine.
Basically what I always do is setup a systick of 1 ms, and build the whole program on that
time grid.
Now in the latest version of Cube MX, which is now integrated into STM32IDE, I'm trying
to do the same, but the generated code doesn't include the systick setup.
I have tried to add the systick configuration manually in SystemClock_Config:
Code:
// Systick frequency configuration
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
// Configure the systick
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
// SysTick_IRQn interrupt configuration
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
Then I also added the following code in SysTick_Handler so that the callback is
called. NB: I have added the whole function to display the context, but a single line
only was added.
Code:
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
HAL_SYSTICK_IRQHandler(); // <--- This line has been added
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
The HAL_SYSTICK_IRQHandler just calls HAL_SYSTICK_Callback which is a weak function.
When I declare it again in main's user area, I get an interrupt if I setup a breakpoint.
The problem: in my previous experience with STM32, I used to get the interrupt at 1ms intervals
forever. But this time, I get the interrupt only 3 times, and after that the program finishes in
the error handler which is an infinite loop
So my question is simple: does anybody know how to setup the systick interrupt in the latest
version oft STM32CubeIDE? Am I missing something?
Thanks!