I have programmed the system_off with 2 causes of wake-up on 2 different pins.
When the device is woken up, how can I check which pin is the wake cause ?
Thanks for your help !
I have programmed the system_off with 2 causes of wake-up on 2 different pins.
When the device is woken up, how can I check which pin is the wake cause ?
Thanks for your help !
If you see the Reset behavior chapter, you will see that the GPIO is not reset on wake up from System off. So the below solution should work.
read and store(persistently or in GPREGRET register) the GPIO pin status before going to system off and then read again after waking from system off and compare them.
If you see the Reset behavior chapter, you will see that the GPIO is not reset on wake up from System off. So the below solution should work.
read and store(persistently or in GPREGRET register) the GPIO pin status before going to system off and then read again after waking from system off and compare them.
What do you call the GPIO pin status ? Is it IN ?
pin_status1 = (NRF_GPIO->IN & (1 << pin1_no) & (1 << pin2_no));
The only issue here is that the NRF_GPIO->IN register is 32 bits and POWER->GPREGRET is 8 bits according to the reference manual I am looking at. You may need to come up with a way to translate the GPREGRET contents to pin numbers and vice versa.
True, does not look very optimum because after the wakeup and before you read the pins, their status might have changed. For example if the wakeup is caused by a button connected to a gpio, then we hope that the button is still pressed after the wakeup till we read the button status.
similar discussion here