This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Get of interrupt factor after returning from the SYSTEM OFF

Hi, all.

I have been using the nRF51822 board, I am making a peripheral. The peripheral has been equipped with a sensor to multiple GPIO. (For example, sensor1 to P0.9 , sensor2 to P0.10 )

After the application has waking up the SYSTEM OFF mode, I want to get the PIN number of GPIO that was waking up the SYSTEM OFF mode. (wake-up by P0.9 , wake-up by P0.10) ※ Application has been returned from the SYSTEM OFF mode by the interruption of the GPIO.

How to get of interrupt factor(P0.9 or P0.10) after returning from the SYSTEM OFF mode?

  • Hi

    The only way to detect what pin caused the wakeup from System off mode is to manually read the state of the configured wakeup pins after waking up and starting up the chip. If you however use System On, then it is easier with e.g. app_button library which will generate an event on a button press with the pressed pin id as a parameter value. But of course, System On mode (2.6uA) consumes more current than System Off mode (0.6uA).

    Update 26.1.2015 Similar to how it is done in this example, you can read the state of pins with

    nrf_gpio_pin_read(BUTTON_0) == BTN_PRESSED 
    

    Just check if the state of buttons is equal to the wakeup state that you set with

    nrf_gpio_cfg_sense_input(BUTTON_1, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW)
    
  • The only way to detect what pin caused the wakeup from System off mode is to manually read the state of the configured wakeup pins after waking up and starting up the chip.

    How would parameter said "manually read the state of the configured wakeup pins"?

    Do the current value of the GPIO has shown that HI level or LOW level? (The value that can be obtained in the "NRF_GPIO-> IN") Or Is there a register that it can be seen that GPIO has changed "High to Low" or "Low to High"?

  • I have a question about the contents of the "Update 26.1.2015".

    This detection method of interrupt is not a detection of Edge, but it is detection of the level.

    At the timing of reading the status of PIN, I never fail to get the factors of interrupt?

    Is there a detection method in the Edge?

  • The

    nrf_gpio_cfg_sense_input(BUTTON_1, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW)
    

    in fact wakes up the chip as soon as the signal goes low, so in that sense it detects on edge. There is however no chance of getting an interrupt from the wakeup as all peripherals of the chip are off in System Off mode, only the wakeup mechanism is working. When the chip wakes up from System Off, the chip needs to start up before you are able to read the state of the pin, because waking up from System Off causes a reset.

    If I am not answering your question, could you please clarify your question.

Related