Skip to main content
M��az
Associate
October 2, 2019
Solved

STM32WB55RG RTC strange initialization behaviour

  • October 2, 2019
  • 2 replies
  • 829 views

Hi guys,

im working on project with STM32WB55RG and noticed very strange behaviour of RTC peripheral.

After power up everything works fine but after reset RTC peripheral won't initialize. I'm using HAL library. After further investigation of code I've found that problem is with unlocking write protection on RTC register. After reset writing 0xCA and 0x53 to WPR takes no effect (can't write anything to register). Again, after power-up everything works. The problem is only with RTC, everything else works no matter what.

I'd like to add I'm using TrueStudio and LSI clock source. This happens on all 3 prototypes I have.

Maybe you guys will help because I'm out of ideas.

This topic has been closed for replies.
Best answer by Remi QUINTIN

Note that the RTC peripheral won't initialize after a system reset as it is built for such case.

The RTC current calendar registers are not affected by a system reset.

When the RTC is clocked by the LSE, the RTC keeps on running under system reset if the reset source is different from the Backup domain reset.

The sequence 0xCA and 0x53 to the RTC_WPR register has no effect in your case (system reset) as it is only used after a backup domain reset, not after a system reset. After a system reset, the DBP bit in the PWR_CR register must be set in order to enable RTC registers write access.

The protection mechanism is not affected by a system reset. If the registers were protected before a system reset, they remain protected after. So depending on the source of the reset (system or backup domain), the bit field to set to unprotected the RTC registers are not the same.

Can you try with the DBP bit set?

2 replies

Remi QUINTIN
Remi QUINTINBest answer
ST Technical Moderator
October 2, 2019

Note that the RTC peripheral won't initialize after a system reset as it is built for such case.

The RTC current calendar registers are not affected by a system reset.

When the RTC is clocked by the LSE, the RTC keeps on running under system reset if the reset source is different from the Backup domain reset.

The sequence 0xCA and 0x53 to the RTC_WPR register has no effect in your case (system reset) as it is only used after a backup domain reset, not after a system reset. After a system reset, the DBP bit in the PWR_CR register must be set in order to enable RTC registers write access.

The protection mechanism is not affected by a system reset. If the registers were protected before a system reset, they remain protected after. So depending on the source of the reset (system or backup domain), the bit field to set to unprotected the RTC registers are not the same.

Can you try with the DBP bit set?

M��az
M��azAuthor
Associate
October 2, 2019

It worked!

Thank you very much!