How to Get Packet Error Rate (PER) In BLE Regulation Test

Packet Error Rate (PER) in BLE regulation test

In the CE Receiver Blocking test case, the tested module will need to run in DTM mode and also have PER less or equal to 10%. With classic BT, this can be handled by test equipment which connects to the target device running in test mode. However, with BLE running in a Linux platform, the support will be limited. This document provides instructions on how to calculate PER on a Linux platform.

Requirements

  • Two test beds run in Linux (iMX8MP EVK in this document)
  • Two RF modules (TI351 in this document)
  • PC with console port
  • Optional: Spectrum to verify RF signal has been sent out

Yocto Integration: Build Environment Setup

To build the image with drivers and firmware, refer to the Software Integration Guide for you module. For this example, we’re using the Sona TI351 drivers and firmware and load it into an iMX8MP EVK board.
https://www.ezurio.com/documentation/software-integration-guide-sona-ti351

Make sure the following packages have been added:

IMAGE_INSTALL:append = "
		      bluez5 \
		      packagegroup-tools-bluetooth \
			"

System Setup

After system boot up, you’ll need to disable the Wi-Fi interface and enable BLE as follows.

"ifconfig wlan0 down"
"echo "1" > /sys/kernel/debug/ieee80211/cc33xx/ble_enable"

You may use hciconfig to bring up the hci0 interface:

root@imx8mp-lpddr4-evk:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: EC:9A:34:19:B3:FE ACL MTU: 255:10 SCO MTU: 0:0
DOWN
RX bytes:276 acl:0 sco:0 events:22 errors:0
TX bytes:121 acl:0 sco:0 commands:22 errors:0
root@imx8mp-lpddr4-evk:~# hciconfig hci0 up

DTM (direct test mode) setup

Always run the reset command before running direct test mode. To support the hcitool command, the bluez5 package needs to be integrated into the image.

Reset

$ hcitool -i hci0 cmd 0x03 0x03

You’ll need to make sure the following is returned.

HCI Command: ogf 0x03, ocf 0x0003, plen 0
HCI Event: 0x0e plen 4
01 03 0C 00

The following are the HCI commands to support BLE DTM mode.

Version 1: (Only supports 1M PHY)

HCI_LE_Transmitter_Test

$ hcitool -i hci0 cmd 0x08  0x001e [TX_Channel] [Length of Payload] [Payload Pattern]
  • TX Channel: The radio channel to use (ranges from 0x00 to 0x27).
  • Length of Payload: The number of bytes in each payload packet.
  • Payload Pattern: The type of pattern to transmit

    • 0x0: PRBS9
    • 0x1: 11110000
    • 0x2: 10101010
    • 0x3: PRBS15
    • 0x4: 11111111
    • 0x5: 00000000
    • 0x6: 00001111
    • 0x7: 01010101

Example: Send PRBS9 format of packets with payload length 37 in channel 1

$ hcitool -i hci0 cmd 0x08 0x1e 0x1 0x25 0x0

You’ll need to make sure the following is returned.

HCI Command: ogf 0x08, ocf 0x001e, plen 3
01 25 00
HCI Event: 0x0e plen 4
01 1E 20 00

HCI_LE_Receiver_Test

$ hcitool -i hci0 cmd 0x08  0x001e [RX Channel]
  • RX Channel: The radio channel to receive (ranges from 0x00 to 0x27).

For example: receive packets in channel 1

$ hcitool -i hci0 cmd 0x08 0x 1d 0x1

You’ll need to make sure the following is returned.

HCI Command: ogf 0x08, ocf 0x01e , plen 1
01
HCI Event: 0x0e plen 4
01 1e 20 00

HCI_LE_Test_End

End the test state either in HCI_LE_Transmitter_Test or HCI_LE_Receiver_Test.

If ending HCI_LE_Receiver_Test state, it will show the packet count that has been received in the last two byte (little endian).

There is no packet count number when ending HCI_LE_Transmitter_Test, and will be 00 00 in the last two bytes.

$ hcitool -i hci0 cmd 0x08  0x001f

You’ll need to make sure the following is returned.

HCI Command: ogf 0x08, ocf 0x001f, plen 0
HCI Event: 0x0e plen 6
01 1F 20 00 34 12

This indicates that during this period, it received 0x1234 (4660) packets.

Version 2:

HCI_LE_Transmitter_Test [v2]

$ hcitool -i hci0 cmd 0x08  0x0034 [TX_Channel] [Length of Payload] [Payload Pattern] [PHY Rate]
  • TX Channel: The radio channel to use (ranges from 0x00 to 0x27).
  • Length of Payload: The number of bytes in each payload packet.
  • Payload Pattern: The type of pattern to transmit

    • PHY Rate: PHY setting
    • 0x01: 1M PHY
    • 0x02: 2M PHY
    • 0x03: 125k Coded PHY
    • 0x04: 500k Coded PHY

For example: send PRBS9 format of packets with payload length 37 in channel 1 with 125k PHY rate

$ hcitool -i hci0 cmd 0x08 0x34 0x1 0x25 0x0 0x3

You’ll need to make sure the following is returned.

HCI Command: ogf 0x08, ocf 0x0034, plen 4
01 25 00 03
HCI Event: 0x0e plen 4
01 34 20 00

HCI_LE_Receiver_Test [v2]

$ hcitool -i hci0 cmd 0x08  0x0033 [RX_Channel] [PHY Rate]
  • RX Channel: The radio channel to use (ranges from 0x00 to 0x27).
  • PHY Rate: PHY setting

    • 0x01: 1M PHY
    • 0x02: 2M PHY
    • 0x03: 125k Coded PHY
    • 0x04: 500k Coded PHY

For example: receive packets in channel 1 with 125k PHY rate

$ hcitool -i hci0 cmd 0x08 0x33 0x1 0x3

Need to make sure get the return as below.

HCI Command: ogf 0x08, ocf 0x0033, plen 2
01 03
HCI Event: 0x0e plen 4
01 33 20 00

To end HCI_LE_Transmitter_Test [v2] or HCI_LE_Receiver_Test [v2], still use the HCI_LE_Test_End command.

PER count

To count PER, need to know how many packets has sent and how many has received.
With HCI_LE_tranmitter_Test (either v1 or v2) command, doesn't support packet count information.
To decide how many packets send, this can be estimated by math as below.

In Bluetooth Low Energy (BLE) Direct Test Mode (DTM), a device configured in the LE Coded PHY mode at 125 kbps (S=8) with a 37-byte payload transmits 266.67 packets per second.

  1. On-Air Packet Duration (L)
    The LE Coded S=8 packet consists of the following components:
    • Preamble: 80 symbols = 80 µs
    • FEC Block 1 (Access Address + Coding Indicator + TERM1): 37 bits × 8 symbols/bit = 296 µs
    • FEC Block 2 (PDU + CRC + TERM2):

      • PDU = 2 bytes Header + 37 bytes Payload = 39 bytes (312 bits)
      • CRC = 3 bytes (24 bits)
      • TERM2 = 3 bits
      • Total bits in Block 2 = 339 bits × 8 symbols/bit = 2,712 µs
  • Total Packet Length (L)=80+296+2,712=3,088μs
  1. DTM Packet Interval Formula (I(L))
    The spec dictates that subsequent packets must start at a quantized interval calculated as:
    𝐼(𝐿)=[(𝐿+249)/625]×625𝜇𝑠
    Plugging in L = 3,088 μs:
    𝐼(𝐿)=[(3088+249)/625]×625𝜇s= [5.5339]625us = 6625us = 3750us
  2. Packets Transmitted Per Second
    To find the total number of packets sent every second, divide 1 second (1,000,000 µs) by the packet interval:
    TX = 1,000,000/3,750 =266.67 packet/s

If you run with 37 bytes with 1M PHY, the packet number will be 1600 packet/s.

As RX, you can count the period of time "t" in between HCI_LE_Receiver_Test ([v2]) and HCI_LE_Test_End, so by the return of packet number "n" in HCI_LE_Test_End, you will be able to count how many packets per second have been received.
RX = n/t

With these two pieces of information, you can count:

PER=(TX-RX)/TX