When you update any RTC register you MUST wait for the operation to complete.
If you're using ST's standard peripheral library you accomplish this by a call to RTC_WaitForLastTask(); (See the attached image) I suspect you're not doing this and one or more writes are being missed.
I use stop-mode and I'd really like to use RTC_SECOND but it simply doesn't work: once in stop-mode rtc second interrupts dont't awake the cpu. In fact reading the reference manual (pag. 61 table 11):
(about exiting from stop mode) <<.. If WFI was used for entry: Any EXTI Line configured in Interrupt Mode( the corresponding EXTI Interrupt vector must be enavlled in the NVIC)>> I understand that I need to configutre EXTI as Interrupt Event but as far as I know just ALARM has its own EXTI line (line 15) then SECOND INTERRUPT cannot awake from STOP. Am I right?
Only RTC Alarm Event mapped on EXTI Line 17 can wake up the system from Stop mode. All details for stop mode enrty/ exit are available in RM0008 and you can find some examples in AN2629. teik_hong.ongFriday, May 14, 2010 8:40 AMRTC alarm versus clock Counter
Hi,
You can't use RTC second interrupt in stop mode. Pls refer to application note AN2629. BR, Ong