cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use RTC timestamp with standby?

obj87
Associate II

We have a STM32H725 and would like to use the RTC timestamp when entering/exiting standby but from what I understand from the reference manual this is not possible? I did run a quick test and the event doesn't seem to fire even though it works as expected when  we power it down externally so it runs only on VBAT.

Before I give up and solve it a different way I came here to verify whether it was possible to do so? 

// Hopeful developer

3 REPLIES 3
TDK
Super User

Per the reference manual, the system exits standby on an RTC timestamp event.

TDK_0-1769013011993.png

 

If you feel a post has answered your question, please click "Accept as Solution".
obj87
Associate II

Out of memory this is what the example I tried looked like. I provided it mostly to show what the goal was. If I use the external button to turn of power so that it runs on VBAT it behaves as expected and I can retrieve the timestamp when turning the power on agian. If I wait until it enters standby there is no timestamp upon start and it will just print "No timestamp occurred\n".

So I am not trying to use the timestamp as a wakeup source, I am trying to timestamp when entering standby.

Unless I misunderstood your answer and then I apologize.

if (__HAL_RTC_TIMESTAMP_GET_FLAG(&hrtc, RTC_FLAG_TSF))
{
    RTC_TimeTypeDef time;
    RTC_DateTypeDef date;
    HAL_RTCEx_GetTimeStamp(&hrtc, &time, RTC_FORMAT_BIN);
    HAL_RTCEx_GetTimeStampDate(&hrtc, &date, RTC_FORMAT_BIN);
    __HAL_RTC_TIMESTAMP_CLEAR_FLAG(&hrtc, RTC_FLAG_TSF);
    // do stuff with the rtc data
}
else
{
 LOG("No timestamp occurred\n");
}

HAL_RTCEx_SetInternalTimeStamp(&hrtc)

// delay to give me time to kill the power 
vTaskDelay(15000);

// Clean up and enter standby mode
systemEnterStandby(4000);

 

waclawek.jan
Super User

waclawekjan_0-1769015736882.png

You enter Standby (or any other power saving mode) by a software action, in contrast to entering VBAT mode, which is a loss of power. Thus, as the mcu is running when you enter standby, you can simply read the current time from RTC and store it in any suitable way, there's no need to have hardware for that.

JW