2022-05-13 04:59 AM
Code of main cycle:
// Some "works"...
ipf("Works 5 sec\n\r");
HAL_Delay(5000);
// Prepare...
ipf("Power save STOP mode 5 sec\n\r");
double CounterVal = 5000 * 2.3125;
if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, (uint32_t)CounterVal, RTC_WAKEUPCLOCK_RTCCLK_DIV16) != HAL_OK)
{
Error_Handler();
}
HAL_SuspendTick();
// Enter STOP
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
// Exit, reconfig clocks & resume tick timer
SystemClock_Config();
HAL_ResumeTick();
LSI used by 37.0 KHz.
1. After HAL_PWR_EnterSTOPMode CPU goes to STOP, but POWER consumption ~960uA, why??
2. Why MCU not wakeup from RTC WKUP? Interrupt does not works...
2022-05-13 05:24 AM
If you have debugger connected, the processor core continues to run, consuming power, see DBGMCU_CR.
For wakeup, make sure you follow all these steps:
i.e. read out and check all relevant RTC and EXTI registers content.
JW
2022-05-13 05:35 AM
If debugger connected power 960uA, after disconnect debugger - 810uA, bot not 2..10uA
RTC wake-up EXTI line 20 is Enabled.
RTC CR->WUTIE setted
RTC CR->WUTE setted
But not works...
And RTC Wake-up configured time to to wake-up by HAL_RTCEx_SetWakeUpTimer_IT
2022-05-13 05:42 AM
Do you have peripherals still active?
Are you sure that's all coming from the STM32 chip?
What else is on your board?
2022-05-13 06:02 AM
SPI Flash Winbond W25Q127 onboard, and its all..
2022-05-13 06:22 AM
so what current is that drawing?
2022-05-13 06:25 AM
Unsolder Winbond, and 4-8uA, supply Flash separately and 956uA...
2022-05-13 06:31 AM
> If debugger connected power 960uA, after disconnect debugger - 810uA, bot not 2..10uA
Did you power-reset after disconnecting debugger?
> And RTC Wake-up configured time to to wake-up by HAL_RTCEx_SetWakeUpTimer_IT
It's irrelevant that you've used some "library" function - since you've used it, it's part of your code thus your responsibility. Cube/HAL is open source so you can look at it, and you can check the registers content it changes.
Does the wakeup interrupt work without going to sleep?
JW
2022-05-13 06:39 AM
I now check this...
Interesting, I set, for example 5 sec for WKUP, 5 sec power consumption is 4.5uA, after 5 sec some thing happens and current up to 145uA, but MCU not wake-up. If set 10 sec, then 10 sec 4.5uA and after 145uA, but, MCU not wake up...
2022-05-13 06:49 AM
Without STOP WKAP still not works. REGs cheked all OK :(, ideas?