2015-10-01 05:14 AM
I've STM32f417IF. I try to user RTC. All Init code writed by STMCubeMX. Then i set date and time, but after reset RTC time clean again.
RTC have own big capasitor and i just make reset, without poweroff.What is wrong?upd.I'm idiot. Standart Cube's init set zero time. Moderator, pls remove this stupid topic.2015-10-02 12:04 PM
in function void MX_RTC_Init(void)
disable HAL_RTC_SetTime(&hrtc, &sTime, FORMAT_BCD); HAL_RTC_SetDate(&hrtc, &sDate, FORMAT_BCD);2016-04-14 07:23 AM
Hi RiseOfDeath,
I think your issue is coming from the fact that your code is confusing between the power-ON and the resuming from Standby mode.
So, you should proceed like the following:
/* Check and Clear the Wakeup flag if already set*/
if(__HAL_PWR_GET_FLAG(PWR_FLAG_WU) != RESET)
{
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
}
/* Check the status of standby flag SB*/
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) == RESET)
{
/* Power-ON routine */
- Clearing all flag
- RTC configuration
- Entering standby routine
}
else
{
/*Resuming from standby routine */
………..
}
You should also, make attention when you want to debug a low power mode, in this case you need to Enable the debug for that mode :
For standby mode debug:
/* Enable the Debug Module during STANDBY mode */
HAL_EnableDBGStandbyMode();
I recommend that you take a look to the application note AN4538 at this
http://www.st.com/web/en/resource/technical/document/application_note/DM001214pdf
: “Power consumption optimization with STM32F3xx microcontrollers “Yo
u will be inspired from this AN where we have developed a use case similar to your application where all the power modes are used and it containes a (Power-On /standby resume) switching routine. You find the firmware at this
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF257872
.
-Hannibal-