Hello,
We are using Zephyr v2.6 and nRF51822 SoC in our project.
Because we are porting the code from the SDK environment into the Zephyr environment, we decided to use nrfx gpiote drivers instead of Zephyr GPIO drivers. Consequently, our prj.conf file contains the following lines:
CONFIG_GPIO=n CONFIG_NRFX_GPIOTE=y
There are two GPIOs that should be configured to interrupt CPU. To achieve that, the following lines of code are used:
// GPIO 1 nrf_gpio_cfg_input(PIN_ACCEL_INT1, NRF_GPIO_PIN_NOPULL); nrfx_gpiote_in_config_t in_config_1 = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false); in_config_1.hi_accuracy = false; in_config_1.pull = NRF_GPIO_PIN_PULLDOWN; err_code = nrfx_gpiote_in_init(PIN_ACCEL_INT1, &in_config_1, gpiote_event_handler_1); // GPIO 2 nrf_gpio_cfg_input(PIN_ACCEL_INT2, NRF_GPIO_PIN_NOPULL); nrfx_gpiote_in_config_t in_config_2 = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(false); in_config_2.hi_accuracy = false; in_config_2.pull = NRF_GPIO_PIN_PULLUP; err_code = nrfx_gpiote_in_init(PIN_ACCEL_INT2, &in_config_2, gpiote_event_handler_2); //Enable interrupts nrfx_gpiote_in_event_enable(PIN_ACCEL_INT1, true); nrfx_gpiote_in_event_enable(PIN_ACCEL_INT2, true);
However, when I call the nrfx_gpiote_in_init() function for the second GPIO, this function returns 0xBAD0002 (NRFX_ERROR_NO_MEM).
Is there anything that I am missing here?
I've been told in some previous threads that nRF51822 contains 4 GPIOTE channels. Consequently, configuring two GPIOs to interrupt CPU should be feasible.
Thanks in advance for your time and efforts.
Sincerely,
Bojan.