Note that the wakeup pin is actually NOT edge triggered on the STM32 - it's level triggered. If you attempt to sleep with the pin high, the device will wake immediately. Switching to a hall sensor will generally make the signal cleaner, but still won't let you sleep when in a triggered state.
Two ways around this:
- in software, wait for PA0 to go low before you enter sleep (works for short, deterministic wake signals)
- Use an XOR gate with an RC to generate a positive pulse on PA0 only when the input changes
An XOR gate outputs a high level when the inputs are different - so you connect the signal direct to the A pin, and the signal delayed by an RC to the B pin. Note that if you are using a reed switch and a pull-up then you'll need to buffer the signal before feeding it to the circuit.
Note that you'll generally also want to connect the actual input to the MCU, so when you wake you can read the input's absolute level. Make sure the XOR has schmitt trigger inputs.