Hello,
From the ble_app_uart example I created a version where instead of the UART the incoming data over BLE is processed using the scheduler.
Processing is not much more then echoing the incoming strings back over BLE in the scheduler_event_handler. This works fine on a nrf52840 (android nano 33 ble).
But when I try to create an interrupt via GPIOTE, then the code stops working.
ret_code_t err_code;
if(!nrf_drv_gpiote_is_init())
{
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
nrf_gpio_pin_set(LED_DL2);
}
nrf_gpio_pin_clear(LED_DL3_RED);
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(BUTTON_1, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_gpio_pin_set(LED_DL1);
return;
nrf_drv_gpiote_in_event_enable(BUTTON_1, true);
This is the init code for gpiote, the only change to the code. Note that I use LEDs to show to where the code gets.
We can see that nrf_drv_gpiote_is_init() holds: the softdevice does that. The strange thing is that nrf_drv_gpiote_in_init() does not return as shown by the LED_DL2 led NOT lighting up.
There is a return statement here to make sure the event is not enabled, to make for a simpler scenario.
The same init code works ok when not using a softdevice, so why is the init-function not returning when using a softdevice? Thanks in advance.