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 17: Connection Priority Application’s Schedule.

Pairing

On boot, devices attempt to pair automatically. If unsuccessful, manual pairing can be performed afterward to use the application.

Auto Pairing:
  • On boot, devices automatically start the pairing process. RGB blinks blue twice to indicate that pairing is in progress.

  • If the pairing procedure is unsuccessful, RGB blinks red twice after 10 seconds.

  • Once successfully paired, RGB turns magenta, and the devices begin exchanging application data.

Manual Pairing:
  • Press the SW1 button on both devices to start the pairing procedure; RGB blinks blue twice when doing so.

  • If the pairing procedure is unsuccessful, RGB blinks red twice after 10 seconds.

  • Once successfully paired, RGB turns magenta, and the devices begin exchanging application data.

Unpairing:
  • When paired, pressing the SW1 button again unpairs the device; RGB blinks red twice to indicate that unpairing has been completed.

  • 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.

Note

LED behavior changes in pairing mode versus normal execution mode. During pairing mode, LEDs indicate pairing status as described below. Once paired, LEDs indicate packet transmission and reception and fallback mode status.

Auto Pairing:
  • On boot, devices automatically start the pairing process. LED0 blinks twice to indicate the pairing is in progress.

  • If the pairing procedure is unsuccessful, all LEDs blink twice after 10 seconds.

  • Once successfully paired, LEDs turn on sequentially, then turn off, and the devices begin exchanging application data.

Manual Pairing:
  • Press and hold the SW1 button on both devices for 3 seconds to start the pairing procedure; LED0 blinks twice when doing so.

  • If the pairing procedure is unsuccessful, all LEDs blink twice after 10 seconds.

  • Once successfully paired, LEDs turn on sequenstially, then turn off, and the devices begin exchanging application data.

Unpairing:
  • When paired, press and hold the SW1 button for 3 seconds to unpair the device; All LEDs blink twice to indicate that unpairing has been completed.

  • 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 13: 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 14: Coordinator User Interface Description

Interface

Name

Description

SW1

Pairing Process

Pair, unpair, or abort the pairing process 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

Transmission Occurence

Toggle LED when a wireless transmission occurs.

LED2

Reception Success

Toggle LED when a wireless reception is successful.

LED3

N/A

N/A

LED4

N/A

N/A

RGB

Pairing Event

Indicate pairing event as described in the pairing section.

Table 15: Coordinator User Interface Description

Interface

Name

Description

SW1

Pairing Process

Press and hold for 3 seconds: Pair, unpair, or abort the pairing process depending on the current state.

Reset Stats

Press for less than 250 ms: Reset the TX and RX statistics.

SW2

CID0 Toggle

Press and hold for 3 seconds: Enable/Disable data generation on CID0.

LED0

Transmission Occurence

Toggle LED when a wireless transmission occurs.

LED1

Reception Success

Toggle LED when a wireless reception is successful.

LED2

N/A

N/A

Node User Interface

Table 16: Node User Interface Description

Interface

Name

Description

SW1

Pairing Process

Pair, unpair, or abort the pairing process 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

Transmission Occurence

Toggle LED when a wireless transmission occurs.

LED2

Reception Success

Toggle LED when a wireless reception is successful.

LED3

N/A

N/A

LED4

N/A

N/A

RGB

Pairing Event

Indicate pairing event as described in the pairing section.

Table 17: Node User Interface Description

Interface

Name

Description

SW1

Pairing Process

Press and hold for 3 seconds: Pair, unpair, or abort the pairing process depending on the current state.

Reset Stats

Press for less than 250 ms: Reset the TX and RX statistics.

SW2

LED0

Transmission Occurence

Toggle LED when a wireless transmission occurs.

LED1

Reception Success

Toggle LED when a wireless reception is successful.

LED2

N/A

N/A

Certification

This application has the ability to run in Certification Mode.

When certification mode is active, a dedicated LED is activated to indicate that the mode is enabled. All activity status LEDs (transmission, reception, fallback, and payload) are suppressed so that only the certification indicator is visible.

Table 18: Certification Mode Indicator

Board

Indicator

Quasar

RGB LED steady yellow.

EVK1.4

Steady LED2.

Different certification modes are required for the Coordinator and Node since there is 5 connections total. Each connection must be have the highest priority on each certification mode.

Table 19: Certification Mode Activation for the Coordinator

Certification Mode

Activation Process

Connection ID 0 Certification

Hold SW2 at startup until the LED 1 blinks once, then release.

Connection ID 1 Certification

Hold SW2 at startup until the LED 1 blinks twice, then release.

Connection ID 2 Certification

Hold SW2 at startup until the LED 1 blinks three times, then release.

Table 20: Certification Mode Activation for the Node

Certification Mode

Activation Process

Connection ID 3 Certification

Hold SW2 at startup until the LED 1 blinks once, then release.

Connection ID 4 Certification

Hold SW2 at startup until the LED 1 blinks twice, then release.

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 18: Connection Priority Serial Interface Output (from left: Coordinator & Node).

See Wireless Core API - Statistics for more details.