Connection Priority
Description
The Connection Priority application demonstrates the utilization of the SPARK Wireless Core in scenarios where multiple connections compete for limited network resources by assigning priorities. The packet exchange is halted until both devices are paired. Once successfully paired, the devices start exchanging packets. This application uses a bidirectional communication between a Coordinator and a Node, showcasing how five connections with varying priorities share link capacity.
Behavior
The Connection Priority application’s schedule consists of two timeslots. The first timeslot is used by the Coordinator’s 3 TX connections to transmit to the Node. The second timeslot is used by the Node’s 2 TX connections to transmit to the Coordinator. A transmitted payload always contains the ID of the connection by which it was sent.
Application Schedule
The following diagram illustrates the general structure of the schedule used in this application.
Figure 13: Connection Priority Application’s Schedule.
Pairing
By default, devices are unpaired at boot. To use the application, start by pairing the devices.
- Pairing:
Press the SW1 button on both devices to start the pairing procedure; RGB should blink blue twice when doing so.
If the pairing procedure is unsuccessful after 10 seconds, the pairing process stops and the RGB should blink red twice.
Once the pairing procedure is successfully completed, the RGB turns magenta and the devices can start exchanging application data.
- Unpairing:
When paired, pressing the SW1 button again unpairs the device; the RGB should blink red twice to indicate the unpairing procedure is in progress.
Unpairing causes the devices to forget their learned addresses. The devices are no longer able to exchange application data.
To start a new pairing procedure, both devSerial Interface Output (from left: Coordinator & Node)
- Pairing:
Press the SW1 button on both devices to start the pairing procedure; LED0 should blink twice when doing so.
If the pairing procedure is unsuccessful after 10 seconds, the pairing process stops and all the LEDs blink twice.
Once the pairing procedure is successfully completed, the LEDs will cascade and the devices can start exchanging application data.
- Unpairing:
When paired, pressing the SW1 button again unpairs the device; All LEDs should blink twice to indicate the unpairing procedure is in progress.
Unpairing causes the devices to forget their learned addresses. The devices are no longer able to exchange application data.
To start a new pairing procedure, both devices must be unpaired first.
Data exchange
Both devices transmit different types of payloads at varying generation rates, each destined for different TX connections. The variation in payload generation rates serves to illustrate the impact of connection priority on the packet transmission order.
Connection ID |
Timeslot |
Coordinator mode |
Node mode |
Payload size (bytes) |
Payload rate (pps) |
Priority |
|---|---|---|---|---|---|---|
CID0 |
0 |
TX |
RX |
15 |
500 |
High |
CID1 |
0 |
TX |
RX |
8 |
400 |
Medium |
CID2 |
0 |
TX |
RX |
15 |
500 |
Low |
CID3 |
1 |
RX |
TX |
15 |
750 |
High |
CID4 |
1 |
RX |
TX |
8 |
200 |
Medium |
Link Capacity Utilization
The connection with the highest priority can always transmit its data, while the lower priority connections will only transmit data when the higher ones do not require the airtime.
The link capacity for each direction is 1000 packets per seconds (pps). CID0 and CID1 together utilize 90% of the available link capacity, allowing them to transmit 100% of their data. CID2, being the lowest priority, can only utilize the remaining 10% of the link capacity, resulting in a transmission limit of 100 pps. Since CID2 has a payload rate of 500 pps, which is half of the link capacity, 80% of CID2’s payloads will be dropped due to higher priority connections.
In this application, the Coordinator switch SW1 toggles ON or OFF the data generation on CID0. When CID0 is turned OFF, no frame gets enqueued in the high priority connection, thus freeing bandwidth for other connection. The low priority connections, CID1 and CID2, can then transmit at their full rate.
Connections using the second timeslot will be able to transmit at their full rate. CID3, with the highest priority, requires 75% of the link capacity, leaving 25% for CID4. However, since CID4 requires only 20% of the link capacity to achieve full packet rate, there will be a 5% portion of the link that remains unused. Consequently, no packet transmission will be observed for 5% of the timeslot occurences.
Coordinator User Interface
The SW3 switch is used to toggle ON or OFF the data generation on CID0. Data generation is enabled by default.
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing Process |
Pair or unpair the device depending on the current state. |
SW2 |
Reset Stats |
Reset the TX and RX statistics. |
SW3 |
CID0 Toggle |
Enable/Disable data generation on CID0. |
SW4 |
N/A |
N/A |
LED1 |
N/A |
N/A |
LED2 |
N/A |
N/A |
LED3 |
N/A |
N/A |
LED4 |
N/A |
N/A |
RGB |
Pairing Event |
Indicate pairing event as described in the pairing section. |
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing Process |
Pair or unpair the device depending on the current state. |
SW2 |
Reset Stats |
Reset the TX and RX statistics. |
LED0 |
N/A |
N/A |
LED1 |
N/A |
N/A |
LED2 |
N/A |
N/A |
Node User Interface
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing Process |
Pair or unpair the device depending on the current state. |
SW2 |
Reset Stats |
Reset the TX and RX statistics. |
SW3 |
N/A |
N/A |
SW4 |
N/A |
N/A |
LED1 |
N/A |
N/A |
LED2 |
N/A |
N/A |
LED3 |
N/A |
N/A |
LED4 |
N/A |
N/A |
RGB |
Pairing Event |
Indicate pairing event as described in the pairing section. |
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing Process |
Pair or unpair the device depending on the current state. |
SW2 |
Reset Stats |
Reset the TX and RX statistics. |
LED0 |
N/A |
N/A |
LED1 |
N/A |
N/A |
LED2 |
N/A |
N/A |
Terminal
The following figure shows the terminal output of this application.
See Viewing the Terminal for details on how to view the terminal output.
Figure 14: Connection Priority Serial Interface Output (from left: Coordinator & Node).
See Wireless Core API - Statistics for more details.