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

Throughput (Speed) test of 802.15.4 Radio driver

Hi,

I am a beginner in nRF52840, I am using 802.15.4 example to calculate the speed of 802.15.4 radio driver.

As per nrf_802154_received_timestamp we can get the timestamp when the last symbol of the frame was received (in us).

and nrf_802154_first_symbol_timestamp_get  we can get the timestamp of the beginning of the first preamble symbol of a given frame (in us).

By calculating the timestamp difference can be we calculate the throughput of 802.15.4 radio driver.

I have used the below code in the receiver application to calculate throughput. Please verify it.

void nrf_802154_received_timestamp(uint8_t * p_data, uint8_t   length, int8_t    power, uint8_t   lqi, uint32_t  time)
{
    (void)length;
    (void)power;
    (void)lqi;
    (void)time;

    uint32_t first_symbol_timestamp;
    float time_duration_us;
    float speed_in_kbps;

    first_symbol_timestamp = nrf_802154_first_symbol_timestamp_get(time, length);
    
    NRF_LOG_INFO("time %x   first_symbol_timestamp = %x ", time, first_symbol_timestamp);
    
    time_duration_us = (float)(time - first_symbol_timestamp);
    speed_in_kbps = (float)(((length*8*1000000)/time_duration_us)/1000);
    
    NRF_LOG_INFO("speed_in_kbps = " NRF_LOG_FLOAT_MARKER " kbps\n", NRF_LOG_FLOAT(speed_in_kbps));

    nrf_802154_buffer_free(p_data);
}

  • Hi,

    The functions for timestamps you are using look OK, but they don't really measure throughput though, just calculate the transmission time of a single frame in firmware the same way you will calculate it manually in a notebook.

    Each 802.15.4 frame has the following parts:

    4 bytes of preamble

    1 byte of start frame delimiter

    1 byte of PHY header

    Variable length MAC frame (including CRC)

    The 'lenght' argument in the 'nrf_802154_received_timestamp' function is this variable length MAC frame, but it excludes 2 bytes of CRC.

    To calculate the transmission time you need to add (4+1+1+2)=8 bytes to lenght of a frame. The bitrate of 802.15.4 is 250kbps. which means that one byte is transmitted in 32 microseconds. Transmiting time of a frame containing 16 bytes then is:

    16 bytes of MAC frame + 8 bytes of overhead calculated above = 24 bytes in total

    24 bytes * 32 microseconds/byte = 0.768 ms

    So you will need 0.768 ms to transmit 16 bytes in a MAC frame. The same calculation is the one you are doing above in firmware measuring the timestamps between the frames.

    If you want to measure throughput you need to transmit multiple frames with known payload and catch timings (like timestamps) of multiple frames to calculate total transmission time with an external time source like TIMER peripheral, and use some sort of statistics (simplest one is average).

    Best regards,

    Marjeris

Related