Interrupts on Nano 33 BLE...impossible!

Gentlemen:

I'm working on a product prototype using the Arduino Nano 33 BLE board. It runs on a Nordic 52840 processor. The Bluetooth works fine, but I'm having trouble getting an external interrupt to work.

As far as I can tell, Arduino offers no support of the interrupt function (or timers for that matter): you have to use Nordic code. After slogging through the Nordic manual, I set up the interrupt, but it refuses to work. I have consulted Nordic and they are baffled as well. They theorized that it might have to do with the C++ used in the Arduino IDE and suggested the use of

extern "C"{}

But I can't get it to work. In a nutshell, here is a simple program that compiles without error and runs. I have added an LED output in the ISR so that this program should light the LED if an input is applied to pin2 (D2 on the board), triggering an interrupt:

#include <nrf.h>

volatile uint32_t last_ecount = 0;                //last count values
const int epin = 2;                               //board pin D2, signal from E-wave
int LED = LED_BUILTIN;                            //built-in orange LED for debug

void setup() {  
  nrf_gpio_cfg_output(LED);                       //set built-in LED pin as output
  nrf_gpio_cfg_input(epin, NRF_GPIO_PIN_PULLUP);  //set pin 2 as pullup input

  NVIC_EnableIRQ(GPIOTE_IRQn);                    //enable interrupts
  NRF_GPIOTE->CONFIG[0] = 0x00010201;             //low-to-high, pin2, event mode
  NRF_GPIOTE->INTENSET = 0x00000001;              //enable IN[0]   
  
  NRF_TIMER1->TASKS_STOP = 1;
  NRF_TIMER1->MODE = 0;
  NRF_TIMER1->BITMODE = 3;                        //timer1 32-bit mode
  NRF_TIMER1->PRESCALER = 0;                      //use full system clock for timer1: 16 MHz
  NRF_TIMER1->TASKS_CLEAR = 1;
  NRF_TIMER1->CC[0] = 0;                          //zero timer1
  NRF_TIMER1->TASKS_START = 1;                    //start timer1
}

void loop() {
}
   
void GPIOTE_IRQHandler(void){                     //interrupts
  uint32_t count = 0;
  int avcount = 0;

  digitalWrite(LED, HIGH); 
  
  if(NRF_GPIOTE->EVENTS_IN[0] == 1){              //filter interrupt for E wave
    NRF_GPIOTE->EVENTS_IN[0] = 0;                 //clear interrupt flag
    NRF_TIMER1->TASKS_CAPTURE[0] = 1;             //capture timer1 value in CC0
    count = NRF_TIMER1->CC[0] - last_ecount;      //time elaspsed for one wave (CC0)
    last_ecount = count;                          //reset for next count
  }
}

The LED never lights no matter what is applied to the input pin2. Thinking that the input wasn't working, I modified the program. This is the same program, but I have moved the LED output into the loop() so that pin2 controls the LED directly. This program works and will light the LED every time an input is applied to pin2...

#include <nrf.h>

volatile uint32_t last_ecount = 0;                //last count values
const int epin = 2;                               //board pin D2, signal from E-wave
int LED = LED_BUILTIN;                            //built-in orange LED for debug

void setup() {  
  nrf_gpio_cfg_output(LED);                       //set built-in LED pin as output
  nrf_gpio_cfg_input(epin, NRF_GPIO_PIN_PULLUP);  //set pin 2 as pullup input

  NVIC_EnableIRQ(GPIOTE_IRQn);                    //enable interrupts
  NRF_GPIOTE->CONFIG[0] = 0x00010201;             //low-to-high, pin2, event mode
  NRF_GPIOTE->INTENSET = 0x00000001;              //enable IN[0]   
  
  NRF_TIMER1->TASKS_STOP = 1;
  NRF_TIMER1->MODE = 0;
  NRF_TIMER1->BITMODE = 3;                        //timer1 32-bit mode
  NRF_TIMER1->PRESCALER = 0;                      //use full system clock for timer1: 16 MHz
  NRF_TIMER1->TASKS_CLEAR = 1;
  NRF_TIMER1->CC[0] = 0;                          //zero timer1
  NRF_TIMER1->TASKS_START = 1;                    //start timer1
}

void loop() {
  int pin2 = 0;
  pin2 = digitalRead(epin);
  if(pin2)
    digitalWrite(LED, HIGH);
    else
      digitalWrite(LED, LOW);
}
   
void GPIOTE_IRQHandler(void){                     //interrupts
  uint32_t count = 0;
  int avcount = 0;
   
  if(NRF_GPIOTE->EVENTS_IN[0] == 1){              //filter interrupt for E-string
    NRF_GPIOTE->EVENTS_IN[0] = 0;                 //clear interrupt flag
    NRF_TIMER1->TASKS_CAPTURE[0] = 1;             //capture timer1 value in CC0
    count = NRF_TIMER1->CC[0] - last_ecount;      //time elaspsed for one wave (CC0)
    last_ecount = count;                          //reset for next count
  }
}

I invite you to copy and paste these two programs and try it yourself. Arguably, interrupts are one of the basic functions of an embedded microcontroller. It's hard for me to believe that this functionality is not available. This would be a terrible flaw.

Does anyone know how to properly code interrupts on a Nano BLE?

Don