2017-01-30 09:10 AM
Hi all:
I used the device as a data logger, wake up from shutdown mode if the nucleo RTC alarm goes off on 29 minute every hour.
But it seems the system RTC display wrong time before the device enters shutdown mode.
So I use one I2C DS3231 RTC module as reference.
And the I2C RTC is the same.
Here are some snippet.
It looks fine at the beginning.
At the end
No matter system rtc or i2c rtc displayed the wrong time.
But another acquisition can start on the right time, display right time infomation.
Attachments are source file and log file.
Could someone tell me how to fix it?
Thank you all in advance.
#stm32l476rg2017-01-30 01:22 PM
At least 2 issues:
STM32L486xx HAL User Manual: Initialization and de-initialization functions
(#) To read the calendar through the shadow registers after Calendar
initialization, calendar update or after wakeup from low power modes the software must first clear the RSF flag. The software must then wait until it is set again before reading the calendar, which means that the calendar registers have been correctly copied into the RTC_TR and RTC_DR shadow registers. The HAL_RTC_WaitForSynchro() function implements the above software sequence (RSF clear and RSF check).
STM32L486xx HAL User Manual: RTC Time and Date functions
Note:
You must call after to unlock the values in the higher-order calendar shadow registers to ensure consistency between the time and date values. Reading RTC current time locks the values in calendar shadow registers until Current date is read.I don't Cube so I won't help with fixing this.
JW