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

App_GPIOTE not compatible with pull up/down or GPIOTE high accuracy mode

This may be intentional, or an oversight but the

uint32_t app_gpiote_user_register(app_gpiote_user_id_t
* p_user_id, uint32_t const * p_pins_low_to_high_mask, uint32_t const * p_pins_high_to_low_mask, app_gpiote_event_handler_t event_handler)

doesn't take into consideration that user might have wanted a pull-up or pull-down on the GPIO pin, or whether the user wants high accuracy interrupt on this pin: line 162 in components\libraries\gpiote\app_gpiote.c:

const nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);

and the macro GPIOTE_CONFIG_IN_SENSE_TOGGLE is defined as :

#define GPIOTE_CONFIG_IN_SENSE_TOGGLE(hi_accu) \
    {                                            \
        .is_watcher = false,                     \
        .hi_accuracy = hi_accu,                  \
        .pull = NRF_GPIO_PIN_NOPULL,             \
        .sense = NRF_GPIOTE_POLARITY_TOGGLE,     \
    }

This is a bit confusing as for example It took me a while to figure out that the pin I had set up to pull-up in my bsp_init() was pulled up for a while and later on it was left as no pull later on in execution which turned out to be caused by a call to app_gpiote_user_register().

I suggest that the pull and low/high accuracy configuration be added to (passed into) app_gpiote_user_register() interface.

Thanks, Farhang

Related