Hi team,
In NRF5, the app_timer requires a minimum of 5 ticks (150us) in the source code comment. I tested and checked on a scope and it looked very solid. As soon as the timer expires, I would write directly to the GPIO register or starts a PWM (NRF_PWM0->TASKS_SEQSTART[0] = 1;) to observe on the scope ( and to reduce the overhead delay of an indicator).
I'm completely new to ncs zephyr and would like to figure how to get the best timer resolution I can. From what I researched, ktimer would be equivalent to app_timer that uses a RTC. Based only the recent commit: https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/kernel/timer It looks like the smallest resolution would be 2 ticks (@32khz) or (actually at 1 tick@16khz ~60us. But I'm wondering what is the smallest delay can I use. Would it be roughly similar to the app_timer 3ticks ~ 180us ?
I couldn't find an example of how to use ktimer. Also how would I toggle a pin with the least overhead in ncs zephyr such that I could observe the performance on ktimer. Would gpio_pin_toggle_dt() from zephyr have nested calls and introduce variable delay? Could I write directly to the gpio register such as
NRF_P0->OUTCLR = (1UL << PIN_LED1); or NRF_P0->OUTSET = (1UL << PIN_LED1);
to minimize the overhead for a better scope measurement.
I'm wondering if the callback from ktimer is a short deterministic delay as if it's a real ISR. In other words, the load of the system wouldn't affect the timing jitter of a periodic event from ktimer. Thanks.