2018-02-18 03:17 AM
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?
2018-02-18 06:53 AM
>>
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.
2018-02-18 07:19 AM
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
2018-02-18 08:06 AM
hi,
stm32l073
2018-02-18 10:19 AM
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
2018-02-18 10:54 AM
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.