stm32duino / STM32LowPower

Arduino Low Power library for STM32
183 stars 52 forks source link

attachInterruptWakeup firstly fires instanly, then goes normal #75

Closed pushkin42 closed 2 years ago

pushkin42 commented 2 years ago

Have a next situation:

 LowPower.begin();
 LowPower.attachInterruptWakeup(BI, _INT0, FALLING, SHUTDOWN_MODE);
 LowPower.shutdown(0);

_INT0 is a function that simply sets flag.

My device goes shutdown and instantly reboots (power up again) after first shutdown. If I left power connected, two and over "shutdown" are normal - wakeup on PA0 as intended. If I remove power, wait for a while, connect power - device shutdowns and reboots after timeout instantly. Then, shutdown mode works fine (10 seconds after last FALLING edge on PA0).

PA0 connected to buttons that connected to gnd + pullup to VCC with 10kOhm resistors and capacitor 0.1uF

ABOSTM commented 2 years ago

Hi @pushkin42, I reproduce the behavior you described:

But this looks to be the normal behavior for this chip:

I tested to use Pulldown on PA0 and button setting 3V3 when pressed. Its working fine: wakeup occurs only when button is pressed, in any case.