2014-01-08 05:30 AM
Hi Everybody,
I am using the RTC WakeUp Timer while in Stop mode. The MCU can either leave the Stop mode at the end of the timer, or on an external IRQ. At this level, everything is working perfectly.However, when the MCU is awaken from the external IRQ, I want to read the value of the RTC WakeUp Timer register (RTC_WUTR) and this is not working.The register RTC_WUTR always return the value it is set to, but not its current value.I know the RTC WakeUp Timer is running but the register does not seems to update itself.Is there anything specific that needs to be done to read this register? Is it possible it is somehow read protected?Thanks in advance for your help! #stop-mode #poor-quality-of-documentation #stm32l151 #rtc2014-01-08 07:30 AM
I'm not using the L1, but the obvious starting point would be
/* Enable the PWR clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
/* Allow access to RTC */
PWR_RTCAccessCmd(ENABLE);
2014-01-08 09:59 AM
2014-01-08 11:56 PM
You probably misunderstood the purpose of the available hardware registers, namely RTC_WUTR. It simply holds the reload value. The (down)counter itself is not available. Read the fine manual.
[EDIT] Oh, I see what confused you - in RM0038 rev 8, 19.3.4 on page 468, the functional description (starting with ''When the initialization sequence [...]) of the wakeup timer is mistakenly and confusingly left with the description of WUCKSEL[2:1]=11 case, whereas it is supposed to form a separate paragraph. Yes, the quality of manuals IS poor. JW2014-01-09 01:00 AM
You probably misunderstood the purpose of the available hardware registers, namely RTC_WUTR. It simply holds the reload value. The (down)counter itself is not available. Read the fine manual.
[EDIT] Oh, I see what confused you - in RM0038 rev 8, 19.3.4 on page 468, the functional description (starting with ''When the initialization sequence [...]) of the wakeup timer is mistakenly and confusingly left with the description of WUCKSEL[2:1]=11 case, whereas it is supposed to form a separate paragraph. Yes, the quality of manuals IS poor.JW2014-04-30 01:26 AM
Hi Cris,
I am having the same problem as you. I want my application to stay in stop-mode as much time as possible (28 sec max). To wake up from stop-mode I use the WUT of the RTC or an external interrupt. When external interrupt wake up the device, my RTOS needs to know how much time had pasted, so, I thought reading the RTC WUT register is the perfect solution, but to my disappointment I did not succeed reading the timer itself, but only the reload value. Is there any news with this post? Did you find some solution to this problem? Thank you very much, Itay2016-04-07 01:41 PM
I have searched for any documentation that states that RTC->WUTR can not be read, despite having a function to read. This register is documented on page 531 of the Reference Manual (RM0038), but there is nothing there indicated reading it only returns the value programmed into it. Could you please direct me to documentation explaining this register can not be read? Reading it would be useful in a number of applications such as debugging (determining if it is running), and assuming it is not stopped at Wakeup, determining how much time is spent in Wakeup before going back to Stop. It is also possible that the documentation regarding waking from standby may need some clarification as this appears to be quite different from waking from Stop and I can't see this explained. One other undocumented item seems to be that RTC->ISR bits can be reset even when the RTC registers are protected.