2016-01-13 01:23 AM
Hello,
I try to use the RTC M41T93 with a microcontroler STM32L052. I use the SPI1 for the communication. It seems to work well as I am able to read the time, to write the time and some registers.The problem is that when the power supply falls, the RTC is supposed to continue running on the battery (CR2032). But when the power comes back and the microcontroler restart, the time is the one when the power supply fell.For exemple : if the power supply falls at 10:13:00, and I wait 5 minutes, when I restart the power supply, the time is still 10:13:00 (and few more secondes), and it continues incrementing then.The starting sequence on the microcontroler is :wait 5sresetDuHaltBitRTC(); wait 4sclearAllFlagsRTC();wait 100msreadTimeRTC();Is there something I forget ?I thank you in advance.Fred #rtc-m41t93-stm32l2016-01-13 03:56 AM
May be it is an issue with the circuit?
2016-01-13 04:43 AM
What do you mean by circuit ? I have to change the component ? Or you mean the schematic can be wrong ?
2016-01-13 05:27 AM
The circuit - the RTC and the components around it, and the conditions during the non-clocking issue.
Just saying you seemed to be focusing on the software side of this, and the pseudo code really isn't that enlightening. This is a forum for the STM32 rather than the RTC.I'd probably look at the battery low, and oscillator fail status, and see if the RTC is flagging some kind of issue.2016-01-13 07:00 AM
Hi Fred,
It seems that your problem is coming from a bad switching between Power-ON and resuming from Standby/RESET states like this [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F437%20exiting%20standby%20incorrectly¤tviews=63]request. Take a look to my recommendation there. -Hannibal-