2014-04-09 02:33 AM
Hello All,
I have read from STM324xx data sheet that the RTC is registers are still valid and running when Vdd is off and Vbat is present. I am not sure how the microcontroller manges normal running mode and standby mode (Vdd is off and Vbat is present). I have two questions1. Is it responsibility of FW to manage the switch or is is managed by the MCU hardware.? When Vdd is off and Vbat is present does the microcontroller automatically goes to standby mode..? Do we need any kind of configuration for this...?2. How to know after power start whether the product up from a stand by mode or a power down reset. Thnaks for any kind of suggestion.BR,Rohit #rtc #rtc #rtc #stm32 #stm322014-04-09 03:05 AM
Hi
''1. Is it responsibility of FW to manage the switch or is is managed by the MCU hardware.? When Vdd is off and Vbat is present does the microcontroller automatically goes to standby mode..? Do we need any kind of configuration for this...?'' It is the HW that manages the switch from RTC/SRAM powered to not powered. It is the firmwares responsibility to make sure the RTC is setup/configured correctly. No, when Vdd is not present - the processor is OFF ''2. How to know after power start whether the product up from a stand by mode or a power down reset. '' uint32_t lastRstState = RCC->CSR; // code to detect a warm reboot if ( RCC_CSR_SFTRSTF & lastRstState ) { uartPrintf(''\n\r Warm boot (reset caused by software)'' ); } else { uartPrintf(''\n\r Cold boot (Powered from Off)'' ); }2014-04-14 08:20 AM
Thanks Sung.Chen_chung for the reply.
From: sung.chen_chungPosted: Wednesday, April 09, 2014 12:05 PMSubject: Use of RTC in back up domainHi
''1. Is it responsibility of FW to manage the switch or is is managed bythe MCU hardware.? When Vdd is off and Vbat is present does themicrocontroller automatically goes to standby mode..? Do we need anykind of configuration for this...?''It is the HW that manages the switch from RTC/SRAM powered to not powered.It is the firmwares responsibility to make sure the RTC is setup/configured correctly.No, when Vdd is not present - the processor is OFF''2. How to know after power start whether the product up from a stand by mode or a power down reset. '' uint32_t lastRstState = RCC->CSR; // code to detect a warm reboot if ( RCC_CSR_SFTRSTF & lastRstState ) { uartPrintf(''\n\r Warm boot (reset caused by software)'' ); } else { uartPrintf(''\n\r Cold boot (Powered from Off)'' ); }2014-04-23 12:51 AM
Hello,
I have configured RTCEN bit in RCC_BDCR register. I am using LSI clock for RTC.Kindly let me know whether I have to some additional configuration on RTC side. My undestand is when VBAT is present and VDD is off the RTC will still tick and be running the switch is managed by the Hardware. I am using RTC back-up register validity to know whether I need to reconfigure RTC or not. I initialize RTC only when there is a cold start OR when there is invalid back-up register.When there is a soft-reset my observation is that the back up register are valid but the RTC will not be enabled. I expect RTC to be enabled and running when there is a soft-reset...?I need to reconfigure RTC when there is restart and before restart VBAT was absent. Thanks in Advance.BR,Rohit2014-04-23 01:33 AM
Hi
''Kindly let me know whether I have to some additional configuration on RTC side. '' Yes, the RTC itself needs to be set up/configured, the prescalar, clock select etc Please refer to the reference manual for your device. ''I am using RTC back-up register validity to know whether I need to reconfigure RTC or not. I initialize RTC only when there is a cold start OR when there is invalid back-up register.'' Yes, knowing if the RTC has been set up for the first time is a tricky one. I was hoping the RTC year would be full 4 digit but unfortunately it is only 2 digit. so 00 will probably translate to year 2000. (I have previously used schemes where year 0000 is invalid therefore the RTC has not been set up or had the date/time set). The backup domain contains a small amount of battery back RAM. Use this to determine if the RTC has been set up before, ie have a statically allocated flag which is set to a known value when the RTC is configured where the value is not the default ie not 0x00 or 0xFF the more bytes in the flag the more secure. ''When there is a soft-reset my observation is that the back up register are valid but the RTC will not be enabled. I expect RTC to be enabled and running when there is a soft-reset...?'' Once the RTC is powered by a battery and it has been configured - it should stay running. I have not tried it myself with this processor - so you will have to experiment, refer to the documentation and over come any issues.2014-04-23 03:36 AM
2014-04-23 04:30 AM
> I was hoping the RTC year would be full 4 digit but unfortunately it is only 2 digit.
> so 00 will probably translate to year 2000.That would see little use these days... ;)
This is in RM0090 (and probably the other RMs too): ''After a system reset, the application can read the INITS flag in the RTC_ISR register to check if the calendar has been initialized or not. If this flag equals 0, the calendar has not been initialized since the year field is set at its backup domain reset default value (0x00).'' JW2014-04-23 04:51 AM
''it is only 2 digit.
> so 00 will probably translate to year 2000. That would see little use these days... ;-)'' Showing my age ;) Thanks for the additional info Jan2014-06-05 10:57 PM
2014-06-06 01:22 AM
Hi
A brief look through your code - looks like you are using the internal low speed oscillator. Is that right? I have not used the RTC myself, so I do not know for sure but one of the other experienced responders says that the LSI does not work running off the battery. You must use the LSE and have an external crystal (32.768Khz)