cancel
Showing results for 
Search instead for 
Did you mean: 

Internal RTC STM32F1 - Want to store Time before RTC switches to VBAT

Deoyani
Associate II

I am using STM32F103ZGT6 

I have initialize code From STMCubeMx with  settings-> PLL -ON , HSE -ON , LSE- ON  for Internal RTC

I have written code to retain date for internal RTC. I want the event when RTC switches from VDD to VBAT , as per my application requirement I want to store Time at which power offs and Time at which power come , Accordingly I want show how many hr or min or sec power was off .

I have checked the Datasheet it is written that Power Down Reset(PDR) occurs when VDD shifts to VBAT I have tried with that flag in the code but didn't work

Can you suggest me some solution for this   

 

11 REPLIES 11

Yes, this is potential problem if somebody uses EEPROM circuit for this purpose.

However, in this case there is no this kind of limitation, since RTC Backup registers are located to RAM memory which is backupped with battery.

Br J.T

I have changed the code and tried that After receiving "Store"  string from UART then get the time and write the time into backup register , 

I am reading the backup register  before the 

if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
 
Error_Handler();
}
then also I am getting current time in only not the time I have stored after receiving "store" from UART.
How to store it ,write it time  into backup register .when ever I read backup register I am getting current time .