Hello
I'm having difficulty in executing an GPIOTE interrupt during a BLE connection event with the nRF51 DK. The interrupt I have works fine when the softdevice is advertising, but as soon as the it connects to another device the interrupt fails to execute. I'm using Version 8.0 of the SDK with Keil, and my code is based off the BLE UART example.
What I'm trying to do is get an LED to blink on the interrupt, and then do a soft-reset.
I first enable the GPIOTE interrupt on Pin 2 using:
nrf_gpio_cfg_sense_input(2, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Msk;
NVIC_EnableIRQ(GPIOTE_IRQn);
The GPIOTE function is then given by :
void GPIOTE_IRQHandler(void)
{
if(NRF_GPIOTE->EVENTS_PORT)
{
NRF_GPIOTE->EVENTS_PORT = 0; // re-enable the interrupt
nrf_gpio_pin_write(28,0); // Turn on LED on Pin 28
nrf_delay_ms(10);
nrf_gpio_pin_write(28,1);
sd_nvic_SystemReset() // soft-reset
}
}
I then setup the BLE connection with :
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
ble_stack_init();
uart_init();
gap_params_init();
services_init();
advertising_init();
conn_params_init();
sec_params_init();
advertising_start();
I've tried changing the priority as described here, but I have had no success. Any ideas why this isn't working? I assume its something to do with the priority of the interrupts. Also, does the soft-device use the GPIOTE_IRQHandler?
Any help would be much appreciated.
Thanks