I am new to nrf52832. I am using pin change interrupt. I want to know that how to mask pin change interrupt?
Thanks in Advance
I am new to nrf52832. I am using pin change interrupt. I want to know that how to mask pin change interrupt?
Thanks in Advance
Mask as in to make the MCU ignore the interrupts generated. Then you can do that by disabling them at NVIC level (even though the interrupt is enabled in GPIO level)
NVIC_EnableIRQ(GPIOTE_IRQn);
If you are using BLE softdevice then, it is as below
sd_nvic_DisableIRQ(GPIOTE_IRQn);
Hi,
I actually want to Mask/ignore/disable an particular interrupt PIN before making nrf sleep, and again unmask/enable the same PIN after wake from sleep, to make sleep i have used this API >> sd_app_evt_wait() <<
following function is to enable interrupt of pin,
static void gpio_init(void)
{
ret_code_t err_code;
err_code = nrf_drv_gpiote_init();
nrf_drv_gpiote_in_config_t pin_config = {
.is_watcher = false,
.hi_accuracy = true,
.pull = NRF_GPIO_PIN_PULLUP,
.sense = NRF_GPIOTE_POLARITY_HITOLO
};
err_code = nrf_drv_gpiote_in_init(PIN_NUM, &pin_config,pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(PIN_NUM, true);
}
I too have same problem can anyone assist the same..
Most of us on holidays until New year. We will get back to you once we are back to office after 2nd January. We appreciate your patience.
nrf_drv_gpiote_in_event_disable which in turn calls nrfx_gpiote_in_event_disable seems to be disabling the interrupt in nrfx_gpiote.c (SDK15.2)
nrf_drv_gpiote_in_event_disable which in turn calls nrfx_gpiote_in_event_disable seems to be disabling the interrupt in nrfx_gpiote.c (SDK15.2)
sorry for late reply. I am using sdk12.3.0 and pca10040 board. I have already tried with nrf_drv_gpiote_in_event_disable but interrupt is not disabled.
Hey,
Here is what the documentation of the in_event_enable function says.
/** * @brief Function for enabling sensing of a GPIOTE input pin. * * @details If the input pin is configured as high-accuracy pin, the function * enables an IN_EVENT. Otherwise, the function enables the GPIO sense mechanism. * Note that a PORT event is shared between multiple pins, therefore the * interrupt is always enabled. * * @param[in] pin Pin. * @param[in] int_enable True to enable the interrupt. Always valid for a high-accuracy pin. */
Note that a PORT event is shared between multiple pins, therefore the interrupt is always enabled.
@param[in] int_enable True to enable the interrupt. Always valid for a high-accuracy pin.
Maybe you can try using uninit before going to sleep and init it back again when the device wakes up.
void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin);
thanks for quick response. i will check it using void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin)