cancel
Showing results for 
Search instead for 
Did you mean: 

SysTick in Standby and Sleep mode

mangesh1
Associate II

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.

5 REPLIES 5
Andrew Neil
Super User

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

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".
mangesh1
Associate II

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?


@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.
Gyessine
ST Employee

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.