| 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 Sharing
This example requires the following SoftDevice: S212

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

With standard ANT search, you can search for devices in one network and one radio frequency at a time. For applications that intend to connect to devices on different networks and frequencies, this means that the second slave channel can start searching for a master only after the first slave channel has either acquired a master or timed out its search. Search sharing enables two or more channels to search concurrently on different radio frequencies or networks, by alternating which channel uses the radio for searching.

The purpose of this example is to demonstrate how to use search sharing to perform concurrent searches for two devices transmitting in different radio frequencies. This example also shows how to configure the search waveform to limit the impact on acquisition time from switching between multiple frequencies during search. This example can be paired with ANTware, with two master channels in two different radio frequencies.

After startup, this example will configure and open two slave channels with the following parameters:

Parameter | Slave 0 | Slave 1
--- | --- | ---
Channel type | Slave (0x10) | Slave (0x10)
Extended assignment | 0 | 0
Network | Public | Public
Radio frequency | 50 | 70
Device number | 0 (wildcard) | 0 (wildcard)
Device type | 2 | 3
Transmission type | 1 | 1
Channel period | 8192 (4 Hz) | 8192 (4 Hz)
High priority search timeout | 0 (disabled) | 0 (disabled)
Low priority search timeout | 12 (30 seconds) | 12 (30 seconds)
Search sharing cycles | 1 | 1
Search waveform | ANT_WAVEFORM_FAST | ANT_WAVEFORM_FAST

The high priority search timeout is disabled on both channels to reduce the impact of search on tracking channels. Low priority search timeout is configured to the desired timeout, 30 seconds. Search sharing cycles are set to 1, so that search alternates between the two channels in every search cycle. Finally, to reduce the impact on acquisition time from switching back and forth between the two radio frequencies, the search waveform is configured to the fast waveform.

ANT Search Sharing example topology

# Testing the Search Sharing 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 Sharing 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_sharing\search_sharing_test.xml`. Alternatively, you can configure the device channel manually:
   1. Channel number 0:
      1. Set the channel assignment to master.
      2. Set the channel ID to 1, 2, 1.
      3. On the Basic tab, set radio frequency to 2450 MHz.
      4. Keep the default values for all other settings.
   2. Channel number 1:
      1. Set the channel assignment to master.
      2. Set the channel ID to 2, 3, 1.
      3. On the Basic tab, set radio frequency to 2470 MHz.
      4. Keep the default values for all other settings.
3. On both channels, click Auto-Open.
4. On the development board, BSP_LED_0 will turn on to indicate that master 0 has been acquired, and BSP_LED_1 will turn on when master 1 has been acquired.
5. Close both channels in ANTware.
6. Reset the development board.
7. Click Auto-Open only for channel 1.
8. On the development board, BSP_LED_1 will turn on when master 1 has been acquired. Notice that slave channel 1 can acquire the master channel 1 without having to wait for the search on channel 0 to time out.