Send a source routed transmission
To send a source routed transmission, the application must send a Create Source Route - 0x21 to the XBee 3 Zigbee RF Module to create a source route in its internal source route table. After sending the Create Source Route frame, the application can send data transmission or remote command request frames as needed to the same destination, or any destination in the source route. Once data must be sent to a new destination (a destination not included in the last source route), the application must first send a new Create Source Route - 0x21.
Note If a Create Source Route API frame does not precede the data frames, you may encounter data loss.
The XBee 3 Zigbee RF Module can buffer one source route that includes up to 11 hops (excluding source and destination). For example, suppose a network exists with a coordinator and 5 routers (R1, R2, R3, R4, R5) with known source routes as shown in the following image.
To send a source-routed packet to R3, the application sends a Create Source Route API frame (0x21) to the XBee, with a destination of R3, and 2 hops (R1 and R2). If the 64- bit address of R3 is 0x0013A200 404a1234 and the 16-bit addresses of R1, R2, and R3 are:
Device | 16-bit address |
---|---|
R1 | 0xAABB |
R2 | 0xCCDD |
R3 | 0xEEFF |
The Create Source Route API frame would be:
7E 0012 21 00 0013A200 404A1234 EEFF 00 02 CCDD AABB 5C
Field composition
0x0012 | length |
0x21 | API ID (create source route) |
0x00 | frame ID (set to 0 always) |
0x0013A200 404A1234 | 64-bit address of R3 (destination) |
0xEEFF | 16-bit address of R3 (destination) |
0x00 | Route options (set to 0) |
0x02 | Number of intermediate devices in the source route |
0xCCDD | Address of furthest device (1-hop from target) |
0xAABB | Address of next-closer device |
0x5C | Checksum (0xFF - SUM (all bytes after length)) |