Skip to main content
Visitor II
September 2, 2021
Question

SysTick interrupt does not work

  • September 2, 2021
  • 4 replies
  • 17127 views

Using St Cube IDE 1.6.0, I create new project for STM32G491KE.

When debugging the project I noticed that Systick interrupt is not getting called. Systick STK_VAL register is changing, and STL_CTRL register COUNTFLAG bit is set. Interrupt in stm32g4xx_it.c void SysTick_Handler(void) is never called as a result uwTick is never incremented and HAL_Delay() function hung up because of this.

What could be a reason? The project is autogenerated, nothing is done to it manually, only hal_delay() function call in for(;;) loop.

    This topic has been closed for replies.

    4 replies

    Super User
    September 2, 2021

    Is the NVIC SysTick interrupt enabled? Is TICKINT set?

    Are interrupts disabled in general?

    TMark.14Author
    Visitor II
    September 2, 2021

    I believe that Cube IDE knows how to initialize systick, so "Yes" to all questions.

    Vector table did not seem right to me. Systick interrupt vector at address 0x0000003c (RM0440 page443) did not have a value of the handler function location that I got from elf file:

    [ 200] 080008c7 0000000c FUNC GLOBAL  2 SysTick_Handler 

    Turns out the problem was also because of the boot pin state. On power up MCU would bootup into sysmemory, debugger would make it jump into flash memory but it would not change vector table. So the vector table was not correct for my application hence systick interrupt did not increment my variable.

    Issue is solved.

    Explorer II
    December 1, 2023

    Hi Tmark.14,

     

    I am having the same issue with STM32L431CBT6. I am using STM IDE cube 1.14 and STlink-V3. 

    I checked the system tick. it is running. 

    DKhan1_0-1701459589879.png

     

    DKhan1_1-1701459675952.png

    DKhan1_2-1701459699405.png

    The SysTick_Handler(void) is never getting called. 

    Can you suggest any solution.

    Kind regards,

    Dibyendu

     

     

    Visitor II
    May 4, 2023

    I'm sharing my solution in my case. Using Stm32 Cube IDE 1.12.1 and Nucleo G491RE. Systick interrupt stopped to work after I switched from HAL to LL version in Project Manager -> Advanced Settings for all peripherals including RCC. Later, during the investigation of this problem, I found that CubeMX dialog shows tooltip stating that system interrupts are always allowed, not need to be allowed. But, after I add following line in User code zone, systick interrupt starts to work:

    LL_SYSTICK_EnableIT();

    My issue solved.

    Explorer
    June 27, 2023

    This fixed the issue for me -  Thnks!

    Super User
    May 4, 2023

    > tooltip stating that system interrupts are always allowed,

    > not need to be allowed

    This is slightly misleading.

    Interrupts are generally enabled at two places: at the source (here: in the Systick module), and in NVIC.

    System interrupts indeed don't need to be enabled in NVIC, but they still need to be enabled at the source (except HardFault and NMI (although sources of NMI may still need enabling)).

    Corollary is, don't blindly trust the clicking interfaces. Mcu works out of the registers, not out of whatever you've clicked, not even out of C source code nor libraries.

    JW