Dear,I need to scan the PAN_ID with a router to form a list of PANs in the area. Then I need to choose one PAN to join and send some packets to an application. If no one answer the packets, it means that it is not my PAN, so I need to disconnect and connect in another PAN of my list, until achieve the correct PAN.This problem has a solution?
Basically, what I want to know is:1- How to make a list of PAN_IDs in the area from a ROUTER;2-How to LEAVE the current PAN;3-How to force a ROUTER to joing in a determinated PAN.
Thank youGiordano
Hi,
Question 1: There is no way to make such a list. I think this is due to security concern.
Question 2: You can use ZDP_MgmtLeaveReq() to leave current PAN.
Question 3: No, you can not force a router or device to join a specified PAN.
Regards!
YK Chen
Hi YK Chen, so there is a other way to jump from a PAN to other without a LIST of PANs. Imagine there is an area with 2 coordinators, PAN1 and PAN2. I could try the PAN 1, if it is not my PAN, I leave this PAN to try PAN 2. To do this I need to know:
1) Is possible to forbid my router to join in a determined PAN? (example: if there is PAN1 and PAN2 and I forbid my router to join in PAN1, it will join in PAN2)
Thanks for your attentionGiordano
Hi YiKai Chen,
the answer on question 3 is incorrect - it is possible to force a router to join specified PAN. The details are given in Z-stack Developer Guide, for example.
To solve the task defined in question 1 Mgmt_NWK_Disc_req ZDO command can be used.
Regards,
Ilya
Hi Ilya,
It is nice to hear that Zstack has this capability. Could you specify more clearly about which developer guide describe it? Do you have a try on it and worked well? By the way, I also can not find any thing about where and how Mgmt_NWK_Disc_req to be used. Could you describe it too?
Sincerely
YK
Hi YK,
I meant Z-stack Developer's Guide swra176. It claims (9.2 Configuring the PAN ID and Network to join):
...This is an optional configuration item to control which network a ZigBee Router or End Device will join. The ZDO_CONFIG_PAN_ID parameter in f8wConfig.cfg can be set to a value (between 0 and 0xFFFE). A coordinator will use this value as the PANId of the network that it starts. A router or end-device will only join a network that has a PANId configured in this parameter. To turn this feature off, set the parameter to a value of 0xFFFF...
I've tried this option and it does work.
Regarding Mgmt_NWK_Disc_req, it is introduced in ZigBee Specification and aka ZDP_MgmtNwkDiscReq() in Z-stack API document. I'm not sure whether it returns direct information about the 'short' (2-byte) PAN IDs but it should return information about the 64-bit extended PAN identifier of the discovered networks.
It is a hard code way to use ZDO_CONFIG_PAN_ID parameter in f8wConfig.cfg but we are interested in joined a specified PAN_ID at run time. Anyway, thanks for your information.
Hi YK Chen,
actually, this parameter is just an item stored in NV memory. You can change it any time you want. Of course, the device reset with clearing of the previous network state must be performed to apply new value.
Hi Chen YiKai,
I confirm the router can join a specified PAN_ID at run time. I modified two attribute of the NIB. Success! Following code:
_NIB.nwkPanId = panId;_NIB.nwkLogicalChannel = channelId;
NLME_UpdateNV(0x01); SystemReset();
Chen Di
Yes, it works in this way. However, my problem is how we could know all the PAN_ID in the environment and decide which one to join? My original thought is that we can assign the IEEE address of a specified end device or router to coordinator and let coordinator to allow the ED/router to join its network when this device is doing becon. But, I could not get this though workable on Zstack.
could you clarify your task?
If I understood correctly, you have several ED/routers and several coordinators in the same area and the ED/router should join the network with certain PAN ID. What is the criterion assumed? What type of solution is supposed - ZEC-based or ZER/ZED-based? Does an ED/router have a predefined list of possible PAN IDs?
Dear Ilya,
For example, I have two coordinator and 5 end device. If I want 3 of 5 EDs (no.1~no.3) to join coordinator 1 and 2 of 5 EDs (no.4 and No.5 to join coordinator 2. I prefer to assign IEEE address of No.1~No.3 EDs to coordinator 1 and IEEE address of No.4 and No.5 EDs to coordinator 2. So, the 5 EDs will join the related coordinators without specifying PAN_ID from end device sides. Do you have any suggestion how to approach this?
Dear YK Chen,
first of all, let assume that a ZED can change its PAN ID at runtime.
At the initial stage of deployment you can start all ZEDs with 0xFFFF PAN ID. This means they will join any network they come across. On the ZC side it will be known what ZED joins and what is its IEEE address. So, the final stage is to send a command (custom defined) from the ZC to the ZED with PAN ID it should apply. To start with the new PAN ID, the ZED should restart with the clearing of previous network state. Of course, the channel list should be set correctly.
Yes, I am using similar approach in my system. I just wonder that if it is possible not allowed ED to join a coordinator except you have add its IEEE address to coordinator. Otherwise, I always need to reset ED to have it to look for a new network to join.
Hi Ilya,YK Chen and Di Chen,I am trying to do a LIST of PAN_IDs with the command:ZDP_MgmtNwkDiscReq( (zAddrType_t*)&dstAddr,0x00100000,BEACON_ORDER_1_SECOND,0,0);When the answer is available, the event "case Mgmt_NWK_Disc_rsp" is risen by the osal:I treat this event in this waymgmtNwkDiscItem_t pans[10]; //global array of pansvoid ZDApp_ProcessMsgCBs( zdoIncomingMsg_t *inMsg ){ switch ( inMsg->clusterID ) { case Mgmt_NWK_Disc_rsp: { ZDO_MgmNwkDiscRsp_t *MgmNwkDiscRsp = NULL; int8 rightpan = -1; MgmNwkDiscRsp = ZDO_ParseMgmNwkDiscRsp(inMsg); for(char i = 0;i<10;i++) { pans[i] = MgmNwkDiscRsp->list[i]; } ...Then, I leave the current PAN with the command:NLME_LeaveReq_t leavereq;leavereq.extAddr = null;//aExtendedAddress; leavereq.removeChildren = true;leavereq.rejoin = true;leavereq.silent = false;NLME_LeaveReq( (NLME_LeaveReq_t*)&leavereq );And I try another PAN from the array of PANs with the command:
NLME_JoinRequest( MgmNwkDiscRsp->list[i].extendedPANID,MgmNwkDiscRsp->list[i].PANId,0x14,0x06,0,10);It is not working because:1) The array of pans doesn't have the PAN_ID (16bits), only the extended_PAN_ID (8bytes);2) I dont know the meaning of the last two arguments of the command NLME_JoinRequest;3) Disassembling the code of NLME_JoinRequest, I saw that some variable could be writen in non volatile memory if we use correctly the functions (may be the new PAN_ID to join), but my way of use of this function is wrong. But in this case the method shown by Di Chen appear to work.Giordano
Is possible to get the PAN_ID if I have the EXTENDED PAN_ID?