cancel
Showing results for 
Search instead for 
Did you mean: 

Can you write values to the RTC counter registers(RTC_CNTL/RTC_CNTH) after you've set them to an intial value?

HAbay.1
Associate III

I've been trying to implement a clock and calendar into my solar tracker project(using an stm32f103) so that I can set at which time it should go to sleep ( and for how long) , but every time the board goes into standby the counter -unfortunately- gets reset. To counter act that, I tried writing the values of the counter register into the backup registers (which worked just fine) writing these values back to the counter registers turned out to be quite a hassle however, and it just never seemed to work for me. I did disable the write protection and enabled the CNF bit mind you, but their values just wouldn't change .

1 ACCEPTED SOLUTION

Accepted Solutions
HAbay.1
Associate III

I solved this issue by turning off the LSE first (RTC clock) before modifying the value of the counters. I noticed that when i was modifying the values of the counter it just resets them so it had to be that , and it was fortunately!

View solution in original post

3 REPLIES 3
TDK
Guru

From the reference manual:

To write to this register it is necessary to enter configuration mode (see Section 18.3.4: Configuring RTC registers).

Did you do that?

Next time please include the chip number in your post.

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

yes, I did and the chip is the f103

HAbay.1
Associate III

I solved this issue by turning off the LSE first (RTC clock) before modifying the value of the counters. I noticed that when i was modifying the values of the counter it just resets them so it had to be that , and it was fortunately!