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 Didrik,
thank you! will try all of it
Best regards
Oleh
Hi Didrik,
thank you for the suggestion, It is clear with the pwm part, got it working.
what i am not able to catch is the sensing that frequency on the input part. Tried the gpio to config in input, then reading buffer, seems ok to get bits 0s/1s but somehow to get to the frequency not... i’m stuck.
May I ask you for a snippet?
thank you!
best
Oleh
Hi.
Here is the code I used to count pulses. It does not calculate the frequency, but that should be easy to do if you see how many pulses you get per unit of time.
Best regards,
Didrik
Hi, thank you!
Just a short confirmation question: can I use Gpiote/PPI in Zephyr with nrf91?
Best
Oleh
Hi, thank you!
Just a short confirmation question: can I use Gpiote/PPI in Zephyr with nrf91?
Best
Oleh
Yes, you can use GPIOTE and DPPI on the nRF91.
It looks like Zephyr's GPIO driver uses GPIOTE internally.
The PPI trace sample works with both nRF91 and nRF52 and might be a good starting point on how to use DPPI.
thanks for the hint! I'm trying it out...
first blocker was: https://devzone.nordicsemi.com/f/nordic-q-a/49657/how-to-link-nrfx-gpiote-and-ppi-in-zephyr/198090#198090 when adding the config -- it picked up.
second blocker is "GPIOTE_IRQn undeclared" for nRF9160 (there are two: GPIOTE0_IRQn/GPIOTE0_IRQn defined in \zephyr\ext\hal\nordic\nrfx\mdk\nrf9160.h)
am I missing something? Or was the ppi_trace never configured+tested on nRF9160?
Thanks!
The ppi_trace sample worked for me.
I did not get any build errors.
However, I did have to change the pins used to 10, 11, and 12. You can do this in the Kconfig file in the sample, or by adding the relevant configurations in the prj.conf file.
Also, the sample should be built as a secure application (use target nrf9160_pca10090, no ns).
aha! that was the missing part, thank you!
I will try for the Secure board.
In order to use DPPI on the NonSecure, would this be sufficient:
PERIPH("NRF_DPPI", NRF_DPPIC_NS, CONFIG_SPM_NRF_DPPIC_NS), // adding to spm.c in the periph_cfg periph[]
And also:
if (IS_ENABLED(CONFIG_SPM_NRF_GPIOTE1_NS)) {
/* Configure DPPI to be Non-Secure */
NRF_SPU->DPPI[0].PERM = 0;
}
thank you!
Almost.
In addition to
PERPIH("NRF_DPPI", NRF_DPPIC_NS, CONFIG_SPM_NRF_DPPIC_NS),in spm.c:304 and
if (IS_ENABLED(CONFIG_SPM_NRF_GPIOTE1_NS)) { NRF_SPU->DPPI[0].PERM = 0; }in spm.c:326
I also had to add
PERIPH("NRF_RTC0", NRF_RTC0, CONFIG_SPM_NRF_RTC0_NS),in spm.c:305,
config SPM_NRF_DPPIC_NS bool "DPPI is Non-Secure" default y config SPM_NRF_RTC0_NS bool "RTC0 is Non-Secure" default yin ncs/nrf/subsys/spm/Kconfig:180, and
CONFIG_PPI_TRACE_PIN_RTC_COMPARE_EVT=10 CONFIG_PPI_TRACE_PIN_RTC_TICK_EVT=11 CONFIG_PPI_TRACE_PIN_LFCLOCK_STARTED_EVT=12in prj.conf