Hi
I'm trying to catch the GPIOTE_IRQn interrupt, while the device is in system off. Not enabling the SD130 V2 the interrrupt is caught once, and then not anymore... But I'm having problems keeping it running while the softdevice is active.
I'm using the following code:
Version 1:
static void init_wakeup_interrupt(){
ret_code_t ret_code;
ret_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(ret_code);
nrf_drv_gpiote_in_config_t config =
{
.sense = NRF_GPIOTE_POLARITY_HITOLO,
.pull = NRF_GPIO_PIN_NOPULL,
.is_watcher = false,
.hi_accuracy = false
};
nrf_drv_gpiote_in_init(13, &config, gpiote_wakeup_handler);
nrf_drv_gpiote_in_event_enable(13, true);
}
Version 2:
static void init_wakeup_interrupt(){
NRF_GPIO->PIN_CNF[13] = (GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos)
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos)
| (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos)
| (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
NRF_GPIOTE->CONFIG[0] = (GPIOTE_INTENSET_IN0_Set << GPIOTE_INTENSET_IN0_Pos)
| (10 << GPIOTE_CONFIG_PSEL_Pos)
| ((GPIOTE_CONFIG_POLARITY_HiToLo | GPIOTE_CONFIG_POLARITY_LoToHi) << GPIOTE_CONFIG_POLARITY_Pos);
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Set << GPIOTE_INTENSET_PORT_Pos;
// NVIC_EnableIRQ(GPIOTE_IRQn);
sd_nvic_SetPriority(GPIOTE_IRQn, 1);
sd_nvic_EnableIRQ(GPIOTE_IRQn);
}
void GPIOTE_IRQHandler(void)
{
// Event causing the interrupt must be cleared
if ((NRF_GPIOTE->EVENTS_PORT != 0))
{
NRF_GPIOTE->EVENTS_PORT = 0;
}
// Active low.
if (nrf_gpio_pin_read(13) == 0)
{
NRF_LOG_PRINTF("GPIO >> NRF_GPIOTE_POLARITY_HITOLO : %d\r\n", 13);
} else {
NRF_LOG_PRINTF("GPIO >> NRF_GPIOTE_POLARITY_LOTOHI : %d\r\n", 13);
}
}
int main() {
ble_stack_init();
init_wakeup_interrupt();
}
Both cases don't work as expected...
Any help is appreciated