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

GPIOTE interrupt not working with softdevice s130

I am using the template example for S130(works fine). I tried adding a simple Pin interrupt on the code but it didn't call the pin interrupt handler everytime I press the button. I believe I'm using some part of the peripherals that are restricted in S130. Below is my code, I put it before all the BLE initialization.


err_code = nrf_drv_gpiote_init();

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);

in_config.pull = NRF_GPIO_PIN_PULLDOWN;

err_code = nrf_drv_gpiote_in_init(BUTTON_1, &in_config, in_pin_handler);

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(BUTTON_1, true);

Am I missing something? or Is this implementation not applicable with Softdevices. BTW the code for interrupt works if no support of BLE is added.

Parents
  • So I manage to solve my problem but using a different routine. Still please help me to understand further why the above code is not working. Anyway, below code is what I used to work with Pin Interrupt together with Softdevices.

    Update: Now, bot codes are working just by changing PULLDOWN to PULLUP.

    //Initialization uint32_t err_code;

    APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS); // APP_GPIOTE_MAX_USERS = 1 static app_button_cfg_t p_button[] = {{BUTTON_1, APP_BUTTON_ACTIVE_LOW, NRF_GPIO_PIN_PULLUP, in_pin_handler}};

    // Initializing the buttons. err_code = app_button_init (p_button, sizeof(p_button) / sizeof(p_button[0]), 10); APP_ERROR_CHECK(err_code);

    // Enabling the buttons. err_code = app_button_enable(); APP_ERROR_CHECK(err_code);

Reply
  • So I manage to solve my problem but using a different routine. Still please help me to understand further why the above code is not working. Anyway, below code is what I used to work with Pin Interrupt together with Softdevices.

    Update: Now, bot codes are working just by changing PULLDOWN to PULLUP.

    //Initialization uint32_t err_code;

    APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS); // APP_GPIOTE_MAX_USERS = 1 static app_button_cfg_t p_button[] = {{BUTTON_1, APP_BUTTON_ACTIVE_LOW, NRF_GPIO_PIN_PULLUP, in_pin_handler}};

    // Initializing the buttons. err_code = app_button_init (p_button, sizeof(p_button) / sizeof(p_button[0]), 10); APP_ERROR_CHECK(err_code);

    // Enabling the buttons. err_code = app_button_enable(); APP_ERROR_CHECK(err_code);

Children
Related