I want to use internal RTC Calendar with internal Clock(LSI).
I think that's why it doesn't work. According to the AN4759 Using hardware real-time clock (RTC) in low-power modes with STM32 microcontrollers, page 36/51 we can read the following statement :
Using the right power reduction mode
Depending on the application constraints, such as the maximum or average current consumption, the frequency of wake-ups, or alternatively the maximum wake-up time, several low-power modes can be used.
The RTC peripheral can be active in the following low-power modes:
- Sleep mode
- Low-power Run mode
- Low-power Sleep mode
- Stop mode if the RTC clock is provided by LSE or LSI(a)
- Standby mode if the RTC clock is provided by LSE or LSI
- Shutdown mode if the RTC clock is provided by LSE(b)
Since you are using the LSI, the lowest power mode achievable for your RTC peripheral is the Standby mode. The shutdown mode is reached when you power off your system (even if you have VBAT connected), which is your case.
The fact that VBAT is connected allows you to keep the RTC value before shutting down the main power supply but here, the fact that you are using the LSI power off the RTC peripheral, that's why its value doesn't change.
If you want to achieve what you want (having the RTC working even when the main power supply is off BUT with VBAT connected), you have to use the LSE.