2021-10-19 08: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();
}
-----------------------------------------------------------
2021-10-19 08:38 AM
There isn't a bug in the code that you've shown. Perhaps systick isn't being configured correctly in SystemClock_Config. Perhaps interrupts are disabled. Set a breakpoint in HAL_InitTick and see that it gets there and successfully completes.
2021-10-19 08:50 AM
HAL_InitTick returns HAL_OK.
I am using code generated from cubeide. No code is written manually. If I missed something here, I dont know what its is.
2021-10-19 08:56 AM
In NVIC configuration Time base: System tick timer : "Generate IRQ handler" is checked, and "Call HAL handler" checked.
It looks like irq is not enabled at all. I tried __enable_irq(); from CMIS but with no result.
2021-10-20 12:58 AM
LedToogle example from ST works. The differences are in system_stm32g0xx.c file, at section VECT_TAB_ADDRESS. When I will use system_stm32g0xx.c from example sysytick in my test application works. But when file system_stm32g0xx.c is taken from new projectit generated from CubeIDE systick interrupt doesnt work.
And question: I am doing sth wrong, or is bug in generating code ?
2021-10-20 01:08 AM
problem - SBC->VTOR is not initialised.
When I add to SystemInit() line: SCB->VTOR = FLASH_BASE it now works.
So question ST has a bug, or I have something missed when generating simple test project ?
2021-10-20 08:50 AM
Hello @Xme and welcome to the Community 🙂 ,
Please have a look at my answer in this post. Hope this answers your question.
Note that I already raised the issue internally with the CubeMX team to take the necessary action.
Thanks for your contribution and if you still have issues, please don't hesitate to come back to the Community.
Imen
2021-10-20 09:00 AM
2023-03-07 12:50 AM
2023 : Problem still not solved in STMCube...
2023-03-07 04:00 AM
Maybe I am too dumb, but what is exactly wrong with keeping the default VTOR value of 0? User Flash is normally mapped there, right? In many of my projects not using the bootloader I removed the VTOR setting from system_***.c and I couldn't see a problem with that.