cancel
Showing results for 
Search instead for 
Did you mean: 

Wake up from interrupt when use a keypad in polling mode

bfran.1
Associate II

In my design i have 5 gpio that connecting my keypad , i have 3 row (gpio output ) an 2 col how input , one button keypad is ON/OFF.

For me the OFF state corrrespond to sleep state .

This is my problem -

Before of while i enter i sleep mode :

void PWR_EnterSleepMode(void)

{

/* Suspend tick increment to prevent wake up by SysTick interrupt. */

HAL_SuspendTick();

/* Enter Sleep mode. */

HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFE);

/* The codes below will be executed only after waked up from the Sleep

* mode. */

/* Resume tick interrupt if disabled prior to sleep mode entry. */

HAL_ResumeTick();

}

Then how wakeup my STM32l1 from sleep if I defined my gpio how input and output gpio .

The Mcu wake up just if hear a interrupt event (is right?)

I don't know.

Yu can help me .

BR.

5 REPLIES 5

Hello

Connecting a keypad like you wrote, implies an allways running scanning code.

An aproach to solve this is to use the col input on/off key's pin with EXTI to produce interrupts both edge.

Just before put mcu to sleep ensure that row output on/off key's pin is not in analog state but other rows are.

After wakeup from sleep, restore the functionality of rows and columns.

bfran.1
Associate II

Thanks

this is my problem

I put power sleep before while loop

When i Press the button the led of callback lighted but then i stopped here with led lighted and I not entry in while loop.

WHY?????

I post my code .

Thank

unfortunately source file is empty

bfran.1
Associate II

SORRY

bfran.1
Associate II

I will also send you the ioc file if there is any wrong sleep setting for the wake up gpio