What is the least latency interrupt that i can implement in external gpio pin? In product specification there are mention about GPIOTE. Is that only way to do it? We need to measure time between pulses on external pin. less than 1 us accuracy.
What is the least latency interrupt that i can implement in external gpio pin? In product specification there are mention about GPIOTE. Is that only way to do it? We need to measure time between pulses on external pin. less than 1 us accuracy.
Please don't put the entire question in the title:
devzone.nordicsemi.com/.../forum-issue-ask-a-question-is-misleading
Hi,
What is the least latency interrupt that i can implement in external gpio pin? In product specification there are mention about GPIOTE. Is that only way to do it? We need to measure time between pulses on external pin. less than 1 us accuracy.
If you use GPIOTE IN, PPI, and 2 x TIMER instances (one in COUNT, and one that runs in normal capture/compare), you can do this with an accuracy of the 16MHz peripheral clock tree.
There's several threads on "measure pulse width" here on devzone:
https://devzone.nordicsemi.com/f/nordic-q-a/38846/measuring-pulse-width-using-ppi-and-gpiote
https://devzone.nordicsemi.com/f/nordic-q-a/51450/timer-0-interface-program
The last one is for nrf9160, and uses dppi compared to ppi, but uses nrfx api (which should be fairly similar on all nRF5-series devices as well)
Please note that errata #155 needs to be implemented on nRF52-devices when the input signal(s) exceed a certain frequency:
Kind regards,
Håkon
I'm using zephyr os and I'm able to use gpiote out and input in demo app.
I assume that i cant use zephyr general gpios and nrfx gpiote libraries together? is that correct?
If I understand correct i cant use zephyr general api anymore for SPI etc.?
Do i have to use spim spi drivers directly if i want to use gpiote libraries on zephyr?
Hi,
Unfortunately, this specific scenario requires workarounds. From our (ie. Nordic's) side, I'll get in touch with the low-level driver team to see if we can add a task/improvement internally to change the zephyr gpio port to use nrfx_gpiote for interrupt handling, so that these two libraries can co-exist inside one project.
You will have to use another event to generate interrupt on, as the gpio_nrfx.c registers the interrupt handler for GPIOTE:
https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs1/drivers/gpio/gpio_nrfx.c#L461-L465
If you do not use the gpiote interrupt handler in your application (or fork out that gpiote event to another task, like the EGU, then enable an interrupt on that), you should be fine as long as you also change the sample to use nrfx_gpiote_* API to allocate new channels, as this is the one that is also used in gpio_nrfx.c (zephyr "gpio" port):
https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs1/drivers/gpio/gpio_nrfx.c#L48-L65
Kind regards,
Håkon