I'm working on a project where I need to shut down my device, when it finished it's task. I use an STM32L443 microcontroller to control the device. The circuit was designed, that if happens a falling edge on the wake up pin 5 the device have to wake up from shut down mode. The wake up pin 5 is externally pulled up to 3.3V with a resistor. A card reader SW1 pin also connect to the wake up pin (SW2 to Ground). When I put the card to the reader, the reader pull down the wake up pin to ground. This event have to wake up the device.
The problem is that, if I leave the card in the reader, when the device finished it's task goes shut down, but wakes up immediatelly, because the wake up pin senses the low level. So the controller doesn't wake up on the falling edge instead of low level. In the controller manuals, was written that it wakes up on the edge what was set up in the appropriate register.
The example code's read me texts say same, but when I tested this codes on the appropriate board they woke up also the low level din't on the falling edge.
Please help me how to solve this problem?
The code part after the controller finished it's task show below:
/* Disable all used wakeup sources: WKUP pin */
/* Clear wake up Flag */
/* Enable wakeup pin WKUP5 */
/* Enter shutdown mode */