cancel
Showing results for 
Search instead for 
Did you mean: 

wake up from stop mode using GPIO

Damiano Balzani
Associate III
Posted on March 20, 2018 at 14:35

Hi everybody,

i'm tryng to wake up MCU STM32L051T6 from stop mode using a GPIO pin. The pin is PB4 on Rising edge.

This is the code:

void stopMode(void)

{

DBGMCU -> CR |= DBGMCU_CR_DBG_STOP;

RCC -> APB1ENR |= RCC_APB1ENR_PWREN;

RCC -> IOPENR |= RCC_IOPENR_GPIOAEN;

EXTI -> IMR |= EXTI_IMR_IM4;

EXTI -> RTSR |= EXTI_RTSR_TR4;

NVIC_SetPriority(EXTI4_15_IRQn, 0);

NVIC_EnableIRQ(EXTI4_15_IRQn);

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

}

The isr never goes!

Can someboby help me?

Thanks

Damiano

#exit-stop #ll-gpio #exti #wake-up
1 ACCEPTED SOLUTION

Accepted Solutions
Damiano Balzani
Associate III
Posted on March 20, 2018 at 15:14

I resolved!

The problem was that i missed to select the source input for the EXTIx exernal interrupt. i Wrote the SYSCFG_EXTICR1 register with 0x01 and all works correctly

Thanks

View solution in original post

1 REPLY 1
Damiano Balzani
Associate III
Posted on March 20, 2018 at 15:14

I resolved!

The problem was that i missed to select the source input for the EXTIx exernal interrupt. i Wrote the SYSCFG_EXTICR1 register with 0x01 and all works correctly

Thanks