2021-10-19 8:27 AM
I am using CubeIde for the first time.
First test - run minimal program with HAL from CubeIDe Configurator, under debugger
Simple program, only SYSTICK and uart , but SysTick_Handler() is not trigged at all .
And function HAL_Delay hangs because uwTick is always 0. Tried with setting brakepoint inside handler - no results
Used HSI, SYSCLK 16MHZ, Cortex System Timer 16MHz,
RCC GPIO and USART1 - HAL configured.
here is main() generated from cubeide (I removed comments):
-----------------------------------------------------------
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART1_UART_Init();
HAL_Delay(100);
// here program hangs, when reaches HAL_Delay function. uwTick = 0
while (1)
{
}
}
-----------------------------------------------------------
and here is the SysTick_handler from stm32g0xx_it.c
-----------------------------------------------------------
void SysTick_Handler(void)
{
HAL_IncTick();
}
-----------------------------------------------------------
2024-11-19 12:55 PM
Hi!
Please look at this post: https://community.st.com/t5/stm32cubemx-mcus/systick-handler-not-called-stm32g0b1/m-p/744998/highlight/true#M30159
(It's one post before yours.)
2025-04-21 9:14 PM
So, how to resolve this issue? I want to write some code for key scanning with systick, but right now I can't use the Systick_Handle to do that. This function in standard lib is easy to use.
2025-04-22 2:08 PM
Hi,
Right now I barely recall what I exaclty did. Please help me refreshing my memory and tell me the contents of the function SystemInit() in your project, which is located in the file system_stm32g0xx.c (line 185).
What I can recall is that the issue was around the VTOR register: this is what I have right now:
/**
* @brief Setup the microcontroller system.
* @PAram None
* @retval None
*/
void SystemInit(void)
{
/* Configure the Vector Table location -------------------------------------*/
#if defined(USER_VECT_TAB_ADDRESS)
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation */
#endif /* USER_VECT_TAB_ADDRESS */
}
2025-04-22 3:19 PM
Perhaps look at what SCB->VTOR is CURRENTLY set too in the NON-WORKING sense.
If it is ZERO, then it probably hasn't been set. You should set it appropriately in SystemInit()
If you're using External Loaders, to look at OSPI/QSPI in memory mapped mode, this often a) change SCB->VTOR and b) disable interrupts when leaving.