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

APP_BUTTON_INIT and PAN #39 Issue

Hi,

I am starting development on my project using the ble_app_hrs as a template. This project already has the buttons setup for interrupts using the Button Handler library configured using a GPIOTE. However having read Product Anomaly Issue #39 regarding GPIOTE usage, does this realistically rule out coding the button as is done in ble_app_hrs? My product will use a coin cell battery and thus I am trying to minimize current consumption as much as possible. I rewrote the led.c to use app_timers rather than the GPIOTE, however I don't know if the GPIOTE issue still extends to the Button Handler Library? Thanks for the help guys

  • I haven't read PAN39 so don't know what that is about. We had application that uses multiple buttons with ble. GPIOTE latency was to much. It didn't work. instead we use pin change interrupt with app_timer. Everything work great. Since then, we never use GPIOTE again.

  • Response from Nordic. Thanks Guys

    "The app_button module uses the GPIOTE Port event, which is a combinatory hardware block that triggers on levels. The specified GPIOTE IN current is a different module inside the GPIOTE peripheral.

    The GPIOTE PORT (which is a "wake-up on pin change" function, which you can set in the GPIO register PIN_CNF[n]) has very low added current consumption, specified to 0.1 uA."

  • Thank you for answering your own question.

  • hi Nguyen, could you elaborate on that a little? maybe some piece of example code of how to configure such an interrupt and how to write the interrupt handler? I would like to get rid of the gpiote as well

  • The initialization

    NVIC_ClearPendingIRQ(GPIOTE_IRQn);
    NVIC_SetPriority(GPIOTE_IRQn, APP_IRQ_PRIORITY_HIGH);
    NVIC_EnableIRQ(GPIOTE_IRQn);
    
    NRF_GPIOTE->EVENTS_PORT = 0;
    
    NRF_GPIOTE->INTENSET  = GPIOTE_INTENSET_PORT_Msk;
    

    The handler

    void GPIOTE_IRQHandler(void)
    {
    	NRF_GPIOTE->EVENTS_PORT = 0;
        .....
    }