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

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

The Broadcast example consists of basic example applications that can be used to test ANT connectivity between a master and a slave.

# Transmitter

The transmitter application transmits a packet four times per second. Each transmission is indicated by BSP_INDICATE_SENT_OK.

Packet layout: {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X}

The last byte of the packet (X) is incremented each time.

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

# Receiver

The receiver application receives a packet four times per second. Each successful transmission is indicated by BSP_INDICATE_RCV_OK.

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

# Tracing CPU load

Both applications allow the user to trace the load of the CPU. Every time when the processor enters sleep state, BSP_LED_0 is turned off. When the processor is woken up by an interrupt (RF or other), BSP_LED_0 is turned on.

nRF5 CPU load (high when sleeping)

# Channel configuration

This example uses the default channel configuration:

Parameter | Transmitter | Receiver
--- | --- | ---
Channel type | Master (0x10) | Slave (0x00)
Network key | Public | Public
RF channel | 66 (2466 MHz) | 66 (2466 MHz)
Device number | 0x02 | 0x00 (Wildcard)
Device type | 0x02 | 0x00 (Wildcard)
Transmission type | 0x01 | 0x00 (Wildcard)
Channel period | 8192 (4 Hz) | 8192 (4 Hz)

# Testing

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.

You can test the Broadcast example in different ways:

- Testing the Broadcast Transmitter with the Broadcast Receiver
- Testing the Broadcast Transmitter using ANTware II
- Testing the Broadcast Receiver using ANTware II

## Testing the Broadcast Transmitter with the Broadcast Receiver

1. Compile and program the Broadcast Transmitter. Observe that the transmitter board indicates BSP_INDICATE_SENT_OK (4 Hz).
2. Compile and program the Broadcast Receiver. Observe that the receiver board indicates BSP_INDICATE_RCV_OK (4 Hz).

## Testing the Broadcast Transmitter using ANTware II

1. Compile and program the Broadcast Transmitter. Observe that the transmitter board indicates BSP_INDICATE_SENT_OK (4 Hz).
2. Run ANTware II. Select your ANT PC dongle (for example, ANTUSB-m) from the available devices. Configure the device channels by loading the device profile configuration from the following file: `<InstallFolder>\examples\ant\ant_broadcast\tx\ant_broadcast_tx_test.xml`. Alternatively, you can configure the device channels manually:
   1. Set the channel assignment to slave.
   2. Set the channel ID to "0, 0, 0".
3. Click the Auto-Open button. Observe that messages describing the received payload appear for each ANT message. These messages should look similar to the following fragment:

       Received BROADCAST_DATA_0x4E
         :: 4e, 00-00-00-00-00-00-00-00-01
       Received BROADCAST_DATA_0x4E
         :: 4e, 00-00-00-00-00-00-00-00-02
       Received BROADCAST_DATA_0x4E
         :: 4e, 00-00-00-00-00-00-00-00-03
       Received BROADCAST_DATA_0x4E
         :: 4e, 00-00-00-00-00-00-00-00-04
       Received BROADCAST_DATA_0x4E
         :: 4e, 00-00-00-00-00-00-00-00-05
       Received BROADCAST_DATA_0x4E
         :: 4e, 00-00-00-00-00-00-00-00-06

## Testing the Broadcast Receiver using ANTware II

1. Compile and program the Broadcast Receiver. Observe that the receiver board indicates BSP_INDICATE_RCV_OK (4 Hz).
2. Run ANTware II. Select your ANT PC dongle (for example, ANTUSB-m) from the available devices. Configure the device channels by loading the device profile configuration from the following file: `<InstallFolder>\examples\ant\ant_broadcast\rx\ant_broadcast_rx_test.xml`. Alternatively, you can configure the device channels manually:
   1. Set the channel assignment to master.
   2. Set the channel ID to "2, 2, 1".
3. Click the Auto-Open button. Observe that the receiver board indicates BSP_INDICATE_RCV_OK (4 Hz).