Important: Before you run this example, make sure to program the SoftDevice.
The purpose of the ANT High Duty Search and Background Scanning example is to showcase how to implement a high duty background scanning channel in combination with a master channel on a single device, and how to use extended messages to obtain the RSSI (Received Signal Strength Indication) and channel ID information from the received packets. The example does not utilize any buttons or LEDs.
High duty search is a mode in the ANT protocol that allows slave and background scanning channels to maximize the use of radio time while listening for messages. This allows for extremely low latency pairing times for slave channels, equal to the channel period of the master channel, and a message reception rate for background scanning similar to the continuous scanning mode.
Background scanning channels are a powerful feature of ANT because they allow for asynchronous topologies, while still allowing other channels to run independently on the same device. In this example, the RSSI and channel ID of the messages received on the background scanning channel are copied to the data payload of the master channel, effectively mirroring these parameters back to the transmitting devices. For more details, see the ANT Message Protocol and Usage document, as well as the following application notes: ANT Channel Search and ANT RSSI Extended Information.
As shown in the figures below, this example can work with any number of nodes or it can work with a single development board in conjunction with an ANT USB stick and the ANTware PC application. The instructions in this document describe the second setup. In this example, ANTware will be configured to interface to a single node. A slave channel will be configured in ANTware to track the master channel of the node. A master channel will be opened up in ANTware to match the channel parameters of the background scanning channel.
After a startup or reset, each ANT node will open up two channels - one background scanning and one master channel. Note that the background scanning channel is configured similarly to a regular slave channel with a flag set to denote its special function. Because a background scanning channel is effectively a searching channel that never synchronizes to any master, it is important to set the search time-out appropriately. In this example the search time-out is set to infinity.
Parameter | Master channel | Background scanning channel |
---|---|---|
Channel type | Master (0x10) | Slave(0x00) |
Extended assignment | N/A | EXT_PARAM_ALWAYS_SEARCH (0x01) |
Network key | Public | Public |
RF channel | 77 (2477 MHz) | 77 (2477 MHz) |
Channel period | 2048 (16 Hz) | 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 that indicates the signal strength and channel ID of the last message that was received on the background scanning channel. The format of this message is detailed below.
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 |
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ant\ant_hd_search_and_bs
Note: You can use a custom channel or encryption when running any of the ANT examples. When adding a new channel or encryption, remember to update SoftDevice ANT event handler configuration.
<InstallFolder>\examples\ant\ant_hd_search_and_bs\ant_hd_search_and_bs_test.xml
. Alternatively, you can configure the device channels manually:Note that any number of channels can be configured in ANTware to transmit to the background scanning channel on Node A. Make sure to use a different device number for each of the channels. The background scanning channel will receive messages from these channels asynchronously and report back to the slave channel that is configured in ANTware.