2024-07-15 04:46 PM
Hello,
I've successfully used the code below to enter shutdown on a U585CIUx. It wakes up on button press and I can tell it is coming up from reset because of timestamps (based on time since startup) and terminal output that only happens during startup.
Using this same code on a U585QIIx, it seems to behave as if it has entered a low power mode, just not one as low power as shutdown. When it wakes up it picks up where it left off in terms of timestamps and it does not run through startup code as expected. I'm also measuring current draw during the so-called "shutdown" - it only goes 10mA lower, but there may be some interplay with battery backups that muddies up the reading.
While I don't normally test this kind of thing with the debugger, since it affects power, I did make sure that it's reaching the call to LL_PWR_SetPowerMode(LL_PWR_SHUTDOWN_MODE) and not going into some other mode.
Is there something I'm missing here? It only starts drawing 10mA more current (back where it started) when the button is pressed so it doesn't seem to act like it came right out of shutdown because of some interrupt.
Thanks
-------------------------------------------------
void goto_shutdown(void) {
HAL_SuspendTick();
LL_PWR_DisableWakeUpPin(DEEP_SLEEP_WAKEUP_PIN);
LL_PWR_ClearFlag_WU();
LL_PWR_SetWakeUpPinSignal1Selection(DEEP_SLEEP_WAKEUP_PIN);
LL_PWR_SetWakeUpPinPolarityLow(DEEP_SLEEP_WAKEUP_PIN);
while (!LL_PWR_GetWakeUpPinPolarity(DEEP_SLEEP_WAKEUP_PIN)) {}
LL_PWR_EnableWakeUpPin(DEEP_SLEEP_WAKEUP_PIN);
LL_PWR_ClearFlag_WU();
LL_PWR_SetPowerMode(LL_PWR_SHUTDOWN_MODE);
LL_LPM_EnableDeepSleep();
__WFI();
}
Solved! Go to Solution.
2024-07-16 08:41 AM
I had continuous DMA running for ADC so once I stopped that, the shutdown behavior started working as expected.
2024-07-15 07:03 PM
There is no difference in shutdown behavior, or low power mode behavior. They're the same chip in a different package. The difference must be due to other code or other hardware differences. Are you meeting all of the other requirements to enter this mode per the reference manual?
Put a while (1); loop right after the WFI to make sure chip is going into shutdown and is restarting after waking up.
2024-07-16 08:41 AM
I had continuous DMA running for ADC so once I stopped that, the shutdown behavior started working as expected.
2024-07-31 11:43 AM
I'm unsure about my last observation, when I temporarily commented out calling HAL_ADC_Start_DMA(). At the time, that seemed to directly correlate to whether shutdown was entered/exited as expected. I don't have either the ADC4 global interrupt or the associated GPDMA1 Channel 0 global interrupt enabled. Do the DMA conversions count as "events" then? Although I'm using WFI not WFE.
Is it really the case that having these conversions active can interfere with entering and remaining in low power modes?
2024-07-31 12:17 PM
Most chips have ADC and DMA capabilities in some low power mode. But if you have interrupt enabled, it will wake up when those are triggered. Probably this is what was occurring in your original post.
Low power modes are incredibly flexible, but they are also incredibly varied. You will need to determine the behavior you want and then choose a suitable low power mode for that. The reference manual goes into great detail here.