RTCv1 synchronization tentative fix.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10119 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2017-03-06 14:19:46 +00:00
parent 81675a0259
commit 8d1dc1313c
1 changed files with 3 additions and 0 deletions

View File

@ -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;