cancel
Showing results for 
Search instead for 
Did you mean: 

Stop mode with Interrup EXTI

ibrahim
Associate II
Posted on April 28, 2017 at 10:17

Hello family ST,

I would like to use stop mode with an interrupt Pin,

I tried the PWR Stop example in STM32Cube_FW_L0,

When I put the PA12 Pin to Vcc I have ?c wake up after it runs the program and so it resumes stop mode(it's Ok now) but when I remove the PA12 Pin of Vcc it wakes up

Also,

while I activated the mode: GPIO_MODE_IT_RISING.

I use STM32L031K6 Nucelo, my pin interrupt is PA12, in this example.

Thank you.

Have a good day,

#stm32l031k6 #wakeup #standby #irq #sleep-mode ##stm32l031k6
2 REPLIES 2
Posted on April 28, 2017 at 15:27

when I remove the PA12 Pin of Vcc

If you do it by mechanically disconnecting a wire, or by a switch, it probably bounces, thus generates both rising and falling edges (a series of them).

You'd need an electronically generated clean signal source, e.g. output from another mcu, or from a R/S conditioned double-throw switch, or similar.

JW

ibrahim
Associate II
Posted on May 01, 2017 at 16:05

Hello thank you for repley,

I did the manipulation with an R / S conditioned double-throw switch, I've always the same, it is to Vcc it fires and its it is to GND it also fires, how I can remedy this. Thank you very much.

int main(void)

{

GPIO_InitTypeDef GPIO_InitStruct;

/* STM32L0xx HAL library initialization:

- Configure the Flash prefetch, Flash preread and Buffer caches

- Systick timer is configured by default as source of time base, but user

can eventually implement his proper time base source (a general purpose

timer for example or other time source), keeping in mind that Time base

duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and

handled in milliseconds basis.

- Low Level Initialization

*/

HAL_Init();

/* Configure the system clock to 2 MHz */

SystemClock_Config();

while (1)

{

/* Configure LED3 */

BSP_LED_Init(LED3);

/* Turn LED3 on */

BSP_LED_On(LED3);

/* Insert 5 second delay */

HAL_Delay(5000);

/* Turn LED3 OFF */

BSP_LED_Off(LED3);

/* Configure the system Power */

SystemPower_Config();

/* Configure PA.12 (Arduino D2) as input with External interrupt */

GPIO_InitStruct.Pin = GPIO_PIN_12;

GPIO_InitStruct.Pull = GPIO_PULLDOWN;

GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;

/* Enable GPIOA clock */

__HAL_RCC_GPIOA_CLK_ENABLE();

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/* Enable and set PA.12 (Arduino D2) EXTI Interrupt to the lowest priority */

NVIC_SetPriority((IRQn_Type)(EXTI4_15_IRQn), 0x03);

HAL_NVIC_EnableIRQ((IRQn_Type)(EXTI4_15_IRQn));

/* Enable Power Control clock */

__HAL_RCC_PWR_CLK_ENABLE();

/* Enter Stop Mode */

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

/* Configures system clock after wake-up from STOP */

SystemClock_Config();

}

}