AnsweredAssumed Answered

Having some trouble setting TR in the RTC

Question asked by Enyart.Jason on Dec 5, 2012
Latest reply on Dec 7, 2012 by Enyart.Jason
I'm working with a mix of STM drivers and in in-house drivers, some of which we have written, some of which we inherited.  I am trying to set the date and time in the RTC, starting with TR.  It is not working.

Here is what I am doing:

1) Starting with enabling backup domain reset.  Confirmed that BDRST changes to set. I am doing this because I wanted to simulate a POR and see all of the register values change- it appeared that a debugger reset would not.
2) Unlocking backup domain write protection.  
3) Disabling backup domain reset. Confirmed BDRST is clear. The reason I did this after step 2) was that if I did it right after step 1), I was not seeing RTCSEL change to default after step 1).  When I moved this to after step 2), I did.  Not sure why.
4) Select LSI as clock source.  Confirmed RTSSEL set to LSI (0x2).
5) Enabled the RTC clock.  Confirmed RTCEN changes to enabled. I don't set LSION because it was already enabled for the watchdog.
6) Unlocked the RTC registers by writing 0xCA and 0x53 in sequence to WPR (write only). 
7) Activate init mode and wait for it.  Confirmed INIT and INITF both change to set.
8) Try to write to TR.  Nothing happens.

Looking through RM0090 and and AN3371, this looks like what needs to be done, more or less, to set TR and DR but I am obviously missing something.  I did not adjust the pre-scalers, assuming that I was "close enough" for a sanity check with LSI.

Outcomes