Hello,
There is an issuse in my project that using nrf_gpiote_drv lost interrupt.
SDK: nRF5_SDK_13.0.0_04a0bfd Chip: nRF52328_xxAA Board: PCA10004
There is two buttons on my board, define as primaryButton & secondaryButton.
Here is my code
#include "nrf.h"
#include "nrf_gpio.h"
#include "nrf_drv_gpiote.h"
#define primary_pin_No 13
#define secondory_pin_No 14
static void button_drv_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
if( nrf_gpio_pin_read(primary_pin_No) == 0 ){
nrf_gpio_pin_toggle( 17 );
}
}
static void secondary_button_drv_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
if( nrf_gpio_pin_read( secondory_pin_No) == 0 ){
nrf_gpio_pin_toggle( 18 );
}
}
void button_init(void)
{
nrf_drv_gpiote_init();
nrf_gpio_cfg_output( 17 );
nrf_gpio_cfg_output( 18 );
nrf_drv_gpiote_in_config_t int_config = {
.sense = NRF_GPIOTE_POLARITY_TOGGLE,
.pull = NRF_GPIO_PIN_PULLUP,
.is_watcher = false,
.hi_accuracy = false,
};
APP_ERROR_CHECK ( nrf_drv_gpiote_in_init( primary_pin_No,
& int_config,
button_drv_handler)
);
nrf_drv_gpiote_in_config_t sint_config = {
.sense = NRF_GPIOTE_POLARITY_HITOLO,
.pull = NRF_GPIO_PIN_PULLUP,
.is_watcher = false,
.hi_accuracy = false,
};
APP_ERROR_CHECK ( nrf_drv_gpiote_in_init( secondory_pin_No,
& sint_config,
secondary_button_drv_handler)
);
nrf_drv_gpiote_in_event_enable( primary_pin_No, true );
nrf_drv_gpiote_in_event_enable( secondory_pin_No, true );
}
- It works good when click each button, callbakc function is called.
- when i hold the secondary button(this button sense require NRF_GPIOTE_POLARITY_HITOLO or NRF_GPIOTE_POLARITY_LOTOHI) first, then click primary button, it will not enter GPIOTE_IRQHandler, two button pin in LATCH registers,are "Criteria has been met".
- release button from hold state, every button can generate interrupt again.
why holding a button( sense = NRF_GPIOTE_POLARITY_HITOLO or NRF_GPIOTE_POLARITY_LOTOHI), others gpiote interrupt is seem to be masked(disabled? missed?)? it that a bug of nrf_drv_gpiote ? or that is a mechanism that GPIOTE normal work?