2021-05-27 02:02 AM
Hi,
I have an STM32G0 with VBATT input for the RTC.
When I restart the circuit, the time is reset.
At the power On I write this instruction :
HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1);
Before of the Power Off :
HAL_RTCEx_BKUPWrite(&hrtc, RTC_BKP_DR1, 0x32F2);
Thanks for your Help.
Pascal
Solved! Go to Solution.
2021-05-27 05:30 AM
Hi Jan,
thank you. Solved the problem.
It was a mistake during the RTC init() setup.
Thank you for your help !!
Pascal
2021-05-27 02:23 AM
Is battery connected to the VBAT pin? What is its voltage, measured directly on that pin?
How does writing to backup register relate to time of RTC?
Is that backup register content retained during powerdown?
JW
2021-05-27 02:47 AM
Hi Jan,
thanks for your help.
On the Pin = 2.7 V
How does writing to backup register relate to time of RTC?
I don't know how to write the current time on the register.
Is that backup register content retained during powerdown?
how can i check?
Thanks, Pascal
2021-05-27 03:35 AM
>> How does writing to backup register relate to time of RTC?
> I don't know how to write the current time on the register.
Why do you need to write it? And what is 0x32F2?
> At the power On I write this instruction :
> HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1);
And what does that function return?
JW
2021-05-27 04:40 AM
Hi Jan,
Time=HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1);
Return Time= 11001011110010
What is the correct instructions for read the time and date after the Power On of the circuit ?
Thanks for your help.
Pascal
2021-05-27 05:01 AM
> What is the correct instructions for read the time and date after the Power On of the circuit ?
It does not differ from reading the time and date in any other instance... Normally, just read RTC->TR and RTC->DR (in this order, if BYPSHAD is 0).
I don't use Cube.
JW
2021-05-27 05:30 AM
Hi Jan,
thank you. Solved the problem.
It was a mistake during the RTC init() setup.
Thank you for your help !!
Pascal