cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I am using STM32F407ZGT6 and have the issue with time of RTC peripheral which resets to initial value after power down the board while VBAT pin is connected to CR1220 battery and LSE is used as crystal. How can I solve it?

Aasda.3
Associate II
51 REPLIES 51

How is PDR_ON pin connected?

Jw

Aasda.3
Associate II

thanks for your answer ,

It's pulled up with 0 ohm resistor to VDD

I don't have any problem when resetting the board by NRST pin. Only issue is when power cut in which time is reset to initial value ? (my code is attached)

thanks

> (my code is attached)

You may want to indicate somehow that time reset happened, maybe by blinking a LED or something similar.

> Only issue is when power cut in which time is reset to initial value ? (my code is attached)

Measure voltage directly on VBAT pin, is it correct even during power down?

Do you have BOR enabled in Option bytes? If not, try to enable it.

JW

Aasda.3
Associate II

VBAT pin is 3.06 in both situations.

I enabled BOR level 2 but nothing was changed.

I used a blinked led to indicate whether the RTC_BKP_DR1 is reset or not when power is downed and I don't know why the RTC_BKP_DR1 is reset?

Is it a bug in the programming with HAL or not?

Aasda

> Is it a bug in the programming with HAL or not?

I don't know, I don't use Cube/HAL.

You've said, that:

> I don't have any problem when resetting the board by NRST pin. Only issue is when power cut

So, the LED blinks when you power down/up, but it does not blink when you use the NRST pin, correct?

In this case, I have no more ideas how to proceed, sorry.

JW

Aasda.3
Associate II

> So, the LED blinks when you power down/up, but it does not blink when you use the NRST pin, correct?

Exactly, backup registers reset after power down.

Thanks JW for your tips.

I hope some body find the solution for this issue

Aasda.3
Associate II

Hi,

Nobody knows how to fix this issue?

Thanks

JTP1
Lead

Try place these before try to read RTC_BKP_DR1. All of those not necessarily needed, test which line(s) helps.

  __BKPSRAM_CLK_ENABLE();
 HAL_PWR_EnableBkUpAccess();
 __HAL_RCC_RTC_ENABLE();
 __HAL_RCC_BKPSRAM_CLK_ENABLE(); 
 HAL_PWREx_EnableBkUpReg();

AScha.3
Chief III

try -just as a test - leave away rtc init :  // MX_RTC_Init();

then test rtc is reset or not.

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