2023-02-20 03:55 AM
I thought of using an STM32 to build a device which responds to infrequent pushbutton presses, but should also conserve battery. My initial instinct was to use an STM32L4 in Standby or Shutdown mode, setting the GPIO as external interrupts which would wake up the MCU.
This seems to only be possible with up to 5 pins according to the documentation, but what if I need more than five separate pushbuttons? Is something like wiring the buttons to both their separate GPIO pins and a common wakeup pin feasible? Maybe using a cap on the separate GPIO to allow the button press to be captured after the MCU wakes up?
I'd also love to use timers instead of EXTI for this, as there are 12 separate buttons, but don't really see how that would be possible.
2023-02-20 05:18 AM
Depending on the exact derivative and the respective package, a few wake-up pins are available that can wake up the STM32 via a respective selectable edge.
For example, if you want to work on all buttons with a falling edge, you could work with negative wired-or by connecting the buttons to the cathodes of a diode matrix whose common anode is connected to the System Wake-Up x, while the 2nd pin of the buttons is connected to GND. A pull-up is also necessary at this System Wake-Up x pin (either internal or external). If these buttons are also to be checked independently, you would have to connect each button via an additional diode to the GPIOs plus pull-up for each button.
Actually, a drawing would be easier to understand, but I hope I have made it halfway comprehensible?
Does it answer your question?
Regards
/Peter
2023-02-20 05:49 AM
Try use STOP mode , is too ok around 2uA with all 16 EXTI can wake, plus you can arange buttons as matrix ... diodes ...