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

2 GPIOTE Interrupts, Only one of the handler functions being hit

Hello:

I dont seem to understand what the problem is. I have 2 external ICs, one is an IMU and the other is a CDC. Both have interrupt pins connected to the nordic nRF52832 pins 12 and 26. I configure the pins as shown bellow.

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);

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

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config2 = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);

in_config2.pull = NRF_GPIO_PIN_PULLDOWN;

err_code = nrf_drv_gpiote_in_init(IMU_INT1_PIN, &in_config2, IMU_INT1_pin_handler);

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(IMU_INT1_PIN, true);

nrf_drv_gpiote_in_event_enable(CDC_INT_PIN, true);

I can see the in_pin_handler being hit while the IMU_INT1_pin_handler does not. I do not have any other high accuracy events configured. The IMU interrupt is triggered aprox. at 104 Hz while the CDC is at 100 Hz. Can anyone please help explain what I am doing wrong here. Your time and effort will be greatly appreciated.

Regards,

  • Well, I finally brought the scope to my desk so that I can see the INT signal on the scope while I'm debugging. Come to find out, the interrupt does not get triggered during debug mode BUT DOES work when I flash the device and do not run in debug mode. I am using Keil version 5.23 and can not figure out why this is happening. During Debugging, the INT2(Pcap) IC handler does get hit.

    This is what I'm seeing when I Debug:

    1. Erase the Flash

    2. repower the device (the INT1 signal is low as expected)

    3. press the Debug button while the program is downloading, I can see the INT signal on the scope until the program breaks at the first line in the main function. (the signal stays high)

    4. press the Go button( the signal stays high) and the breakpoint in the handler is never hit)

    Any help would e greatly appreciated.

    Regards,

  • If INT signal is high before the gpiote is set-up, the interrupt will never trigger because there is no transition from low to high after the gpiote is enabled.

Related