I want to configure two pins to be able to wake up both from System ON and OFF and know which pin was pressed
is it possible?
I want to configure two pins to be able to wake up both from System ON and OFF and know which pin was pressed
is it possible?
Hi,
It is not possible for SYSTEMOFF, as the wakeup will reset almost all the peripherals including GPIOs so you wont be able to tell which GPIO caused the wakeup.
Only possible reasons that we could know are mentioned in NRF_POWER->RESETREAS register in nrf51 reference manual section 12.3 Table 53.
Bit number 16 will only tell you that the wakeup is from systemoff due to DETECT signal from gpio but it wont tell you which GPIO caused this.
What about checking NRF_GPIO->IN, I red that the GPIO is not reset on wake up from System off. https://devzone.nordicsemi.com/question/69787/cause-of-wake-up/?answer=69842#post-id-69842
Thank You
Oh yes, that should work, hopefully the pin state remains the same during the wakeup process and while reading the pins again.
I've two buttons pins 16 and 17 just after wake up i'll check in GPIO->IN which one of them has the value 1 to know wich one was pressed. is it wrong?
Thank you very much for your help
It is right, but then we hope that when we press the button that woke the system, it is still pressed while we read the GPIO status. Normally it will take around 800us for the clocks to stabilize. So if you press longer and if you read the pin status fast after the boot then it is reasonable to think that this way will work.