nrf_drv_gpiote_init() causes unwanted hard fault from other pin input

Hello,

I have been trying to resolve an issue for a few days now.  Here is what I'm trying to do.  

1. initialize gpiote and tie a pin to an interrupt handler

static void peripherial_init(void)
{
	ret_code_t err_code;
	err_code = nrf_drv_gpiote_init();
	APP_ERROR_CHECK(err_code);

	nrf_drv_gpiote_in_config_t vl_int_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
	err_code = nrf_drv_gpiote_in_init(VL_INT, &vl_int_config, vl_int_pin_handler);
  APP_ERROR_CHECK(err_code);

	nrf_drv_gpiote_in_event_enable(VL_INT, true);	
}

2. initialize a gpio as an input and read it from an application timer every 50ms.

    //Digital Inputs
		nrf_gpio_cfg(BTN_MSTR,
								 NRF_GPIO_PIN_DIR_INPUT,
								 NRF_GPIO_PIN_INPUT_CONNECT,
								 NRF_GPIO_PIN_PULLUP,
								 NRF_GPIO_PIN_S0S1,
								 NRF_GPIO_PIN_SENSE_LOW);

The GPIOTE pin (P0.06) is different from the gpio input pin (P0.13).  The gpio input pin is connected to a button.  I use the button to turn the device on and off.  This works great if I don't call peripherial_init().  If I call peripherial_init() and then push the button.  The processor hangs.  If I hold the button down, the processor hangs until my watchdog times out, then the device resets.

The GPIOTE interrupt works as expected.

I am using SDK 17.1 with softdevice S132_nRF52_7.2.0 nRF52832 with RC 32.768kHz (no external 32.768kHz Oscillator)

Thanks,

John  

Parents
  • Hello,

    I suggest to look at pin change interrupt example project if you havent' already, to verify that work as expected:
    \examples\peripheral\pin_change_int

    If you find that you have a problem with a pin in specific (e.g. P0.06 fails, but 0.13 works), then I would likely check if it can be a conflict of two or more peripherals trying to use the same pin. For instance P0.06 is frequently used for UART (e.g. logging).

    Best regards,
    Kenneth

Reply
  • Hello,

    I suggest to look at pin change interrupt example project if you havent' already, to verify that work as expected:
    \examples\peripheral\pin_change_int

    If you find that you have a problem with a pin in specific (e.g. P0.06 fails, but 0.13 works), then I would likely check if it can be a conflict of two or more peripherals trying to use the same pin. For instance P0.06 is frequently used for UART (e.g. logging).

    Best regards,
    Kenneth

Children
No Data
Related