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
  • Typo "I'm using up-to-date nRF Connect for VS Code & the Extention pack"

  • 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

  • I'm aware of the IRQ latency issues which is why I want to use the timer capture function so when the ISR is eventuare called, the latency will not effect the actual pin event result on the timer capture value.

    However, I'm struggling to find any consice information of using the nrfx timer function within the VS code nRF connect extention.

    I guess I'm missing something as I can't find anything in the Nordic help which tells me how in use their drivers & e.g. how to add timers to my project. I did find this post which said to add CONFIG_NRFX_TIMER2=y to prj.conf, which helped, but this was just in a question asked on community site.

    https://community.platformio.org/t/how-to-link-with-nordic-nrfx-library/27040 

    Are you able to fill in the blanks for me either specifically how to setup the GPIOTE pin to trigger a timer capture thru PPI or more generally with access to a more formal & conprehensive source of help/documentation on the nRF connect NRFX library useage within VS code

    Many thanks in advance.

Related