aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-03-06 14:11:37 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-03-06 14:11:37 +0000
commit81675a02592a8b946e8512d92f7be26588da959b (patch)
tree70a69afe535618ac6e4c6aa158f638e2f489bd8c
parent4acb7db6d447c49af08712aacdabc86361da6bc5 (diff)
downloadChibiOS-81675a02592a8b946e8512d92f7be26588da959b.tar.gz
ChibiOS-81675a02592a8b946e8512d92f7be26588da959b.tar.bz2
ChibiOS-81675a02592a8b946e8512d92f7be26588da959b.zip
RTCv2 wakeup tentative fix.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10118 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c3
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
index 6d44570f1..a6c776d3a 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
+++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
@@ -512,7 +512,8 @@ void rtcSTM32SetPeriodicWakeup(RTCDriver *rtcp, const RTCWakeup *wakeupspec) {
while (!(rtcp->rtc->ISR & RTC_ISR_WUTWF))
;
rtcp->rtc->WUTR = wakeupspec->wutr & 0xFFFF;
- rtcp->rtc->CR = (wakeupspec->wutr >> 16) & 0x7;
+ rtcp->rtc->CR &= ~RTC_CR_WUCKSEL;
+ rtcp->rtc->CR |= (wakeupspec->wutr >> 16) & RTC_CR_WUCKSEL;
rtcp->rtc->CR |= RTC_CR_WUTIE;
rtcp->rtc->CR |= RTC_CR_WUTE;
}
diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h
index e42b400e8..ad2807a0e 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h
+++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h
@@ -160,6 +160,7 @@ typedef struct {
/**
* @brief Wakeup as encoded in RTC WUTR register.
* @note ((WUTR == 0) || (WUCKSEL == 3)) are a forbidden combination.
+ * @note Bits 16..18 are copied in the CR bits 0..2 (WUCKSEL).
*/
uint32_t wutr;
} RTCWakeup;