Source routing

When a data collector node needs to communicate with the rest of nodes in the network and not just receive data from them, problems arise. The data collector, and even other nodes, would need enough routing table entries for every node in the network. Or, each node has to discover the route before sending data to the destination.

The maximum number of routing table entries in an XBee module is 40. This means networks containing more than 40 XBee modules could easily become inundated with broadcast route discovery messages.

Source routing allows the collector to store and specify routes for many remotes. The collector remembers the route taken by a message to the data collector so it can be retrieved later to indicate the route of a message from the collector to a certain remote:

  1. The data collector must send periodic many-to-one route request broadcasts, so many-to-one routes to the central collector are created on all remotes.
  2. Every time a remote XBee module transmits data using a many-to-one route, it first sends a route record transmission.
  3. The route record transmission is unicast along the many-to-one route until it reaches the data collector.
  4. As the route record traverses the many-to-one route, each node in the route appends its own 16-bit address into the payload of the route record.
  5. When the route record reaches the data collector, it contains the address of the sender and the 16-bit address of each hop in the route.
  6. The data collector can store the routing information and retrieve it later to send a source routed packet to the remote module.

Note Source routing allows a data collector to route responses back to each device, supplying a many-to-one data request without additional route table entries.

Use source routing

To use source routing:

  1. The data collector must work in API mode.
  2. The collector must send periodic many-to-one route request (AR parameter value must be different from 0xFF).
  3. You need a microcontroller or a PC connected to the data collector to automatically capture and store the routes to the rest of network nodes.

These routes are used when transmitting a message to a remote node.

Note If a Create Source Route API frame (0x21) does not precede data frames, data loss may occur.

XBee modules can buffer one source route that includes up to 30 hops (excluding source and destination).

When source routing is used, the 16-bit addresses in the source route are inserted into the RF payload space. This means the payload will be reduced by two bytes per intermediate hop. The user must account for the payload size reduction when using source routing.