Skip to main content
isikli
Associate III
Mar 25, 2026 12:12 PM UTC
Solved

How to erase rtc backup register with cube programmer

Could I erase rtc backup registers with STM32CubeProgrammer ?

image.png

waclawek.jan
waclawek.janBest answer
Super User
Mar 31, 2026 1:02 PM UTC

... and, to be able to write into PWR registers, you have to set RCC_APB1ENR.PWREN first... :)

JW

6 replies

Peter BENSCH
ST Technical Moderator
Mar 26, 2026 7:43 AM UTC

Yes, it is possible, but not via the standard mass erase in STM32CubeProgrammer.

For STM32L010/L07x/L08x you have two practical options:

  1. Directly in STM32CubeProgrammer
    • Connect in Hotplug/Halt mode
    • Open Registers → RTC
    • Manually write 0x00000000 (or any value) to BKP0R, BKP1R, etc., then Apply.
  2. Via firmware (backup‑domain reset)

Program and run the following HAL code once; this clears all RTC backup registers:

__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
HAL_PWR_DisableBkUpAccess();

Only if both VDD and VBAT are completely removed will the backup registers be lost automatically.

Does that answer your question?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
isikli
isikliAuthor
Associate III
Mar 31, 2026 12:23 PM UTC

I try your suggestion via cubeprogrammer but I can't delete rtc bkp register. Please, check my video.

waclawek.jan
Super User
Mar 31, 2026 12:44 PM UTC

I don't use CubeProgrammer, but I believe you still need to enable the backup-domain access by setting PWR_CR.DBP before trying to overwrite the backup registers.

JW

isikli
isikliAuthor
Associate III
Mar 31, 2026 12:52 PM UTC

I try that PWR_CR.DBP register set firstly, still I can't delete. I guess I can't write to register via cubeprogrammer.

waclawek.jan
waclawek.janBest answer
Super User
Mar 31, 2026 1:02 PM UTC

... and, to be able to write into PWR registers, you have to set RCC_APB1ENR.PWREN first... :)

JW

isikli
isikliAuthor
Associate III
Mar 31, 2026 3:25 PM UTC

Thank you, That is worked.