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

Interrupts on SoftDevice functioning

Hello all,

I am developing an application from the ble_cgms example on the nrf5_sdk 17  using the Softdevice S132.

I have implemented a gpiote interrupt whenever the state of the input goes low it generates a event, the state of the pin is controlled by a external chip. I initialized and started the interrupt in the main and could see it on the debugger.

When I connect the BLE the interrupt stops working until I enable a specific service via the BLE. I can see that before the service enables, the interrupt never fires because I placed a counter in the event handler.

I am trying to understand what is happening, in the Softdevices specification says that all interrupts are directed to the softdevices, but how? Does the softdevices block or disable the interrupts? If so when it enables it again?

Event handler and initialization:

static void int0_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    ucInterrupted = 1;
    InterruptCount++;
    NRF_LOG_DEBUG("Interrupt count =%d", InterruptCount);
    printf("\nInterrupt count =%d", InterruptCount);

}

    err_code = nrf_drv_gpiote_in_init(INT0_PIN, &in_config, int0_event_handler);
    VERIFY_SUCCESS(err_code);
    nrf_drv_gpiote_in_event_enable(INT0_PIN, true);

Debugger before the connection, interrupt firing normally

Debugger after the connection, the interrupt never fires in this situation:

Debugger after the service enable, the interrupt fires again:

Parents
  • Hi,

    This should work even if you connect to a BLE device.

    1)

    What pin number is INT0_PIN? Is this pin maybe used somewhere else in your code? (e.g. by bsp / app_button lib or similar)

    2)

    How do you define in_config? something like this ?

    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
    in_config.pull = NRF_GPIO_PIN_PULLUP;

    or maybe GPIOTE_CONFIG_IN_SENSE_HITOLO() ?

    3)

    When I connect the BLE the interrupt stops working until I enable a specific service via the BLE. I

    What service is this? 

    4)

    Do you call app_button_disable() or nrf_drv_gpiote_in_event_disable() somewhere in your code ?

    5)

    I can see that before the service enables, the interrupt never fires because I placed a counter in the event handler.

    Are you sure that the pin is actually toggling or goes from high to low? Have you scooped the pin?

  • Hi,

    Great questions, trying to answer those I found that another output pin controlling the reset of the external chip was toggling with the bsp module (I couldn't find exactly how, but the influence is there). So changing this pin solve my problem.Thanks!

Reply Children
No Data
Related