Skip to main content
Associate II
February 16, 2026
Question

SysTick in Standby and Sleep mode

  • February 16, 2026
  • 4 replies
  • 152 views

Hi,

I am using Nucleo-L476RG. My I want to send data over SPI every 20000ms and during this 20000ms MCU will goes in sleep/standby mode. I want to keep track time of last 2 SPI data transmission.

But the issue is HAL_GetTick() reset after waking up from standby mode. so not able to track the time between last two data transfer.

4 replies

Andrew Neil
Super User
February 16, 2026

Use the RTC ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User
February 16, 2026

In sleep mode, data is kept. Should be straightforward doing this.

In standby mode, SRAM data is lost but you can adjust your program to keep SRAM2 and store data there between resets. You'll have to ensure it is not initialized on startup.

TDK_0-1771248967350.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
mangesh1Author
Associate II
February 16, 2026

I want to keep track exact time between last 2 data transfer like.
1 data sent at 1ms --> MCU goes sleep/ standby mode for 20000ms --> MCU wake Up --> 2nd data sent at 20001ms --> MCU goes sleep/ standby mode for 20000ms --> MCU wake Up --> 3rd data sent at 20004ms --> MCU goes sleep/ standby mode for 20000ms --> MCU wake Up....

The issue is HAL_GetTick() reset after waking up from standby mode. so not able to track the time between last two data transfer.


 I can't use RTC because it is not battery powered device.


Is there any solution for the same?

Andrew Neil
Super User
February 16, 2026

@mangesh1 wrote:

 I can't use RTC because it is not battery powered device.


Sure, you can use the RTC in a non battery-powered device!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Technical Moderator
February 17, 2026

Hello @mangesh1 
If using STOP mode is an available option, you can use LPTIMER to track the time between each 2 data transfers.
BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.