Adds date retention in the backup memory for the stm32f1xx#58
Adds date retention in the backup memory for the stm32f1xx#58fpistm merged 3 commits intostm32duino:mainfrom
Conversation
1fc2397 to
9cee107
Compare
|
update after review: |
fpistm
left a comment
There was a problem hiding this comment.
Please update the README.md.
One suggestion in the example to use \n instead of \r mainly for windows.
Else LGTM.
|
updates the README.md |
011ba02 to
a802a9b
Compare
|
rename sketch to |
The stm32F1 RTC date value are read/write from/to a BackUp register : RTC_BKP_DATE The BackUp register DR6 is choosen and can be changed easily, with a not-already-used one. The stm32F1 has 16bit backup reg. : 2 consecutive addresses are reserved. Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Francois Ramu <francois.ramu@st.com>
On the stm32F1, this example saves the date of the current RTC. With flag true, the BackUp Registers are cleared. Then on the next reset the RTC starts the from initial date (1/1/2000). With Flag false, on the next (warm) reset, the calendar starts from the (latest) saved value. Signed-off-by: Francois Ramu <francois.ramu@st.com>
|
rebase after merge of PR #57 |
|
Just want to thank you for this PR. I reviewed the code out of curiosity and it looks good. For future reference for other people who may come here and wonder, I verified that the code actually handles the 2 edge cases that I was worried about:
Both cases are handled because the RTC code in the HAL ( If I understand the HAL code correctly, I think there might be a small data-race condition inside |
|
It occurred to me last night that |
This PR adds a RTC date retention for the stm32F1 MCUs.
This new feature is saving/restoring the date (year, month, day, weekday) in the backup memory of he MCUs.
On the stm32F1, the Date is not present in the RTC peripheral but computed by the RTC driver.
The BackUp memory of the stm32F1 is powered by the VBat when VDD is switched off.
It is not altered by the system Reset.
Each one-byte element of the RTC Date (DateToUpdate) is well placed in two contiguous 16bit backup registers (RTC_BKP_DATE, RTC_BKP_DATE + 1). The registers are arbitrary selected to store the date and can be easily changed in the
rtc.hto choose other memory positions.Moreover, for the stm32F1, the 'reset' flag is now available in the
RTC::beginto reset the content of the backUp register.Note that the reset value of the RTC date in the stm32F1 is '01/01/2000'
A simple RTC examples/backupRTC is given to demonstrate this feature (--> test with different the
reset_bkupbool values).This PR is inspired by the #41
Fixes #32
Signed-off-by: Francois Ramu francois.ramu@st.com