AnsweredAssumed Answered

stop mode  in stm32l0?

Question asked by vitthal muddapur on Feb 18, 2018
Latest reply on Feb 18, 2018 by Clive One

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?

Outcomes