What causes the stm32 RTC to reset?
Re: What causes the stm32 RTC to reset?
Bug report created here: https://github.com/stm32duino/STM32LowPower/issues/22
Re: What causes the stm32 RTC to reset?
This is not a bug.Bambo wrote: ↑Wed May 20, 2020 11:21 am Bug report created here: https://github.com/stm32duino/STM32LowPower/issues/22
Simply wrong usage of the API. See my comment here:
https://github.com/stm32duino/STM32LowP ... -631491658
Re: What causes the stm32 RTC to reset?
"rtc.setClockSource(STM32RTC::LSE_CLOCK); " needs to be called before rtc.begin();
all about rtc library:
https://github.com/stm32duino/STM32RTC
Re: What causes the stm32 RTC to reset?
I am entering the same problem more complicated.fpiSTM wrote: ↑Wed May 20, 2020 2:02 pm This is not a bug.
Simply wrong usage of the API. See my comment here:
https://github.com/stm32duino/STM32LowP ... -631491658
The time is saved during reset and complete power off with a CR2032 battery, but not the date and weekday.
rtc.isTimeSet() reads correct as one, but the date is lost after the next reset or power lost.
I have tested this with two different Blue-Pills, one named with CKS32 and another that seems to be a STM32F103C8T6 clone.
This is my initialization:
Code: Select all
#include <STM32RTC.h>
/* Get the rtc object */
STM32RTC& rtc = STM32RTC::getInstance();
void setup() {
Serial.begin(115200);
print_version();
rtc.setClockSource(STM32RTC::LSE_CLOCK);
rtc.begin(); // initialize RTC 24H format
}
* Generic STM32F1 series
** Bluepill F103C6 (32K)
and alternative
** Bluepill F103CB (or C8 with 128k)
STM32duino RTC is Version 1.1.0
HAL-Core V 1.9.0
Is this caused by the cloned MCU's or another problem?
Re: What causes the stm32 RTC to reset?
STM32F1 has no date retention a PR has been submitted for this but I have to find time to review it...
Re: What causes the stm32 RTC to reset?
O.K. Thanks for the quick answer.
I think this will be a hardware problem, because it makes no sense that there is an option to forget the date, when the time is rescued.
That's a pity, because a complete timestamp is needed for logs.
I have upgraded to core 2.0.0 and the problem still exists.
Additional i tested with a different third Blue-Pill.
Here i could find a similar post regarding this issue: https://community.st.com/s/question/0D5 ... osing-date
This links to https://community.st.com/s/question/0D5 ... p-register and https://community.st.com/s/feed/0D50X00009XkW1nSAF
Hopefully this helps?
Re: What causes the stm32 RTC to reset?
The described solution to modify stm32f1xx_hal_rtc.c and rtc.c does not work, because the compilation fails in rtc.c.
It's not so easy to understand what is happening in detail there ...
It's not so easy to understand what is happening in detail there ...
Last edited by blue-man on Wed Sep 29, 2021 2:58 pm, edited 1 time in total.
Re: What causes the stm32 RTC to reset?
This is linked to the STM32 feature. The STM32F1 RTC IP does not do date retention. That's all. That's why a software solution is to use the backup register as it was done in the PR opened.blue-man wrote: ↑Wed Sep 29, 2021 2:21 pm
I have upgraded to core 2.0.0 and the problem still exists.
Additional i tested with a different third Blue-Pill.
Here i could find a similar post regarding this issue: https://community.st.com/s/question/0D5 ... osing-date
This links to https://community.st.com/s/question/0D5 ... p-register and https://community.st.com/s/feed/0D50X00009XkW1nSAF
Hopefully this helps?
Re: What causes the stm32 RTC to reset?
O.K. This is clear now.
Then i will create an workaround.
The last date must be extracted from the logs.