Measuring 1hz to 1Mhz Input frequency on up to 6 GPIOs with maximum possible high accuracy.

My board is nRF5340Dk with NCS 2.6.1 and toolchain 2.6.1.

At this development stage I want to measure continuously incoming frequency ranging from 1Hz to 1MHz with high accuracy possible. I have tried looking into some previous similar question and implemented the code from that project on to my project but I could not get past the NRF_PPI section, which I believe now is NRF_DPPI for nrf5340 boards. But how do I implement  NRF_DPPI without extensively changing existing code? Because the way NRF_PPI was used is not similar to NRF_DPPI.

Is there a best way to measure up to 6 frequencies through GPIOS?

This is the current code :

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/sys/printk.h>
#include <helpers/nrfx_gppi.h>
#include <nrfx_timer.h>
#include <nrfx_gpiote.h>
#include <nrfx_dppi.h>
#define FREQ_MEASURE_PIN 7
uint32_t time = 1; // timer time in seconds
static void timer_init()
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and prj.conf

Fullscreen
1
2
CONFIG_GPIO=y
CONFIG_LOG=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This code/project primarily has been taken from this question on devzone which was running on nRF52840 and a different SDK.

I have issues in 

static void ppi_timer_stop_counter_init() and in 
static void ppi_gpiote_counter_init() 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static void ppi_timer_stop_counter_init()
{
NRF_DPPI->CHEN |= 1 << 0;
*(&(NRF_DPPI->CH[1].EEP)) = (uint32_t)&NRF_TIMER1->EVENTS_COMPARE[0];
*(&(NRF_DPPI->CH[1].TEP)) = (uint32_t)&NRF_TIMER2->TASKS_STOP;
NRF_DPPI->CHENSET |= 1 << 0;
}
static void ppi_gpiote_counter_init()
{
NRF_DPPI->CHEN |= 1 << 1;
*(&(NRF_DPPI->CH[1].EEP)) = (uint32_t)&NRF_GPIOTE->EVENTS_IN[0];
*(&(NRF_DPPI->CH[1].TEP)) = (uint32_t)&NRF_TIMER2->TASKS_COUNT;
NRF_DPPI->CHENSET |= 1 << 1;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Although, I have changed the name, NRF_PPI to NRF_DPPI in my code to check if that works, it doesn't and I have no clue how to implement that EEP or TEP.

It would be helpful to get some directions on these requirements.