nRF51 SDK - S210 SoftDevice
|
The ANT Background Scanning Example shows how to implement a background scanning channel in combination with a master channel on a single device. It also demonstrates how to use extended messages to obtain Received Signal Strength Indication (RSSI) and channel ID information from received packets.
Background scanning channels in ANT are searching channels that never synchronize with a master. Instead of acquiring a master, ANT will pass the data to the master and continue searching. These channels allow for asynchronous topologies with other channels running independently on the same device. For more information about background scanning channels and channel parameters, see the ANT Message Protocol and Usage documentation and the ANT Channel Search and Background Scanning Channel application note.
This example uses two channels: one background scanning channel that can receive data from multiple devices and one master channel. The master channel in this example copies the received RSSI and channel ID information and mirrors these parameters back to the transmitting devices.
After startup or reset, each ANT node opens one background scanning channel and one master channel. The background scanning channel is configured similar to a regular slave channel, but with a special flag set to denote its function. The search time-out is set to infinity to ensure that the background scanning channel continues searching for other channels.
The following table lists the ANT channel parameters for the master channel and the background scanning channel (numbers in parentheses denote the parameters that should be used to set the values):
Parameter | Master channel | Background scanning channel |
---|---|---|
Channel type | Master (0x10) | Slave(0x00) |
Extended assignment | EXT_PARAM_ALWAYS_SEARCH (0x01) | N/A |
Network | Public [E8, E4, 21, 3B, 55, 7A, 67, C1] | Public [E8, E4, 21, 3B, 55, 7A, 67, C1] |
Frequency | 2477 MHz | 2477 MHz |
Period | 16 Hz (2048) | N/A |
Device number | Serial number | Wildcard (0) |
Device type | 1 | 1 |
Transmission type | 5 | 5 |
Search time-out (high priority) | N/A | No HP search (0) |
Search time-out (low priority) | N/A | Infinite (255) |
The master channel on each device sends a single payload of data. This payload indicates the signal strength and the channel ID of the last message that was received on the background scanning channel.
The following table shows the message format of the default master message:
Byte | Description |
---|---|
0 | Page number = 1 (ANT_BEACON_PAGE) |
1 | RSSI value (signed dBm value, corresponding to the device number) |
2-3 | Device number of the last message that was received on the background scanning channel (little endian, corresponding to the RSSI value) |
4-5 | Reserved |
6 | Counter that increases with each channel period |
7 | Number of messages that were received on the background scanning channel |
The name of the example for PCA10028 is experimental_ant_background_scanning_pca10028, and for PCA10031 it is experimental_ant_background_scanning_pca10031. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\Nordic\nrf51\examples\ant\experimental\ant_background_scanning
The ANT background scanning example uses a single development board in combination with an nRF51 ANT USB dongle and ANTware II, but it can be adapted to work with any number of nodes. In this example, ANTware II will be configured to use one slave channel to track the master channel of one single device. In addition, a master channel in ANTware II will transmit to the background scanning channel on the device. Note that any number of channels could be configured in ANTware II to transmit to the background scanning channel on the device.
The example does not use any buttons or LEDs.
Test the ANT Background Scanning Example application by performing the following steps:
Start ANTware II and configure the following channels:
The background scanning channel on the device will now receive data from the ANTware II master channel. The master channel on the device will then transmit this data back to the ANTware II slave channel.
Payload | Description |
---|---|
Received BROADCAST_DATA_0x4E :: 4e, 00-01-B6-32-00-00-00-8D-74 | Device number = 50 |
Received BROADCAST_DATA_0x4E :: 4e, 00-01-B6-32-00-00-00-8E-74 | RSSI = -74 dBm (further away) |
Received BROADCAST_DATA_0x4E :: 4e, 00-01-CB-32-00-00-00-8A-0C | RSSI = -53 dBm (closer) |