I have a application where I need to time acurately the time between two enternal pin signals. I have this working using the
I have a application where I need to time acurately the time between two enternal pin signals. I have this working using the
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.
Ah, I see. Sorry, I misunderstood your approach previously, but this idea is indeed a good use case of the PPI peripheral.
Enabling the nrfx driver is indeed as simple as enabling the CONFIG_NRFX_<peripheral name> Kconfig. The Kconfigs are setup so that just enabling the peripheral would trigger the relevant driver to build.
See CONFIG_NRFX_TIMER2 for example, it selects CONFIG_NRFX_TIMER, which enable the nrfx_timer driver.
As for how to use the drivers, there are two sources of information:
Please let me know if you need any further elaboration.
Ah, I see. Sorry, I misunderstood your approach previously, but this idea is indeed a good use case of the PPI peripheral.
Enabling the nrfx driver is indeed as simple as enabling the CONFIG_NRFX_<peripheral name> Kconfig. The Kconfigs are setup so that just enabling the peripheral would trigger the relevant driver to build.
See CONFIG_NRFX_TIMER2 for example, it selects CONFIG_NRFX_TIMER, which enable the nrfx_timer driver.
As for how to use the drivers, there are two sources of information:
Please let me know if you need any further elaboration.
Thank you this should help me with further parts for my project.
I now have GPIOTE, PPI, TIMER1 & TIMER 2 all working at I want them too
Just as an aside, I building this into the Nordic UART Bridge Service (NUS) sample (ntf/samples/bluetooth/peripheral_uart) & after some time of stuggling I found that TIMER0 was throwing an exception & looking thru the map file & source files I found the irq_tables.c has this device pointing at .text.mpsl_timer0_isr_wrapper. There is nothing in this sample code documentation that mentions the use of TIMER0.
Is there any other resurces that are not avaiable if I build my application based on this sample code?
Ah right, I should have thought of that issue as well. My apologies.
In wireless application, the Multiprotocol Service Layer (MPSL) reserves some peripherals. The details are here:
https://docs.nordicsemi.com/bundle/ncs-3.0.2/page/nrfxlib/mpsl/doc/mpsl.html