I'm experimenting with standby mode on STM32F407VGT6. I know how to put MCU into standby mode(or I think to know that). I'm doing that with this init function:
void MX_RTC_Init(void) {
RTC_TimeTypeDef sTime = {0};
RTC_DateTypeDef sDate = {0};
/** Initialize RTC Only */ hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv =127;
hrtc.Init.SynchPrediv = 255;
hrtc.Init.OutPut = RTC_OUTPUT_WAKEUP;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&hrtc) != HAL_OK) {
Error_Handler();
}
/** Initialize RTC and set the Time and Date */
sTime.Hours = 0x13;
sTime.Minutes = 0x20;
sTime.Seconds = 0x0;
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
sDate.WeekDay = RTC_WEEKDAY_THURSDAY;
sDate.Month = RTC_MONTH_JANUARY;
sDate.Date = 0x30;
sDate.Year = 0x20;
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
}
This init function allows to wake up MCU from standby mode with wakeup pin(PA0) and with timer(currently period is ~20sec). Next function is called when I want to put MCU into standby mode:
void Enter_StandbyMode(void)
{
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 40960,RTC_WAKEUPCLOCK_RTCCLK_DIV16);
HAL_PWR_EnterSTANDBYMode();
}
Again this works as I expect(I used diode to indicate when MCU wake-up from standby) but my question is next one:
Why I still have voltage on pins when MCU is in standby mode? And when I use multimeter to measure current I got ~30mA power consumption in normal mode(when MCU isn't in standby mode) and ~0.58mA(which is ~580uA) when MCU is in standby mode. I read in datasheet that MCU in standby mode can have power consumption less then 5uA. Every hint and idea are welcome