Pairing Module¶
Description¶
The Pairing Module is used by applications to dynamically assign addresses to new nodes wanting to join a network.
Pairing Addressing¶
Default PAN ID and Address¶
At boot, a node is configured with PAN ID 0xBCD and address 0x00. Before a Node can pair with a Coordinator, it must first change its address with the address generation mechanism.
Default Address Generation¶
A default address is internally generated by each node prior to pairing. Such addresses are generated using a CRC16-CITT scheme which uses the 5-byte SPARK transceiver’s unique ID as its seed. The following PAN ID are reserved: 0x000, 0xFFF. The following addresses are reserved: 0x00 and 0xFF. If the Address Generator lands on a reserved address, it starts again using a different seed until a valid address is found.
Pairing Procedure¶
Figure 26: Pairing Procedure Diagram¶
Pairing Request¶
The Pairing Request message is sent by the Coordinator to the Node. First, the Coordinator changes its Source address for the one it generated. It also changes its destination address to the Broadcast address in order to reach any device in Pairing Mode while not knowing their address. It also looks for an available address to assign to the Node and includes it in the payload.
The Coordinator then sends the Pairing Request message continuously until it receives the Node’s response. Upon receiving the Pairing Request message, the Node learns the Coordinator’s PAN ID and address and receives its assigned address. The Node reconfigures its source and destination addresses accordingly. The Node then prepares its Pairing Response message.
Pairing Response¶
The Pairing Response message is sent by the Node to the Coordinator when it receives a Pairing Request message. This message includes the Node role and Unique ID number. Once the Node has sent the Pairing Response message, it waits for the Pairing Confirmation from the Coordinator.
When the Coordinator receives the Pairing Response, it saves the Node address along with its Unique ID in a Paired Device list with the Node Role as its index. It then sends a Pairing Confirmation message.
Pairing Confirmation¶
The Pairing Confirmation message is sent by the Coordinator to the Node to validate that it was added to the Paired Device list. When the Node receives this message and an acknowledgment is sent back to the Coordinator, the Pairing Process is completed. The user application can then start.
Payload Composition¶
Pairing Request Payload Composition¶
Code (0xCAFE) |
Command (PAIRING_REQUEST) |
PAN ID |
Coordinator Address |
Node Address |
|---|---|---|---|---|
0-1 |
2 |
3-4 |
5 |
6 |
Pairing Response Payload Composition¶
Code (0xCAFE) |
Command (PAIRING_RESPONSE) |
Node Role* |
Unique ID* |
|---|---|---|---|
0-1 |
2 |
3 |
4-8 |
*Node Role: The Node’s role used in a Point to Multi Point Pairing application.
*Unique ID: The 5-byte Unique Identification number extracted from the SPARK Radio.
Paired Device List¶
The Paired Device List is an array currently containing up to 10 devices. This number can be changed by the user by modifying the constant PAIRING_DEVICE_LIST_MAX_COUNT. A maximum of 254 Node devices is supported.
It is mainly used for Point to Multi Point Pairing applications. When the Coordinator receives the Node Device Role and Unique ID during the Pairing Response state, it adds it to the Paired Device List.
The Coordinator assigns itself to the index 0 in the array to store its address and Unique ID.
The Coordinator uses the Node Device Role to choose the index in the array when adding it to the Paired Device List. The Node Address is saved along with the Unique ID.
Here is an example of what a Paired Device List might look like in a Gaming Hub application.
Index |
Node Address |
Unique ID |
Note |
|---|---|---|---|
0 |
0x37501 |
0x9834570293 |
Dongle (Coordinator) |
1 |
0x37502 |
0x8794358929 |
Headset (Node) |
2 |
0x37503 |
0x4984753489 |
Mouse (Node) |
3 |
0x37504 |
0x2346987609 |
Keyboard (Node) |
If the Coordinator is reset, the Paired Device List is lost. It is the application responsibility to save it in non-volatile memory (e.g., flash memory) to make it persistent.
Timeout Mechanism¶
When the Pairing Procedure is initiated, a timer starts to limit the Pairing Process to 10 seconds. If the timer expires before the process is completed, the Pairing Procedure is aborted and the nodes are brought back to the Application Mode of operation.
Pairing Module Schedule¶
When entering the Pairing Mode, a special Pairing Schedule is used.
The Pairing Schedule alternates the transmissions between the Coordinator and Node every 500 us while switching on 5 different frequencies.
Figure 27: Pairing Module’s schedule¶
Once the Pairing Procedure is completed and the Application Mode starts, the application’s schedule is re-applied.