Hello, before you say anything: "yes I have searched!" :D I found that this question was similar to mine How to write GPIOTE Interrupt
Now I am fairly certain that I can handle that part just fine, however here is when things get tricky. After stealing "GPIOTE_IRQHandler" from app_gpiote (removing app_gpiote and implementing the IRQHandler in my own module), the BLE softdevice would no longer start up. The error code provided was 0x0000001. Yes I looked it up, but wasn't able to glean any information from it.
When I subscribe using the standard
#define HAL_AFE_ADC_RDY_PIN 13
app_gpiote_user_id_t hGPIOTE = 0;
...
{
err_code = app_gpiote_user_register(&hGPIOTE, (1 << HAL_AFE_ADC_RDY_PIN), 0x00000000, app_gpiote_event_handler);
APP_ERROR_CHECK(err_code);
err_code = app_gpiote_user_enable(hGPIOTE);
APP_ERROR_CHECK(err_code);
}
...
I get latencies of up to 500 milliseconds in receiving the callback from this handler. The signal I need to detect is a logic level high pulse with 250 nanosecond width, active high. It is on pin 13.
My question is this: How do I use pin change interrupts correctly while still being able to use your bluetooth low energy softdevice?
Code dump below:
#include "nrf_gpio.h"
#include "app_gpiote.h"
#define HAL_AFE_ADC_RDY_PIN 13
app_gpiote_user_id_t hGPIOTE = 0;
void app_gpiote_event_handler(uint32_t event_pins_low_to_high, uint32_t event_pins_high_to_low)
{
uint8_t i = 2;
uint32_t k[] = {0, 0, 0, 0, 0, 0};
event_pins_low_to_high++;
event_pins_high_to_low++;
i++;
HalAfe_HW_ReadADC(k);
}
static void halAfe_ConfigIO(void)
{
uint32_t err_code = 0;
/* GPIO configuration */
AFE_CONFIGURE_RESET();
AFE_RELEASE_RESET();
nrf_gpio_cfg_input(HAL_AFE_ADC_RDY_PIN, NRF_GPIO_PIN_NOPULL);
err_code = app_gpiote_user_register(&hGPIOTE, (1 << HAL_AFE_ADC_RDY_PIN), 0x00000000, app_gpiote_event_handler);
APP_ERROR_CHECK(err_code);
err_code = app_gpiote_user_enable(hGPIOTE);
APP_ERROR_CHECK(err_code);
}