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.

random PAN ID selection



Hi all,

We know that when the ZDAPP_CONFIG_PAN_ID value in the f8wConfig.cfg file is 0xFFFF, a random PAN ID is choosen. i want to know, in which function does this random PAN ID generation takes place?

Thanks in advance,

Mahesh KV

  • If I don't rember wrong, the random PANID is generated in ZStack lib and you can't see it. Why do you need to check it?

  • Hi Yikai Chen,

    Thanks for the reply. i was trying to allocate dynamic PAN ID for each network. for that i was trying to see where a random PAN ID is generated.

    But now i got an idea on the implementation of DYNAMIC PAN ID.  i will make the ZDAPP_CONFIG_PAN_ID =0xFFFF. that way it will generate a random PAN ID. now i will use the compile option NV_RESTORE to store the network parameters. now if the configuration will remain same, even after power reset.

    Is this OK to do this?  my requirement is to allocate a unique PAN ID to each home network. and dont want to do it at compile time. and want to do it at run time.

    Thanks in advance,

    Mahesh KV

  • Do you use ZNP? You can do what you want with it. The following paragraphs are from CC2530ZNP Interface Specification.pdf and you can assign PAN_ID when you start a zigbee network.

    3.2  CC2530-ZNP startup procedure
    After executing the power-up procedure, the host processor must call some mandatory APIs
    before executing any APIs that invoke ZigBee over-the-air messaging. Not following this
    sequence could result in unexpected behaviour. The recommended startup procedure is as
    follows:
    1.  The host processor must use the ZB_WRITE_CONFIGURATION command to configure
    at the minimum the ZCD_NV_LOGICAL_TYPE, ZCD_NV_PAN_ID, and
    ZCD_NV_CHANLIST configuration items.
    2.  If the Simple API is used, the ZB_APP_REGISTER_REQUEST command should be sent
    by the host processor to register the application endpoint.
    3.  The ZB_START_REQUEST command should be sent by the host processor to either
    form a network (if the device is a coordinator) or join a network (if the device is a router or
    end device).
    4.  The host processor should then wait for the ZB_START_CONFIRM command with a
    status of ZB_SUCCESS before performing any other API operations.
    5.  If the Simple API is not used after performing step 1, the AF_REGISTER command
    should be sent by the host processor to register the application endpoint.
    6.  The ZDO_STARTUP_FROM_APP command should be sent by the host processor to
    either form a network (if the device is a coordinator) or join a network (if the device is a
    router or end device).
    7.  The host processor should then wait for the ZDO_STATE_CHANGE_IND command with
    a status of DEV_ZB_COORD, DEV_ROUTER, or DEV_END_DEVICE before performing
    any other API operations

  • Hi Yikai Chen,

    thanks for the reply. but we are not using ZNP.

    Regards,

    Mahesh KV

  • I would suggest you to have a look at ZNP source code and do it by yourself accordingly.