Audio Unidirectional
Description
The Audio Unidirectional application uses the SPARK Wireless Core to transmit a stereo audio stream with 48kHz/24-bit depth from the line-in connector of the Coordinator to the headphone connector of the Node. When the link quality degrades, it will automatically switch into fallback mode which involves an audio stream with 48kHz/16-bit depth instead. The audio stream will revert to 24-bit depth once the link quality returns to normal.
Behavior
The application receives audio from the line in of the Coordinator, utilizes the audio codec to transmit and receives over the I2S line using DMA transfers, and outputs the audio to the headphone out of the Node.
In addition to transmitting a unidirectional audio link, the application allows for the transmission of various data such as the status of a button and the link margin. The link margin makes it possible for the Coordinator to track the quality of the connection, thereby switching between fallback and normal modes as needed.
The wireless schedule allocates 49 timeslots for the audio transmissions and 1 timeslot for the data transmissions. The schedule is designed to reserve more bandwidth for transmitting audio stream instead of data. When the Node acknowleges the data transmissions, the reply also includes the data to be transmitted from the Node to the Coordinator.
In the UWB frequency range, the wireless core alternates between 5 different frequency bands at each transmission.
Application Schedule
The following diagram illustrates the general structure of the schedule used in this application.
Figure 15: Audio Unidirectional 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.
Fallback
The Coordinator continuously monitors the link quality. If the link quality degrades, the system will enter fallback mode. If the signal quality remains strong for 5 seconds and the CCA try count stays below a defined threshold, the system will revert to normal mode. The thresholds for entering and exiting fallback mode differ, creating hysteresis to prevent the system from toggling frequently in conditions of marginal signal quality.
Clock Drift Compensation (CDC)
Clock Drift Compensation (CDC) is used to adjust the timing difference between the two devices. The Coordinator is the reference clock. Therefore, for the stereo audio stream, the Node can use its internal PLL (when hardware allows) to adjust its clock frequency to the Coordinator’s. For more information regarding CDC, refer to Clock Drift Compensation.
Coordinator User Interface
The Coordinator user interfaces includes LEDs, RGB and button switches.
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing process |
Pair or unpair the device depending on the current state. |
SW2 |
Button activity |
Toggles the LED state of the remote device. |
SW3 |
N/A |
N/A |
SW4 |
N/A |
N/A |
LED1 |
Transmission success |
Toggles every time an audio packet is successfully transmitted. |
LED2 |
N/A |
N/A |
LED3 |
Fallback status |
LED is OFF in Normal mode and ON in Fallback mode. |
LED4 |
Button state |
Toggles upon receiving button state. |
RGB |
Pairing Event |
Indicate pairing event as described in the pairing section. |
Note
LEDs assigned to transmission or reception status are almost always on because of the high packet rate.
Audio volume can be adjusted by the Node, allowing to decrease or increase the sound it receives. This control is managed through the SW3 and SW4 buttons.
The Coordinator user interfaces includes LEDs and button switches.
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing process |
Pair or unpair the device depending on the current state. |
SW2 |
Button activity |
Toggles the LED state of the remote device. |
LED0 |
Audio transfers success |
Toggles every time an audio packet is successfully transmitted or received. |
LED1 |
Fallback status |
LED is off in Normal mode and on in Fallback mode. |
LED2 |
Button state |
Toggles upon receiving button state. |
Note
LEDs assigned to transmission or reception status are almost always on because of the high packet rate.
Audio volume cannot be adjusted using this hardware as only two buttons are available.
Node User Interface
The Node user interfaces includes LEDs, RGB and button switches.
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing process |
Pair or unpair the device depending on the current state. |
SW2 |
Button activity |
Toggles the LED state of the remote device. |
SW3 |
Volume up |
Raises the received audio volume (default at 100%). |
SW4 |
Volume down |
Lowers the received audio volume. |
LED1 |
N/A |
N/A |
LED2 |
Reception success |
Toggles every time an audio packet is successfully received. |
LED3 |
Fallback status |
LED is OFF in Normal mode and ON in Fallback mode. |
LED4 |
Button state |
Toggles upon receiving button state. |
RGB |
Pairing Event |
Indicate pairing event as described in the pairing section. |
Note
LEDs assigned to transmission or reception status are almost always on because of the high packet rate.
The Node user interfaces includes LEDs and button switches.
Interface |
Name |
Description |
|---|---|---|
SW1 |
Pairing process |
Pair or unpair the device depending on the current state. |
SW2 |
Button activity |
Toggles the LED state of the remote device. |
LED0 |
Audio transmission success |
Toggles every time an audio packet is successfully transmitted or received. |
LED1 |
Fallback status |
LED is off in Normal mode and on in Fallback mode. |
LED2 |
Button state |
Toggles upon receiving button state. |
Note
LEDs assigned to transmission or reception status are almost always on because of the high packet rate.
Audio volume cannot be adjusted using this hardware as only two buttons are available.
Certification
This application has the ability to run in Certification mode.
Different levels of certification are required on the Coordinator to test the fallback modes. Depending of which mode is requested, the max_payload_size of the audio connection will be changed. For the Node, only one mode is necessary.
Certification Mode |
Activation Process |
|---|---|
24-bit Audio |
Hold SW2 at startup until the LED 1 blinks once, then release. |
16-bit Audio |
Hold SW2 at startup until the LED 1 blinks twice, then release. |
Certification Mode |
Activation Process |
|---|---|
Control Data |
Press and hold SW2 at startup. LED 1 will blink once to confirm the selected certification mode. |
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 16: Audio Unidirectional Serial Interface Output (from left: Coordinator & Node).
See Audio Core API - Statistics and Wireless Core API - Statistics for more details.