From 81675a02592a8b946e8512d92f7be26588da959b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 6 Mar 2017 14:11:37 +0000 Subject: RTCv2 wakeup tentative fix. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10118 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c | 3 ++- os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'os/hal') 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; -- cgit v1.2.3