cancel
Showing results for 
Search instead for 
Did you mean: 

RTC reset with VBATT

Prisma
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Jan,

thank you. Solved the problem.

It was a mistake during the RTC init() setup.

Thank you for your help !!

Pascal

View solution in original post

6 REPLIES 6

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

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

>> 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

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

> 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

Hi Jan,

thank you. Solved the problem.

It was a mistake during the RTC init() setup.

Thank you for your help !!

Pascal