Node Discovery
XBee modules provide some features for discovering and searching nodes. These features added to 802.15.4 allow a node to send a broadcast message to discover other nodes in the network within its coverage.
Structure used in Node Discovery
Discovering nodes is used to discover and report all modules on its current operating channel and PAN ID.
To store the reported information by other nodes, a structure called 'Node' has been created. This structure has the next fields:
MY
: 16-bit Network Address of the reported moduleSH[4]
andSL[4]
: 64-bit MAC Source Address of the reported moduleNI
: Node Identifier of the reported modulePMY
: Parent 16-bit network address. It specifies the 16-bit network address of its parentDT
: Device Type (Not used in 802.15.4)ST
: Status (Reserved)PID
: Profile ID. Profile ID used to application layer addressingMID
: Manufacturer ID. ID set by the manufacturer to identify the moduleRSSI
: RSSI of last hop
To store the found brothers, an array called scannedBrothers
has been created. It is an array of structures Node
. To specify the maximum number of found brothers, it is defined a constant called MAX_BROTHERS
. It is also a variable called totalScannedBrothers
that indicates the number of brothers that have been discovered. Using this variable as index in the scannedBrothers
array, it will be possible to read the information about each node discovered.
Example of use:
Related variables:
Scan network example: https://development.libelium.com/802-13-scan-network/
Searching specific nodes
Another possibility is searching for a specific node. This search is based on using the Node Identifier. The NI of the node to discover is used as the input in the API function responsible of this purpose. This function provides the 16-bit network address of the searched node.
Example of use:
Related variables:
Node search example: https://development.libelium.com/802-14a-node-search-tx/ https://development.libelium.com/802-14b-node-search-rx/
Node discovery to a specific node
When executing a Node Discovery all the nodes respond to it. If its Node Identifier is known, a Node Discovery using its NI as an input can be executed.
Example of use:
Related variables:
Node Discovery Time
It is the amount of time (NT) a node will wait for responses from other nodes when performing a ND. Range: 0x01 - 0xFC [x 100 ms]. Default: 0x19.
Example of use:
Available Information
Node Discover options
Enables node discover self-response on the module.
Example of use:
Available Information
If Node Discovery Time is a long time, the API function may exit before receiving a response, but the module will wait for it, crashing the code. If this time is too short, it is possible the modules don't answer. After testing several times, the best values are between 1-2 seconds, setting the API function appropriately.
Questions related to discovering nodes
While testing, many questions came up about discovering nodes. Now these questions are going to be exposed an explained to help the developer.
• ¿What are the network parameters needed to perform a ND?
After testing a network, PAN ID and channel are needed to perform a ND. If one of these parameters is unknown, when performing a ND no node will response. If security is enabled in a network, the security key will be needed too.
• ¿Is a node obliged to answer a ND? DoS Attack.
Yes, it is obliged to answer. The only way to prevent a network form DoS attack is using encryption, since the attacker will have to know the key to perform the ND.
• ¿What happens when ND is performed using PANID=0xFFFF?
When performing a ND using this PANID no response is received. Broadcast PANID is not as useful as in a broadcast message, since the nodes does not receive any message.
• Node Discover Time. Tests.
By default, this parameter is 0x19 (2.5 seconds). This is a great value, that can be reduced to make the ND process shorter. Tests have demonstrated this value can be reduced up to 0.5 seconds and the nodes still answer.
However, it is recommended not to reduce this parameter so much. When reducing this time, a node may answer after this time, the code crashing.
During this discovery time, the module is waiting for an answer and will not accept any data via serial port, so the API function scanNetwork()
will have to be modified if this parameter is changed. If it is not modified, the API function will exit but the module will be still waiting, making the next functions don't work.
If this discovery time is reduced and a node answers when the module and the API function have exit ND, the next called function will not work because the data sent by the module via serial will correspond with the response of ND.
Last updated