This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer for time measurement

Hallo devzone,

i have a real time task, where i have a trigger, different calculations and then the corresponding action.

Now i need to calculate the time from the trigger as close as possible to the corresponding action.

I started with the app timer which was quite easy.

...

app_timer_init();

app_timer_create();

app_timer_start();

trigger();

var1.start = app_timer_cnt_get();

calc();

var1.stop = app_timer_cnt_get();

var1.diff  = app_timer_cnt_diff_compute(stop,start)

GPIO_set();

But 32kHz / 30µs is quite large, idealy we could count with sysclk and maybe a low prescaler.

So im looking for something like:

nrf_drv_timer_init();

nrf_drv_timer_create();

...

triger();

"nrf_drv_timer_start()"; // from 0

calc():

"nrf_drv_timer_stop();"

var2.diff = "nrf_drv_timer_get()"

"nrf_drv_timer_set(0)"

I managed to add timer, interrupts, Blink LED, count interrupts, but i cant find the right Start Stop and Read functions i need.

With the count interrupts i could build something. But the interrupt is unnecessary and to complex.

I simply want to start a timer from zero, stop the timer, read the time, set him to zero again. 

Parents Reply Children
No Data
Related