The Thread PER measurement example enables to measure Packet Error Rate (PER) between two nodes. One of the nodes serves as a receiver, the other one as a transmitter. The transmitter node sends UDP packets to the receiver node and, at the end of the test, it collects RX statistics from the receiver node.
Both the transmitter and the receiver indicate their Thread network state on BSP_LED_0. When the device is not connected to the network, the LED blinks at a 100 ms period. Once the device connects to a network, either as a Child or as a Leader, the LED stops blinking and remains turned on. On startup, nodes automatically enter the network with default parameters. The first device that is turned on becomes a Leader of the network, while the other one becomes a Child or a Router.
Once connected to the Thread network, the nodes establish peer IPv6 addresses via a CoAP resource. Having done that, the transmitter node sends a number of UDP packets to the receiver node. The number of test packets and the interval at which they are sent can be configured in per_measure_tranmitter/main.c
by changing the NUMBER_OF_TEST_PACKETS
and TEST_PACKET_SEND_PERIOD
macros.
By default, these numbers are set to 10000 test packets and 5 ms.
TEST_PACKET_SEND_PERIOD
macro to a value smaller than 5 ms results in problems with buffer availability - the application tries to allocate a buffer for a message before the previously used buffer is freed. It is, therefore, not recommended to set interval times lower than 5 ms.At the end of the test, the transmitter node collects test results through a CoAP resource. Four numbers are sent in response:
The test is triggered by pressing BSP_BUTTON_3 on the transmitter node. When the test is finished, its results (listed above) are logged.
The receiver does not require any action to perform the test.
You can find the source code and the makefiles in the following folders:
<InstallFolder>\examples\thread\experimental\testing\packet_error_rate\per_measure_transmitter
<InstallFolder>\examples\thread\experimental\testing\packet_error_rate\per_measure_receiver
To test this example, you need two nRF52840 Development Kits.