Set 2 pins to wakeup from System ON and OFF, and know which pin was pressed

KnightYusuf gravatar image

asked 2016-11-03 17:49:10 +0100

updated 2016-11-03 17:56:28 +0100

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?

edit retag flag offensive close delete report spam



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.

Aryan ( 2016-11-03 21:30:42 +0100 )editconvert to answer

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

KnightYusuf ( 2016-11-04 09:44:14 +0100 )editconvert to answer

1 answer

Sort by » oldest newest most voted
Aryan gravatar image

answered 2016-11-04 10:20:13 +0100

updated 2016-11-04 10:39:34 +0100

Oh yes, that should work, hopefully the pin state remains the same during the wakeup process and while reading the pins again.

edit flag offensive delete publish link more


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

KnightYusuf ( 2016-11-04 10:29:18 +0100 )editconvert to answer

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.

Aryan ( 2016-11-04 10:38:23 +0100 )editconvert to answer

I see thank you very much

KnightYusuf ( 2016-11-04 10:49:14 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2016-11-03 17:49:10 +0100

Seen: 478 times

Last updated: nov. 04 '16