cancel
Showing results for 
Search instead for 
Did you mean: 

RTC frozen (M41T93) on my STM32L052

fcartieaux
Associate
Posted on January 13, 2016 at 10:23

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 5s

resetDuHaltBitRTC(); 

wait 4s

clearAllFlagsRTC();

wait 100ms

readTimeRTC();

Is there something I forget ?

I thank you in advance.

Fred

#rtc-m41t93-stm32l
4 REPLIES 4
Posted on January 13, 2016 at 12:56

May be it is an issue with the circuit?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
fcartieaux
Associate
Posted on January 13, 2016 at 13:43

What do you mean by circuit ? I have to change the component ? Or you mean the schematic can be wrong ?

 0690X00000605KKQAY.png

Posted on January 13, 2016 at 14:27

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on January 13, 2016 at 16:00

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&currentviews=63]request.

Take a look to my recommendation there.

-Hannibal-