How do I set up GPPI/DPPI with the new nrfx 4.0.1 drivers?

I am evaluating the nRF54L15 with the nRF54L15DK. Previously, I was developing with NCS 3.1.1 and successfully implemented a high precision frequency measurement using a timer, the gpiote and connecting them using the gppi helper functions. The relevant part of code which was doing that is this:

static void connect_edge_to_timer(uint32_t pin)
{
    nrfx_err_t err;
    uint8_t gppi_ch;

    err = nrfx_gppi_channel_alloc(&gppi_ch);
    NRFX_ASSERT(err == NRFX_SUCCESS);

    uint32_t evt_addr = nrfx_gpiote_in_event_address_get(&gpiote, pin);
    uint32_t task_addr = nrfx_timer_task_address_get(&timer_inst,
                                                     NRF_TIMER_TASK_CAPTURE0);

    nrfx_gppi_channel_endpoints_setup(gppi_ch, evt_addr, task_addr);
    nrfx_gppi_channels_enable(BIT(gppi_ch));
}

I want to update the project to NCS 3.2.1 with the new nrfx 4.0.1 drivers. The nrfx 4.0 migration notes state: "Contrary to the legacy solution, GPPI needs to be initialized prior to using the GPPI API. Ensure that nrfx_gppi_init is called before calling any GPPI API." Also "Removed nrfx_gppi_event_endpoint_setup. Action : Use nrfx_gppi_ep_attach instead."

I don't understand how to initiallize gppi with the nrfx_gppi_init and how to connect the event with the task. I found this docs page, but don't understand how to apply this to my case.

Any help is highly appreciated.

BR Moritz

  • Hi
    thank for your kind support :-)

    I'm struggling to migrate my SDK 3.0 PPI application to SDK 3.2.4 too.
    snoopy20 has definitely a point

    The migration guide ncs/v3.2.4/modules/hal/nordic/nrfx/doc/nrfx_4_0_migration_guide.md says:
    > Ensure that `nrfx_gppi_init` is called before calling any GPPI API

    I can't find a call to nrfx_gppi_init() in the sample applications fork and one-to-one
    grep -rl nrfx_gppi_init ncs/v3.2.4/modules/hal/nordic/nrfx/samples/src/nrfx_gppi

    This confuses me - is nrfx_gppi_init() called somewhere in library code I don't see?

    best regards
    Peter

Related