2015-12-31 12:00 AM
STM32 RTC clock stops at poweroff?
2015-12-31 12:38 AM
Something went wrong with the original post so here it is again.
I have a custom board with a STM32F407ZGT6J and I have trouble with the RTC which seems to stop/stall when the board is powered off.The board is configured with CubeMX and uses the HAL libraries.The RTC is configured to use the LSE which is an ABRACON ABS25-32.768KHZ-6-1-T and uses 6pF capacitors.When the board is powered, the RTC operates fine and maintains time and date.I can trace it through the initialisation of the board and it all appears to be configured for LSE and the LSE ready bit is active.The board has a cell battery connected to VBAT.The board is normally powered off through switching off the GPIO that enables the main regulator and then going into a STOP state waiting for power to disappear.With the power off, I can see the LSE oscillating with pretty much the same sort of swing (approx 300mV) as when it is powered.However, when the board re powers, the clock is at the time that it powered off and has not advanced. The clock has not reset and variables I keep in the backup registers are maintained so back power is working.Why does the RTC not advance while in VBAT mode? Is there anything else that I need to set/enable?I am at a loss and any advise would be much appropriated as this is now pretty much a show stopper. Being able to power off and then power back on at a scheduled time is kind of a critical function for me. With the RTC not ticking, it would never power up again :(Regards,Marco2015-12-31 03:14 AM
Hi Marco H.,
I recommend you to test the example that you may find under STM32Cube_FW_F4_V1.10.0\Projects\STM324xG_EVAL\Examples\RTC\RTC_Calendar.Using this example, if a battery is connected to the VBAT pin: the BKP domain is not reset and the RTC configuration is not lost.It is tested with STM324xG_EVAL board, but you should be able to port it to your own board.You can compare the code in this project with the one you generated with CubeMX and updated by your self in order to know what is going wrong.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.