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
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.
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_search_uplink\ant_search_uplink_test.xml
. Alternatively, you can configure the device channel manually: