Home/Support/Support Forum/How to read remote XBee address in a MESH

How to read remote XBee address in a MESH

0 votes
Hi everyone.

Im working on a project and Im using some XBees modules to build a MESH with Arduino. I got 1 Coordinator a some Routers. I did configure them properly with XCTU, same PAN ID, etc. As I would like to work in a MESH, I use the coordinator to send a broadcast to all the routers connected. Im using the NodeDiscovery function (Coordinator) to find out how many devices are found with the same PAN ID, but once I know the number of remote Routers, Is there a way to know the SL number or the addres of every router found in Arduino?

I would like the code to tell me the number of routers found and store their addresses.
Does anyone have a clue?

Im a spanish student, Im sorry about my english at some parts.
Regards.
asked Jan 28 in RF Solutions and XBee by AntonioGR96 New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
Antonio,

If your XBee is in API mode, when you issue the Node Discovery function, part of the data that is reported back is the 64 bit serial number of each node. So you need to look into your code to see why this is not being properly sorted in your code.
answered Jan 28 by mvut Veteran of the Digi Community (12,008 points)
Hi mvut. Thank you ofr your reply.

I think I know waht you say. The 64 bit serial number is reported back with this part of the code:
  request.setCommand(SL);
  sendAtCommand();

But I believe at this part the code reports me the number of found devices:

 while(xbee.readPacket(timeout)) {
    // should be receiving AT command responses
    if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) {
      xbee.getResponse().getAtCommandResponse(response);
      if (response.isOk()) {
        nodeCount++;       
      }
    }
  }

Everytime a node is added, do I have to send SL command again? I tried different ways but got no correct response. I only see the Coordinador address.
I along with Digi does not support Arduino code so I can't be sure on what you have. But what I can tell frm that is that the request.setCommand(SL): would be requesting the radio to report back its Serial number low value.   From what you have showing, I can't tell if you are using API mode or AT command mode.  Either way, when you issue a Node Discovery (ATND), the 64 bit address of each of the nodes that are on your network, is provided in the response to the command.  See https://www.digi.com/resources/documentation/digidocs/90002002/default.htm#Reference/r_cmd_ND.htm?Highlight=Node%20Discovery
Yes, Im using API mode for Coordinator and Routers. Thank you so much, As you say, the 64 bit address is in the response, so I could get the SL from that and store every Router SL somewhere.
...