I have been trying to measure the PER between two nRF52840 DKs using BLE. To do so, I am using BLE Direct Test Mode to start a transmission on a 52840 DK and another development kit to listen for the broadcast and count the packages. The BLE DTM standard does not incorporate the possibility to count the number of sent packets on the transmitter side, so I am trying to calculate a theoretical amount of sent packages using the formula supplied by "BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 6, Part F page 3063".
To get to the packet length in bits i use the formula:
pdu_payload_len=$(( packet_len_l6 + packet_len_higher * 16 )) # in bits phy_packet_len=$(( pdu_payload_len + 8 + 8 + 32 + 24 + 8 * phy_bandwidth )) # in bits #echo "$phy_packet_len" phy_packet_dur=$(echo "scale=0; $phy_packet_len / $phy_bandwidth" | bc) #in µs #echo "$phy_packet_dur" transmit_interval_dur=$(( ((phy_packet_dur + 249 + 624) / 625) * 625 )) ##echo "transmit_interval_dur: $transmit_interval_dur" PER=$(echo "scale=2; 100 - ($packet_count * $transmit_interval_dur) / ($delta * 10000)" | bc) #in %