nRF51 SDK - S210 SoftDevice
|
The ANT Auto Shared Channels Example shows how to use ANT Auto Shared Channels (ASC) to create extensible low power ANT networks.
This example application demonstrates how to interconnect two ASC masters ("hubs"), allowing for a multi-node network that relays commands and status information between hubs, peripherals, and remote control devices such as phones. The example can be extended to support more than two hubs.
Remote control devices can be phones or PCs. These devices can connect over ANT or, if SoftDevice S310 is used, over BLE. If ANT is used, multiple remote control devices can connect to any of the hubs. If BLE is used, only a single remote control device can connect to a hub at a time. An ANT remote and BLE remote can run concurrently if required.
On reset or power-up, each hub goes into DISCOVERY state (for a maximum of 20 seconds) and starts searching for nearby hubs to connect to. This process uses relative proximity. Therefore, hubs must be brought close to each other to be discovered. A connection is made by establishing a single ANT channel between the hubs. The hub with the higher device number (for example, 0x4E20) becomes the master of the connection. The hub with the lower device number (for example, 0x04D2) becomes the slave. The device number of the newly established channel will be a combination of the device numbers of the two hubs, with the LSB of the master hub's device number (20 in the example) becoming the MSB and the LSB of the slave hub's device number (D2 in the example) becoming the LSB of the new channel. The device number of the new channel would then be 0x20D2, for example.
The Auto Shared Channel capability allows each hub to assign a unique shared channel address to a peripheral device when it is added to the network. See the application note ANT Auto Shared Channel for information about the basic handshaking procedure. This example application can be configured to support single-byte or two-byte shared channel addressing. By default, single-byte addressing is used, which allows up to 253 peripheral devices to be connected to a single ASC master endpoint.
Peripheral devices automatically register with the hub after power-up. However, they must be brought into close proximity of the hub because relative proximity is used in the pairing process.
When the connections are established and hubs are in CONNECTED state, commands that are received over the ANT or BLE remote channels are relayed to the destination hub or peripherals. With this mechanism, any node in the network can be controlled from a single remote control device, like a phone, over the remote interface channel.
The following table (Table 1) lists the ANT channel parameters for the remote interface channel (numbers in parentheses denote the parameters that should be used to set the values):
Parameter | Remote control interface channel |
---|---|
Channel type | Master (0x10) |
Extended assignment | N/A |
Network | Public [E8, E4, 21, 3B, 55, 7A, 67, C1] |
Frequency | 2466 MHz |
Period | 4 Hz (8192) |
Device number | Serial number |
Device type | 3 |
Transmission type | 5 |
See ANT Message Protocol and Usage for detailed information about shared channels and other channel parameters.
The remote control interface channel on the hub sends status information to the remote control and can also accept commands to control the state of each of the peripherals. The hub can also forward commands to other hubs as appropriate depending on the destination hub that is stated in the command.
The following table (Table 2) shows the message format of the device availability status message that the hub sends to the remote control:
Byte | Description |
---|---|
0 | Page number = 2 (DEVICE_AVAILABILITY_PID) |
1-2 | Device number of the connected neighbor hub (little endian) |
3-7 | Reserved (set to 0xFF) |
The following table (Table 3) shows the message format of the peripheral status message that the hub sends to the remote control:
Byte | Description |
---|---|
0 | Page number = 3 (UPDATE_DATA_PID) |
1 | Shared address of the peripheral to which the message pertains (1-253) |
2 | Reserved (set to 0xFF) |
3-4 | Device number of the hub that sends the message (little endian) |
5-6 | Reserved (set to 0xFF) |
7 | Peripheral state: 0 = OFF 1 = ON |
The following table (Table 4) shows the message format of the state command message that an ANT remote control sends to the hub to control one of the peripheral devices:
Byte | Description |
---|---|
0 | Page number = 4 (UPDATE_DATA_PID) |
1 | Shared address of the peripheral to which the command is addressed (1-253) |
2 | Reserved (set to 0xFF) |
3-4 | Device number of the hub to which the command is sent (little endian) |
5 | Bits 0-3: Reserved (0) Bits 4-7: Group (0-15) |
6 | Reserved (set to 0xFF) |
7 | Command: 0 = OFF 1 = ON 2 = Assign to group 3 = Assign to additional group 4 = Assign to all groups 5 = Clear from group 6 = Clear from all groups 7 = Reporting mode off 8 = Reporting mode on (default) |
The names for the example are experimental_ant_shared_channel_master_to_master_s310_pca10028, experimental_ant_shared_channel_slave_s210_pca10028, and experimental_ant_shared_channel_slave_s210_pca10031. If you are not using Keil to work with the SDK, you can find the source code and project file of the example in the following folder: <InstallFolder>\Nordic\nrf51\examples\ant\experimental\ant_shared_channel
The ANT Auto Shared Channels Example requires at least four development boards: two hubs with one assigned peripheral per hub. Up to 253 peripheral devices can be added to each hub if required.
The example does not use any buttons. It uses the following LEDs:
A computer is used as remote control to connect to the hubs over ANT and BLE. For testing the ANT connection, an ANT USB dongle and ANTware II are required.
Connect the devices by performing the following steps:
Test the ANT remote control connection of the ANT Auto Shared Channels Example application by performing the following steps: