Hi,
I need to capture time in nanosecs between 2 tasks, for which I am using the zephyr suggested time measurement code as in:
u32_t start_time; u32_t stop_time; u32_t cycles_spent; u32_t nanoseconds_spent; /* capture initial time stamp */ start_time = k_cycle_get_32(); /* do work for some (short) period of time */ ... /* capture final time stamp */ stop_time = k_cycle_get_32(); /* compute how long the work took (assumes no counter rollover) */ cycles_spent = stop_time - start_time; nanoseconds_spent = SYS_CLOCK_HW_CYCLES_TO_NS(cycles_spent);
When I am trying to compile the above code, I get build errors for undefined reference to "SYS_CLOCK_HW_CYCLES_TO_NS".
Upon looking further, I found that SYS_CLOCK_HW_CYCLES_TO_NS is deprecated for nCS as in : https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.99-dev1/nrf/releases/release-notes-latest.html#:~:text=K_QUEUE_INITIALIZER-,Removed%20the%20following%20deprecated,-system%20clock%20APIs
Can you kindly confirm if I cannot use this or how do I make conversion for nanosecs from cycles..?
Thanks,
Ubaid