Datalink
Description
The datalink application presents a standard and basic usage of the SPARK Wireless Core. This is a good starting point for anyone wanting to configure wireless communication using the Wireless Core. This application creates a synchronized unidirectional link between 2 devices to send data after a successful pairing.
Behavior
In this example, wireless communication is halted until both devices are paired. Once successfully paired, the Coordinator transmits random data, which incorporates a sequence number and a Cyclic redundancy check (CRC). The Node will verify that the sequence number and CRC are valid.
Application Schedule
The following diagram illustrates the general structure of the schedule used in this application.
Figure 22: Datalink 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 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.
- 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.
Coordinator User Interface
LED1 toggles every time a packet is successfully transmitted to the Node (almost always on because of the high packet rate).
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 |
Transmission Success |
Toggle LED when a wireless transmission is successful. |
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 |
Transmission Success |
Toggle LED when a wireless transmission is successful. |
LED1 |
N/A |
N/A |
LED2 |
N/A |
N/A |
Node User Interface
LED2 toggles every time a packet is successfully received from the Coordinator (almost always on because of the high packet rate).
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 |
Reception Success |
Toggle LED when a wireless reception is successful and the data is valid. |
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 |
Reception Success |
Toggle LED when a wireless reception is successful and the data is valid. |
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 23: Datalink Serial Interface Output (from left: Coordinator & Node).
See Wireless Core API - Statistics for more details.