From 8d1dc1313cf3d1ce8f7793d037c1df0c0591dc8c Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 6 Mar 2017 14:19:46 +0000 Subject: RTCv1 synchronization tentative fix. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10119 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'os/hal') diff --git a/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c index 27689839d..9fe6417b2 100644 --- a/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c @@ -399,6 +399,9 @@ void rtcSTM32GetSecMsec(RTCDriver *rtcp, uint32_t *tv_sec, uint32_t *tv_msec) { /* Required because access to CNT and DIV.*/ rtc_apb1_sync(); + /* wait for previous write accesses to complete.*/ + rtc_wait_write_completed(); + /* Loops until two consecutive read returning the same value.*/ do { *tv_sec = ((uint32_t)(rtcp->rtc->CNTH) << 16) + rtcp->rtc->CNTL; -- cgit v1.2.3