cancel
Showing results for 
Search instead for 
Did you mean: 

stop mode in stm32l0?

vitthal muddapur
Associate II
Posted on February 18, 2018 at 12:17

hi,

i am new in stm32l0 i have configure ADC, RTC,LPTIMER and UART 

count the external pulses in stop mode after 1 min wakeup from stop mode using ALARM send the data using uart to PC but i need help to enter the stop mode.

entering stop mode i have set

void EnterStopMode(void)

{

GPIO_InitTypeDef GPIO_InitStruct;

__HAL_RCC_GPIOA_CLK_ENABLE();

__HAL_RCC_GPIOB_CLK_ENABLE();

__HAL_RCC_GPIOC_CLK_ENABLE();

GPIO_InitStruct.Pin = GPIO_PIN_All;

GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;

GPIO_InitStruct.Pull = GPIO_NOPULL;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

__HAL_RCC_GPIOA_CLK_DISABLE();

__HAL_RCC_GPIOB_CLK_DISABLE();

__HAL_RCC_GPIOC_CLK_DISABLE();

PWR->CR |= PWR_CR_CWUF; // clear the WUF flag after 2 clock cycles

PWR->CR &= ~( PWR_CR_PDDS ); // Enter stop mode when the CPU enters deepsleep

RCC->CFGR |= RCC_CFGR_STOPWUCK; // HSI16 oscillator is wake-up from stop clock

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // low-power mode = stop mode

__WFI(); // enter low-power mode

SystemClock_Config();

HAL_Delay(500);

MX_GPIO_Init();

MX_ADC_Init();

LPUART_INIT();

LPTIM_INIT();

RTC_Init();

}

 this is doesn't work

after wake up lptimer also reinitialized or not?

before  enter stop mode what i will do and after wakeup what will do?

5 REPLIES 5
Posted on February 18, 2018 at 15:53

>>

i am new in stm32

You need to be more specific about which STM32 part in your questions. Currently there are hundreds of parts covering a half-a-dozen different families.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 18, 2018 at 16:19

Review and build examples from the HAL/Cube trees

Repository\STM32Cube_FW_L0_V1.10.0\Projects\STM32L053R8-Nucleo\Examples\PWR\PWR_STOP

Repository\STM32Cube_FW_L0_V1.10.0\Projects\STM32L053R8-Nucleo\Examples\PWR\PWR_STOP_RTC

etc

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 18, 2018 at 16:06

hi,

stm32l073

Posted on February 18, 2018 at 18:19

hi,

I have configure port B lptim_in1 

how to work LPTIMER in stop mode i have disable all GPIO_CLKS before enter stop mode

Posted on February 18, 2018 at 18:54

This might be a better starting point

Repository\STM32Cube_FW_L0_V1.10.0\Projects\STM32L073RZ-Nucleo\Examples\LPTIM\LPTIM_Timeout\Src\main.c

I think this enters/exits STOP mode to service the interrupt.

Disabling all the pins might not be the ideal way to debug/diagnose what is happening here.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..