This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to obtain data of PANID and CHANNEL that are being used.

Other Parts Discussed in Thread: Z-STACK, CC2530

Hi,

 

I am new to Ti Z-Stack.  I start of writing a simple application:

1.  I set ZCD_NV_PANID to be 0xFFFF, which means dynamically create a PANID.

2.  I set ZCD_NV_CHANLIST to include all channels, which means I want the device to scan all channels to find the best one.

3.  I set ZCD_NV_APS_USE_EXT_PANID to be a valid extended id.

4.  I set ZCD_NV_LOGICAL_TYPE to be coordinator to start the network.

5.  I start the network by calling zb_StartRequest()

6.  Network is started successfully and zb_StartConfirm is called.

Now my question is how can I find out what PANID that the network is using and which Channel it is on??

Thanks

John

  • Hi John,

    Try to check zgConfigPANID, zgApsUseExtendedPANID, and zgDefaultChannelList after your ZB network is composed.

    Regards!

    YK Chen

  • Hi,

    In zb_StartConfirm() function, I checked those values: zgConfigPANID, zgApsUseExtendedPANID, and zgDefaultChannelList.  They are the same values as what I set to NV.

    For example, zgConfigPANID is 0xFFFF, and zgDefaultChannelList is 0x7FFF800.  They do not tell me what channel and PANID the device picks for the network...

    Did I check them in the wrong function? 

    I need to know after CC2530 successfully starts the network, what channel and PANID it picks...

    Please help!

    Thanks

    John

  • Hi John,

    You should check it after you receive ZDO_STATE_CHANGE and ( (XXX_NwkState == DEV_ZB_COORD) || (XXX_NwkState == DEV_ROUTER) || (XXX_NwkState == DEV_END_DEVICE) ) inside zclXXX_event_loop(), which should be located in your zcl_XXX.c.

    Regards!

    YK Chen

  • Hi YK,

    That is what I did.  My application is based on Sensor Demo applicaton.  zb_StartConfirm() is called when ZDO_STATE_CHANGE and iif(pMsg->status == DEV_END_DEVICE || pMsg->status == DEV_ROUTER || pMsg->status == DEV_ZB_COORD ) is TRUE. 

    As I mentioned, in zb_StartConfirm() I check zgConfigPANID, zgApsUseExtendedPANID, and zgDefaultChannelList.  And they are the same value as what I initially set.  They do not have the values to indicate which PANID and channel is picked by the stack...

    However, I did find out that global variable _NIB contains the correct information.  But I wonder should I directly check _NIB structure in zb_StartConfirm()???  And I cannot find any code that modifies the variable, but it does get updated....  Wonder where is the code that updates the variable???

    In addition, ZCD_NV_NIB does not contain all the data of _NIB, wonder why is that???

    Thanks

    John 

  • Hi John,

    Yes, you can read these information from _NIB. By the way, ZCD_NV_NIB only stores the short address of device and I also have no idea why TI only stores short address.

    Regards!

    YK Chen

  • Actually I am still confused...

    After the network is started, does "nwkLogicalChannel" in _NIB have the value that is the channel picked by Z-Stack?

    What is "channelList" in _NIB?  After the network is started, why does it have a different value (i.e. 0x00300000) than the one I saved to ZCD_NV_CHANLIST (i.e. 0x07FFF800)?

  • Can anybody help?

  • ZMAC to the rescue and Hi, Ho Silver, Away!


    #include "ZMAC.h"
    #include "zmac_internal.h"


      uint8 currChannel;
     
      (void)ZMacGetReq(ZMacChannel, &currChannel);

  • Hi Harry,

    Thanks for your help!  It works!!!  Now I can continue explore ZigBee using CC2530!

    One more question:  I can not find that API in any document (i.e. Z-Stack API reference only has two ZMac API listed ).  Is there a document that will list and explain all ZMac APIs?

    Thanks again! 

    John