cancel
Showing results for 
Search instead for 
Did you mean: 

Stop/Sleep mode for Low Layer lib

uveuvenouve
Associate III

i am using STM32C011F6P6 and try to enter stop mode by

LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);

LL_LPM_EnableDeepSleep();

__WFE();

the current is little bit more than not entering the shutdown mode
and the clock is not stopping

is there any thing I should do first?

 

and i want to monitor the adc input for wake from sleep mode 

is that possible?
i search for some example on web, most of them are using __WFI  and use GPIO or TIMER to wake up

i think it maybe possible on __WFE? but i can't find much example on web

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello again @uveuvenouve

To enter shutdown mode, you can follow this sequence 

LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN;
LL_LPM_EnableDeepSleep();
LL_PWR_ClearFlag_WU(); //clear any pending wake-up flags that might inadvertently wake up the MCU immediately after entering shutdown mode
__WFI(); // In shutdown mode, the __WFE(); instruction is typically not used because most peripherals, including the event system, are powered down.

 You can use either the __WFE(); or __WFI(); instruction to enter sleep mode

the note "Unchanged" in Sleep mode means that the peripheral retains its state or configuration and continues to operate as it did before entering Sleep mode so it is possible to use it.

You can find low-layer power examples here: STM32CubeC0/Projects/STM32C0116-DK/Examples_LL/PWR at main · STMicroelectronics/STM32CubeC0 · GitHub

Unfortunately, there is no ready-to-use example using ADC, you'll need to configure it, but you can always ask separate questions while doing it! 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Sarra.S
ST Employee

Hello @uveuvenouve

Waking up from shutdown mode using ADC events is not typically supported because the ADC is already powered down in shutdown mode, Please check this table in RM0490: 

 

SarraS_0-1718696506359.png

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Sarra,

Thanks for your information.

The problem is i cannot enter shutdown mode with that 3 line of code.

I saw some information for shutdown mode and I know the clock will be suspended which mean ADC will not be able to work
So I wonder whether sleep mode can do such a thing

On the table ,it state "U" in sleep mode for ADC, which is unchanged.

The point is i want to deploy a function that adc wake the mcu from sleep mode with low layer lib, but I can't find examples.

1. enter sleep mode and shutdown mode

2. set up WFE/WFI with ADC

Sarra.S
ST Employee

Hello again @uveuvenouve

To enter shutdown mode, you can follow this sequence 

LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN;
LL_LPM_EnableDeepSleep();
LL_PWR_ClearFlag_WU(); //clear any pending wake-up flags that might inadvertently wake up the MCU immediately after entering shutdown mode
__WFI(); // In shutdown mode, the __WFE(); instruction is typically not used because most peripherals, including the event system, are powered down.

 You can use either the __WFE(); or __WFI(); instruction to enter sleep mode

the note "Unchanged" in Sleep mode means that the peripheral retains its state or configuration and continues to operate as it did before entering Sleep mode so it is possible to use it.

You can find low-layer power examples here: STM32CubeC0/Projects/STM32C0116-DK/Examples_LL/PWR at main · STMicroelectronics/STM32CubeC0 · GitHub

Unfortunately, there is no ready-to-use example using ADC, you'll need to configure it, but you can always ask separate questions while doing it! 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.