cancel
Showing results for 
Search instead for 
Did you mean: 

Having Problems activating SysTick after Stop mode

HMucc.1
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions

-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.

View solution in original post

3 REPLIES 3
HMucc.1
Associate II

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

-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.

aasdt
Associate

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.