Best way to measure time between falling/rising edges (NCS, Zephyr, NRF52840)

Hello everyone,

is there a safe way to measure the time between rising and falling edges (accuracy +-1µs, duration of the pulses are 50µs or more) on a GPIO(TE) pin? If so, can you please show me?

I am using a custom board with a NRF52840, running NRF Connect SDK and Zephyr RTOS.

I stumbled across other forum entries, of which some are several years old and where I do not know if they are are still valid.

I found another forum entry here:  How to define a direct GPIO IRQ in zephyrbut I am afraid to use gpio interrupts as they might interfere with Zephyrs "under the hood" use of nrfx gpio library.

In another forum entry ( RE: Needed example code of GPIOTE port event on NRF5340 ) you recommend to use zephyr/samples/boards/nrf/nrfx example, but in its README, it says, that Zephyr GPIO driver is disabled. I do not want to disable my Zephyr GPIO driver, as the remaining program is using it.

I am already using a hardware timer (timer3) with nrfx library to set and clear a pin which works.

Kind regards,

Dom

Related