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

sd_app_evt_wait() and hardware interrupts

Hello,

I'm developing on a nrf51822 with the S110 softdevice. To save power, I use the sd_app_evt_wait() function to go into sleep mode. To wake up, i want to use an gpiote interrupt, from an external accelerometer. But it seems, that the chip doesn't continue execution from gpiote interrupts. The button example uses a timer, to get a software interrupt, but I hope there is a more elegant way of doing it, than creating an ultra short timer.

Best regards

Jonathan

Parents
  • No it doesn't use a timer - not the one I'm looking at. As long as you enable the GPIO to 'sense' they will wake up the chip. That works just as well from an external source, as long as it toggles the value on a pin set to sense, the chip will wake.

    Added in the code from bsp.c which sets the buttons up for sensing for wake

    uint32_t bsp_wakeup_buttons_set(uint32_t wakeup_buttons)
    {
    #if (BUTTONS_NUMBER > 0) && !defined(BSP_SIMPLE)
        for (uint32_t i = 0; i < BUTTONS_NUMBER; i++)
        {
            uint32_t new_cnf = NRF_GPIO->PIN_CNF[m_buttons_list[i]];
            uint32_t new_sense = ((1 << i) & wakeup_buttons) ? GPIO_PIN_CNF_SENSE_Low : GPIO_PIN_CNF_SENSE_Disabled;
            new_cnf &= ~GPIO_PIN_CNF_SENSE_Msk;
            new_cnf |= (new_sense << GPIO_PIN_CNF_SENSE_Pos);
            NRF_GPIO->PIN_CNF[m_buttons_list[i]] = new_cnf;
        }
        return NRF_SUCCESS;
    #else
        return NRF_ERROR_NOT_SUPPORTED;  
    #endif
    }
    
  • Great advise. Could you explain in short what "sense" does mean. I knew that you could configure the inputs with sense, but couldn't find out what the difference is to no sense.

Reply Children
No Data
Related