On Zephyr 2.7 I used following snipped to connect a GPIO pin (ADC_nDRDY) to a SPI TASK (simplified):
nrfx_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true); in_config.pull = NRF_GPIO_PIN_PULLUP; nrfx_gpiote_in_init(ADC_nDRDY, &in_config, NULL); uint32_t gpioAddr = nrfx_gpiote_in_event_addr_get(ADC_nDRDY); nrf_ppi_channel_t channel; nrfx_ppi_channel_alloc(&channel); uint32_t spiAddr = nrfx_spim_start_task_get(&spi3); ret = nrfx_ppi_channel_assign(channel, gpioAddr, spiAddr); nrfx_gpiote_in_event_enable(ADC_nDRDY, true);
On Zephyr 3.0.0 we experienced immediate crashes.
I then saw that nrfx_gpiote_in_init() is marked as deprecated, so I replaced nrfx_gpiote_in_init() with following lines with:
nrfx_gpiote_input_config_t input_config; input_config.pull = NRF_GPIO_PIN_PULLUP; nrfx_gpiote_trigger_config_t trigger_config; trigger_config.trigger = NRFX_GPIOTE_TRIGGER_HITOLO; trigger_config.p_in_channel = NULL; // If NULL, the sensing mechanism is used nrfx_gpiote_input_configure(ADC_nDRDY, &input_config, &trigger_config, NULL);
It then no longer crashes, how ever we also do not get any events!
I then added additionally an ISR:
void adc_interrupt(nrfx_gpiote_pin_t pin, nrfx_gpiote_trigger_t trigger, void * p_context) {
printk("#");
}
[..]
nrfx_gpiote_input_config_t input_config;
input_config.pull = NRF_GPIO_PIN_PULLUP;
nrfx_gpiote_trigger_config_t trigger_config;
trigger_config.trigger = NRFX_GPIOTE_TRIGGER_HITOLO;
trigger_config.p_in_channel = NULL; // If NULL, the sensing mechanism is used
nrfx_gpiote_handler_config_t handler_config;
handler_config.handler = adc_interrupt;
handler_config.p_context = NULL;
nrfx_gpiote_input_configure(ADC_nDRDY, &input_config, &trigger_config, &handler_config);
The ISR gets called, but still there is no EVENT!
What am I doing wrong?