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

Occasionally large latency

I have run many tests using the light_switch demo. I have noticed that occasionally the latency is much larger. The latency jump is between sends, i.e. it will send 20 times with avg latency of 100ms then the 21st time it will be 1000ms, then resume to normal. Is this because the board is busy in these instances? I am doing group sending.

N.B. This happens with all configs e.g. different packet sizes, instaburst on/off

My timing code works as follows:

At sending:

static void button_event_handler(...){
    ...
    status = generic_onoff_client_set(&m_clients[1], &set_params, &transition_params);            
    hal_led_pin_set(BSP_LED_1, set_params.on_off);
    tx_timestamp = NRF_RTC0->COUNTER; // tx_timestamp is a global
    ...
}

And receiving:

uint32_t time_calc(uint32_t initial, uint32_t final) {
    uint32_t delta = ((final - initial) * 1000) / 32768;
    return delta;
}

static void app_generic_onoff_client_status_cb(...) {
    ...
    uint32_t ts = tx_timestamp;
    uint32_t rtt = time_calc(ts, NRF_RTC0->COUNTER);
    ...
}

Related