How to use input pin timer / capture function in zephyr API

I have a application where I need to time acurately the time between two enternal pin signals. I have this working using the 

k_timer which & read & restart within the GPIO ISR. This works well unit I enable BT then the timings are wrong use to the BT ISR having higher priority.
I guessing I can use the timer/capture function to capture & restart the timer, this can then generate an interrupt which I can process the captured values. The varying IRQ latency would then be no longer an issue.
I'm using up-to-date uNR Connect for VS Code & the Extention pack
Parents
  • Hi John,

    There is no Zephyr API that makes use of the nrfx_timer driver at all, so I believe using the Timer peripheral's capture feature is not possible with Zephyr API. You will need to use nrfx driver directly.

    Please also know that the SoftDevice Controller will reserve some highest priorities, so even if you use nrfx driver and direct Timer peripheral interrupt, the latency of recording the timing cannot be guaranteed to be constant.

    Hieu

Reply
  • Hi John,

    There is no Zephyr API that makes use of the nrfx_timer driver at all, so I believe using the Timer peripheral's capture feature is not possible with Zephyr API. You will need to use nrfx driver directly.

    Please also know that the SoftDevice Controller will reserve some highest priorities, so even if you use nrfx driver and direct Timer peripheral interrupt, the latency of recording the timing cannot be guaranteed to be constant.

    Hieu

Children
Related