cancel
Showing results for 
Search instead for 
Did you mean: 

[F103] RTC_ALR not preserved after reset

ziutek
Associate
Posted on January 21, 2016 at 01:03

I have a problem with RTC_ALR behaviour.

The RM0008 in 18.3.2 says:

All system registers are asynchronously reset by a System Reset or Power Reset, except for RTC_PRL, RTC_ALR, RTC_CNT, and RTC_DIV.

 

The RTC_PRL, RTC_ALR, RTC_CNT, and RTC_DIV registers are reset only by a Backup

 

In my application I use PRL, ALR, CNT, DIV and some backup registers. They all are preserved after reset or power-off (with battery connected to VBAT), except ALR which is always reset to 0xFFFFFFFF.

There is no problem writing to it and read it. When alarm is set it can generate both kind of interrupts (RTC and RTCAlarm) without any problem in run and sleep mode (I didn't tested stop nor standby mode).

This is very strange thing, especially that any other registers from backup domain which I use (RTC_PRL, RTC_CNT, BKP_DR1, BKP_DR2) aren't affected.

I tested this on STM32F103RCT6 and STM32F103C8T6 with the same result.

Errata sheet doesn't mention such bug. Internet doesn't help too...
1 REPLY 1
ziutek
Associate
Posted on January 21, 2016 at 09:02

It seems that I found the source of this problem.

I haven't notice that documentation describes ALRH and ALRL registers as write-only.

It seems that you can read last written value but this is only copy provided by ABP1 domain.

There is no way to read ALR value from RTC domain, but it should be there and generate interrupts properly. I will try to test it...

After reset the ALR mirror in APB1 domain is initialized to default 0xFFFFFFFF value. So if you need to known after reset what alarm time was set, you need to store it somewhere, e.g. in pair of backup registers.