cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding Backup Domain & what happens when (RTC, backup registers, power cycle)

SKled.1
Senior II

Hello,

I was reading the reference manual of the STM32F091, in particular the RTC chapter.

Then I looked at what the CubeIDE generated (set all to LL, not HAL) init code does.

So it has this function SystemClock_Config() where all clocks are configured.

There it :

  1. enables backup access (set DBP in PWR->CR)
  2. resets the backup domain (setting and then clearing BDRST in RCC->BDCR)
  3. sets the clock source to HSI (RTCSEL bits in BDCR), as I don't have an external clock crystal
  4. enables RTC (set RTCEN in RCC->BDCR)

From what I took from the manual, 2. will clear the backup registers.

So if I want to use them, among other things, as a communication method between an application and a bootloader, I need to modify that to not do that - if I determine, well, what exactly?

That's still unclear to me.

Will any part of the RTC stuff still be enabled after a sysreset / or even power off/on (while VBAT was still buffered)? I.e. can I check any of the register flags to determine that I do not need to do the backup domain reset?

Which part of the above procedure needs to be done still?

And is this changed by whether an external clock crystal is used or the internal RC oscillator is used? It seems to me that the latter won't run when VDD is off, but if an external one is used, the oscillator circuitry will still run as long as VBAT has enough power - and I guess that RTC stuff needs a clock, well at least for the clock feature of course. Probably not for just holding the register contents?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The VBAT pin powers the backup domain. If VDD power is lost but VBAT remains, the backup domain, including the backup registers and RTC settings, is retained.

0693W000005Cu1iQAC.png 

RTC clock can be HSE, LSE, or LSI. Only the LSE clock is in the backup domain, so if you need RTC while VDD is off, you need to have the LSE clock source.

The proper way to detect brownout is answered in your other post:

https://community.st.com/s/question/0D53W00000PTMWDSA5/backup-registers-using-them-to-detect-power-issues-will-this-work

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

View solution in original post

1 REPLY 1
TDK
Guru

The VBAT pin powers the backup domain. If VDD power is lost but VBAT remains, the backup domain, including the backup registers and RTC settings, is retained.

0693W000005Cu1iQAC.png 

RTC clock can be HSE, LSE, or LSI. Only the LSE clock is in the backup domain, so if you need RTC while VDD is off, you need to have the LSE clock source.

The proper way to detect brownout is answered in your other post:

https://community.st.com/s/question/0D53W00000PTMWDSA5/backup-registers-using-them-to-detect-power-issues-will-this-work

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