Dear Team,
what is the way to do it in Zephyr?
I have a signal up-to 10kHz, what is the best way to keep the counter in the background?
Thank you and best
Oleh
Dear Team,
what is the way to do it in Zephyr?
I have a signal up-to 10kHz, what is the best way to keep the counter in the background?
Thank you and best
Oleh
Hi.
You can use Zephyr's GPIO driver to configure interrupts.
Have a look at the documentation here.
Best regards,
Didrik
Hi Didrik,
thank you, I'm new to Zephyr so trying to map my nrf knowledge to zephyr
To complement and test the counter on gpio, I thought to put the second DevKit board into generation mode. Could you please point on the right track with how can the generation on-off be done in background on Zephyr?
thanks & best
Oleh
Hi, and apologies for the late answer.
I believe that most of the code you posted should work, but especially the parts concerning PPI would not work due to differences between PPI and DPPI.
I was able to port an example written by Jared for another case. The sample is made to measure much higher frequencies than what you have, so you might want to edit some of the timer configurations in main().
To make the sample compile, you must also add
#define GPIOTE_IRQn GPIOTE0_IRQn
in ncs/zephyr/ext/hal/nordic/nrfx_config_nrf9160.h, on line 200.
Also, you must configure the DPPI peripheral as non-secure as done in a previous comment.
A pre-compiled hex file is included for your convenience.
Best regards,
Didrik
thank you, now I am trying to make it working on the latest ncs git... but getting errors...
is there anything I have to change?
***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****
starting application...
starting init gpiote...
prepare time 1 cfg...
uninit time 1...
init time 1...
prepare time 2 cfg...
uninit time 2...
init time 2...
nrfx_timer_ms_to_ticks...
nrfx_timer_extended_compare...
gpiote_setup...
gpiote_setup...
gpiote_evt_addr: 0x5000d100
NRF_GPIOTE_EVENTS_IN_0: 0x00000100
NRF_GPIOTE1_NS: 0x40031000
gpiote_evt_addr - NRF_GPIOTE0_S: 0x0ffdc100
[00:00:00.069,274] <err> os: ***** BUS FAULT *****
[00:00:00.069,274] <err> os: Precise data bus error
[00:00:00.069,274] <err> os: BFAR Address: 0x40010088
[00:00:00.069,305] <err> os: r0/a1: 0x00000000 r1/a2: 0x00000001 r2/a3: 0x80000000
[00:00:00.069,305] <err> os: r3/a4: 0x40010088 r12/ip: 0x00000030 r14/lr: 0x0000061f
[00:00:00.069,305] <err> os: xpsr: 0x29000000
[00:00:00.069,305] <err> os: Faulting instruction address (r15/pc): 0x00000632
[00:00:00.069,335] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception
[00:00:00.069,335] <err> os: Current thread: 0x20000274 (unknown)
[00:00:00.140,075] <err> os: Halting system
Hi.
A pull request for a sample demonstrating how to use the nrfx drivers in Zephyr was just opened.
Hopefully, it is able to help you.
https://github.com/zephyrproject-rtos/zephyr/pull/20089/files
Best regards,
Didrik
Hello and thank you!
short question: what is the best way to suspend / resume the ppi in this sample?
and how to safely reset counters?
Hi, and sorry for the late reply.
For resetting counters, I would use the nrfx_timer_clear function.
For suspending/resuming DPPI, you would have to either stop the events from being generated, not publish the events, or subscribe to them (or all at once).
Hi, and sorry for the late reply.
For resetting counters, I would use the nrfx_timer_clear function.
For suspending/resuming DPPI, you would have to either stop the events from being generated, not publish the events, or subscribe to them (or all at once).
Hi and thank you for your input.
I managed to update and make the code working! great! thank you!
Regarding the Suspend/Resume, just for info: I need it in order to save power, as the sensor is external and connected to a stepup convertor, so when not in use -- I would like to power it off. Thus also disable DPPI.
Best regards
Oleh
After digging some more through the nrfx drivers, I also found the nrfx_dppi_channel_disable (and _enable) functions, which should let you stop and start the specific DPPI channel.
Hi Didrik,
you just rock! thank you for all your support!
Best
Oleh