Skip to main content
Damiano Balzani
Associate II
March 20, 2018
Solved

wake up from stop mode using GPIO

  • March 20, 2018
  • 1 reply
  • 893 views
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
This topic has been closed for replies.
Best answer by Damiano Balzani
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

1 reply

Damiano Balzani
Damiano BalzaniAuthorBest answer
Associate II
March 20, 2018
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