cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55RG RTC strange initialization behaviour

M��az
Associate

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

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?

View solution in original post

2 REPLIES 2
Remi QUINTIN
ST Employee

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?

It worked!

Thank you very much!