Hi everyone,
I want to measure the total execution time of saadc_sample() & saadc_callback() functions. I am using the application timer and I have inserted the app_timer_cnt_get() before and after the functions I want to measure as well as the app_timer_cnt_diff_compute() to calculate the ticks.
After the functions executed the app_timer_cnt_diff_compute() returns 0 ticks. My questions are:
1. Does this mean that the execution time is less than the resolution of app_timer which is ~30 us?
2. Does it make sense that the execution time of those functions is less than 30us?
There are the functions
void saadc_sample() { ret_code_t err_code; begin = app_timer_cnt_get(); // na - get the current ticks NRF_LOG_INFO("ticks_start = %d \n",begin); err_code = nrf_drv_saadc_sample(); // na - trigger sampling APP_ERROR_CHECK(err_code); } void saadc_callback(nrf_drv_saadc_evt_t const *p_event) { if (p_event->type == NRF_DRV_SAADC_EVT_DONE) { ret_code_t err_code; err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER); APP_ERROR_CHECK(err_code); ADC_RawData[callback_counter] = p_event->data.done.p_buffer[0]; if (callback_counter == NO_SENSORS - 1) { end = app_timer_cnt_get(); // na - get the current ticks after saadc sampling NRF_LOG_INFO("ticks_end = %d \n",end); NRF_LOG_INFO("result time in ticks = %d \n", app_timer_cnt_diff_compute(end, begin)); }
Thanks in advance
Nick