2013-10-25 06:00 AM
Hi everyone
I'm trying to put my STM32L1 into sleepmode and wake it up again with an uart interrupt. So I send it to sleep using:PWR_EnterSleepMode(PWR_Regulator_ON,TRUE)which works, but now it does not wake up when I send data through the uart. Does anyone know why? Is there some flag I need to set to allow the uart isr to wake my stm up?Thanks! #stm32-uart #stm32 #interrupts2013-10-31 02:54 AM
Hi Stephen,
The second parameter for ''PWR_EnterSleepMode'' should be the instruction used to enter sleep mode (PWR_SLEEPEntry_WFI or PWR_SLEEPEntry_WFE). Check this first. -Mayla-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.
2013-11-17 06:58 AM
Hi Mayla
Thanks for your reply! I've tried what you suggested. But the STM32 still won't wakeup. Here's my code: RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); /* Select the Voltage Range 2 */ PWR_VoltageScalingConfig(PWR_VoltageScaling_Range2); PWR_EnterSleepMode(PWR_Regulator_ON,PWR_SLEEPEntry_WFI);And this is how I configure the Uart interrupt: GPIO_InitTypeDef GPIO_InitStructure; EXTI_InitTypeDef EXTI_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); /* Configure USART1 pins: Rx ----------------------------*/ GPIO_InitStructure.GPIO_Pin = USARTx_RX_PIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStructure); /* Connect Button EXTI Line to uart rx line */ SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB,EXTI_PinSource7); /* Configure User Button and IDD_WakeUP EXTI line */ EXTI_InitStructure.EXTI_Line = EXTI_Line7 ; // PB7 for uart rx pin EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); /* Enable and set uart RX EXTI Interrupt to the lowest priority */ NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn ; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); Strange is that it does wakeup when I put it into Stop mode... Any ideas?2014-03-25 11:37 PM
Hello Stephen
Any progress on this issue ?? I want to do the same thing best regard Håkan2016-05-06 01:26 PM