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.

Connection Priority schedule

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.

Table 11: Connection Description

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

Coordinator User Interface

  • The SW3 switch is used to toggle ON or OFF the data generation on CID0. Data generation is enabled by default.

Table 12: Coordinator User Interface Description

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.

Table 13: Coordinator User Interface Description

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

Table 14: Node User Interface Description

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.

Table 15: Node User Interface Description

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.

Connection Priority Serial Interface Output

Figure 14: Connection Priority Serial Interface Output (from left: Coordinator & Node).

See Wireless Core API - Statistics for more details.