| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT Search Uplink
This example requires the following SoftDevice: S212

Important: Before you run this example, make sure to program the SoftDevice.

Search uplink messaging, that is available in some ANT devices such as nRF52, allows sending messages on a channel while it is searching. On a standard slave channel, this feature allows sending a message to a device as soon as it is synchronized, in this way reducing the latency for that first message transmission. Background scanning channels enable many-to-one topologies where a single receiver can receive data from multiple devices over a single channel without synchronizing to them by performing a continuous search operation, and can support bidirectional communication on parts that include the search uplink feature.

You can find the source code and the project file of the example in the following folder: `<InstallFolder>\examples\ant\ant_search_uplink`

Search Uplink topology

After startup, this example will configure and open an ANT master channel with the following channel parameters.

Parameter | Value
--- | ---
Channel type | Slave (0x00)
Extended assignment | EXT_PARAM_ALWAYS_SEARCH
Network | Public
Radio frequency | 66
Device number | 0
Device type | 2
Transmission type | 1

No messages will be transmitted by default. Pressing BSP_BUTTON_0 will start sending uplink messages to any devices matching the Device Type and Transmission Type from the table above, regardless of their Device Number. Pressing BSP_BUTTON_1 will send a single uplink message to the first device discovered after pressing the button. Messages from other devices will stop being received until the message is transmitted. BSP_LED_0 will toggle every time a message is received by the background scanning channel, while BSP_LED_1 will toggle every time an uplink message is transmitted. The format of the message transmitted is as follows:

Bytes | Description
--- | ---
0-6 | Reserved (0xFF)
7 | Sequence number

A sequence number is used to differentiate between transmitted messages.

# Testing the Search Uplink example using ANTware II

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 ANT stack configuration.

1. Compile and program the Search Uplink example.
2. Run ANTware II. From the available devices, select your ANT PC dongle (for example, ANTUSB-m). Configure the device channel by loading the device profile configuration from the following file: `<InstallFolder>\examples\ant\ant_search_uplink\ant_search_uplink_test.xml`. Alternatively, you can configure the device channel manually:
   1. On channel number 0:
      1. Set the channel assignment to master.
      2. Set the channel ID to 1, 2, 1.
      3. Keep the default values for all other settings.
   2. On channel number 1:
      1. Set the channel assignment to master.
      2. Set the channel ID to 2, 2, 1.
      3. Keep the default values for all other settings.
3. Click Auto-Open on both channels.
4. As messages are received on the background scanning channel, the development board will toggle BSP_LED_0.
5. Press BSP_BUTTON_1 on the development board. ANTware will show a single received broadcast message on either Channel 0 or Channel 1. BSP_LED_1 will turn on to indicate that the message has been transmitted.
6. Press BSP_BUTTON_0 on the development board. ANTware will show received broadcast messages with an increasing sequence number on both Channel 0 and Channel 1. BSP_LED_1 will toggle on the development board as uplink messages are transmitted.