Use of nrfx_dppi with nrf5340 to control one GPIO

Dear,

I need to generate a pulse signal on one IO following this pattern:
HIGH for 12us ; LOW for 106us ;  and so on...


I tried to use TIMER0 with  NRF_TIMER_EVENT_COMPARE0 and NRF_TIMER_EVENT_COMPARE1 but the signal is often not respected (keeping one cycle the IO HIGH also during second period). So I assume I need to use dppi, but using the following code, I still not see anything happening on the io:

Do you know why ? I confess it was difficult to setup this with all the API changes on that topic (add of nrfx_gpiote_t in prototypes and other changes), and I never found one full example working for nrf5340 and NCS 2.7.0 I am using.

Thanks in advance for your piece of advice!

Kind regards,

Michael

  • Hello Edvin,

    Thanks for the suggestion, in between so to unblock myself and respect my timeline, I used a solution based on a PWM which did finally the trick perfectly.

    Kind regards,

    Michael

  • Hello Michael,

    Sorry for not getting back to you! I am glad to hear! Did you manage to get it working using the DPPI API? Or did you write to the registers directly?

    Best regards,

    Edvin

  • Hello Edvin,

    I did not used DPPI but direct PWM like this:

    This approach was working and easier to managed.

    Kind regards,

    Michael

  • Ah, clever! Didn't think of using the PWM peripheral like that (although it is what it is intended for, really). I was caught up in the DPPI solution.

    I am glad to hear that you found a solution that is working for you!

    Best regards,

    Edvin

1 2