cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_Delay / HAL_SuspendTick ?

SWenn.1
Senior III

I am trying to run code in LPSleep mode. I found a video that seems to describe the use of SuspendTick and ResumeTick to do this. I have created a small example where I push a button it jumps into an EXTI handler and toggles an LED. Within this ISR I am calling HAL_Delay for debounce, however I am finding that my code hangs up in app_entry.c HAL_Delay function. Can someone tell me when you go into low power mode should you be changing the Timebase Source in the .ioc file to something other than SysTick?

0693W00000HoqyQQAR.png0693W00000HoqyLQAR.png

3 REPLIES 3
KnarfB
Principal III

For HAL_Delay to make progress, SysTick must be enabled (running). For sleep modes, if you called HAL_SuspendTick before going to sleep, call HAL_ResumeTick before HAL_Delay. Changing the timebase is ment for using RTOS which use SysTick for their own purposes (scheduling), not for sleep modes.

hth

KnarfB

SWenn.1
Senior III

Yes I am trying that and not seeing great results....ie about 5mV read across a 1 ohm resistor (ie 5mA) using an oscilloscope. In .ioc I configured PA0 as SYS_WKUP1. I was hoping to put this on a scope and see it change states when I went into LPSleep....Is this how this pin works?

ioc file...using LSE (32768 hZ) for LPTIM1 and HSE for CPU1 (64MHz)

0693W00000HovGYQAZ.png

I'm not a WB55 expert. Generally, low power sleep stops only the CPU. This mode is endend by any interrupt (like EXTI, Timer, SysTick,...) or event. In contrast, there are some dedicated WKUP pins which work as inputs and recover from standby and shutdown modes which have lowest power consumption.

hth

KnarfB