Multiple Pins on GPIOTE Port Event not working NRF Connect 1.7.1

I am looking to handle low priority interrupts on a single GPIOTE Port Event but when attempting to add the second pin with the same handler i get an error and the handler is broken i know this has worked in nrf sdk but it seems broken in nrf connect.  I have interrupts that come from connected devices as well as a button and I am already using a good bit of gpiote with other capture compare so this is necessary to handle all change notifications as I am already using 6 gpiote channels.  From following the code from what i can tell if there is already a handler it does not setup the new pin in addition.  When i comment out the second pin it works.

static void app_ui_InitButtons(void)
{
    ////const struct device *button;
    int ret;
    nrfx_gpiote_pin_t btn = SW0_PIN;

    nrfx_gpiote_in_config_t config = NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    config.pull = NRF_GPIO_PIN_PULLUP;

    ret = nrfx_gpiote_in_init(btn, &config, button_pressed);

    if (ret != NRFX_SUCCESS)
    {
        LOG_ERR("Error %d: failed to configure %s pin %d", NRFX_SUCCESS - ret, SW0_GPIO_LABEL, SW0_GPIO_PIN);
        return;
    }

    LOG_INF("Event %d", nrfx_gpiote_in_event_get(btn));

    btn = MODE_PIN;

    nrfx_gpiote_in_event_enable(btn,false);

    ret = nrfx_gpiote_in_init(btn, &config, button_pressed);

    if (ret != NRFX_SUCCESS)
    {
        LOG_ERR("Error %d: failed to configure %s pin %d", NRFX_SUCCESS - ret, MODE_GPIO_LABEL, MODE_GPIO_PIN);
        return;
    }

    LOG_INF("Event %d", nrfx_gpiote_in_event_get(btn));

    nrfx_gpiote_in_event_enable(btn,false);

   

}

Parents
  • Ok so looking at this code from my knowledge this is going to assign 2 gpiote channels one for each high accuracy pin.  I am already using 6 high accuracy gpiote pins and want to use the port or low accuracy channel which should be activated with any pin set to sense if i read the data sheet correctly and given that you could assign multiple pins to the sense channel in the past.  The issue i am having is that since i use GPIOTE for timer capture and auto output it is interfering with the code of the zephyr button project.  What i am looking to do is create a change notification architecture would allow me to add pins to the gpiote interrupt and allow other code to subscribe to those events using work handlers.

Reply
  • Ok so looking at this code from my knowledge this is going to assign 2 gpiote channels one for each high accuracy pin.  I am already using 6 high accuracy gpiote pins and want to use the port or low accuracy channel which should be activated with any pin set to sense if i read the data sheet correctly and given that you could assign multiple pins to the sense channel in the past.  The issue i am having is that since i use GPIOTE for timer capture and auto output it is interfering with the code of the zephyr button project.  What i am looking to do is create a change notification architecture would allow me to add pins to the gpiote interrupt and allow other code to subscribe to those events using work handlers.

Children
Related