nRF51 SDK - S210 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Experimental: Background Scanning

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.

Description

Background scanning channels in ANT are searching channels that never synchronize with a master. They 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 other 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.

ant_background_scanning.svg
Background scanning and transmitting on master with two nodes

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)

Message format

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

Setup

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\examples\ant\experimental\ant_background_scanning

The ANT background scanning example uses a single development board in combination with an 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.

ant_background_scanning_setup.svg
Setup of the ANT Background scanning example

The example runs on any nRF51 ANT capable device. It does not use any buttons or LEDs.

Testing

Test the ANT Background Scanning Example application by performing the following steps:

  1. Compile and program the application and toggle the power or reset the board. The background scanning channel and the master channel will start right away.
  2. Ensure that an ANT USB dongle is connected to the computer.
  3. Start ANTware II and configure the following channels:

    • A slave channel with device number 0. Configure the channel according to the information for the master channel as shown in the table above, but configure it to be a slave channel.
    • A master channel with a device number other than 0. Configure the channel according to the information for the master channel as shown in the table above.

    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.

  4. In ANTware II, check the message payload that is received on the slave channel. The reported device number (byte 2 and 3) is the channel ID that you configured for the master channel. The reported RSSI value (byte 1) changes when the board is moved closer or further away from the ANT USB dongle. For example:
    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)
  5. You can configure more master channels in ANTware II. Each channel must use a different device number. The background scanning channel on the device will receive messages from all channels asynchronously and report the received data back to the slave channel.