Skip to main content
Visitor II
November 25, 2020
Solved

Having Problems activating SysTick after Stop mode

  • November 25, 2020
  • 2 replies
  • 1981 views

I'm using STM32F070CBT at 8mhz with almost all pins active (used for GPIOs, PWM, SPI,I2C,etc) , i'm using a timer to enter stop mode with low power regulator and waking up using GPIO external event, after waking up i checked that PWMs and GPIOs are still working but SysTick seems to have stopped as all delay functions enter a infinite loop on HAL_GetTick inside the delay function and SysTick_Handler is not being called anymore (i tested that using breakpoints) , i tried to activate SysTick again using :

  • Hal_Init();
  • HAL_ResumeTick();
  • HAL_InitTick(0);
  • SysTick->CTRL=0b011;

also tried to set SysTick priority to 0, also tried to recall "SystemClock_Config();" alongside SysTick activate function but it didn't work too , does anybody know what i need to do in order to re-activate SysTick?

    This topic has been closed for replies.
    Best answer by HMucc.1

    -Solved -

    Nobody writed a single reply, but i still think it's important to say it if anybody has the same issues, after waking up from Stop mode (which was being called in the interrupt of a timer) , i observed that SysTick Handler was still working and dind't need to be initialized again, but was bugging when i called delay instantly after waking up, so i set one flag and called it using "extern int TickStart" inside the SysTick Handler, and made it count until 9 (which kinda made a 9ms delay using SysTick Handler) , and after that i called the functions i needed outside of that timer interrupt and they worked (HAL_Delay and all functions that use it) , i just observed that the clock was a little different than configured so i needed to call "  SystemClock_Config();" just after waking up and that solved all my code problems.

    2 replies

    HMucc.1Author
    Visitor II
    November 25, 2020

    Correction : I checked systick handler (before using delay) and it is indeed entering the breakpoint, but when i call a single HAL_GetTick(); which is the function inside delay it enters a infinite loop and stops entering SysTick Handler

    HMucc.1AuthorAnswer
    Visitor II
    November 25, 2020

    -Solved -

    Nobody writed a single reply, but i still think it's important to say it if anybody has the same issues, after waking up from Stop mode (which was being called in the interrupt of a timer) , i observed that SysTick Handler was still working and dind't need to be initialized again, but was bugging when i called delay instantly after waking up, so i set one flag and called it using "extern int TickStart" inside the SysTick Handler, and made it count until 9 (which kinda made a 9ms delay using SysTick Handler) , and after that i called the functions i needed outside of that timer interrupt and they worked (HAL_Delay and all functions that use it) , i just observed that the clock was a little different than configured so i needed to call "  SystemClock_Config();" just after waking up and that solved all my code problems.

    Explorer II
    February 24, 2025

    Just to contribute with some more information in case this is what's happening. From the Reference Manual RM0360, under 6. Power Control > 6.3 Low-power modes > 6.3.4 Stop mode > Exiting Stop mode:

    When exiting Stop mode by issuing an interrupt or a wake-up event, the HSI oscillator is selected as system clock.

    That probably explains your issue with changing clock and need to reconfigure again. Depending on the previous selected source / preescalers, speed and thus reload value for timeout may not match.