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

Help with BLE GPIOTE Interrupts with S110 on nRF51

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

Parents Reply
  • I think it is used for your buttons code inside bsp.c->app_buttons.c file. I think buttons are used to wakeup your device, after it goes to sleep after a certain amount of time of advertisement and if no connection is made. But your main problem you said was the your GPIOTE interrupt was not fired correctly, Removing the irq handler from app_gpiote should not cause this. Check inside app_gpiote when it enables and disables the interrupt, check if that it interfering with logics. I recommend you to comment out app_gpiote and buttons logic completely to check if that helps. If it helps then your logic and app_gpiote are having conflicts

Children
No Data
Related