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.

CC2650EM-5XD-RD: z-stack 1.2.2a configuration file priority!

Guru 14820 points
Part Number: CC2650EM-5XD-RD
Other Parts Discussed in Thread: Z-STACK, CC2650

Hello all,

I am using z-stack 1.2.2a sample switch application.

so there are multiple files for setting network configuration.

for ex.- 

1) file - f8wconfig.cfg

-DPOLL_RATE=1000

2) file- znwk_config.h

#define ZNWK_POLL_RATE 2000

so which definition will be used finally and which will be ignored?

  • Basically, it's POLL_RATE in f8wconfig.cfg. No idea why Z-Stack define NWK_POLL_RATE in znwk_config.h but don't use it.

  • Hi,

    This is due to the App/Stack separation (i.e. separate images) of Z-Stack HA 1.2.2a for CC2650. I agree that it is a bit confusing.

    I will base my analysis on SampleSwitch. When the stack thread starts up, POLL_RATE in f8wConfig.cfg is used by default. Then, when the application thread is started up afterwards, you will notice in the Switch_processZStackMsgs() under the case for zstackmsg_CmdIDs_DEV_STATE_CHANGE_IND, when the network state is set to zstack_DevState_DEV_END_DEVICE, i.e. when an end device has successfully joined a Zigbee network, we call this API:

    Switch_setPollRate(ZNWK_POLL_RATE);

    which calls this function: Zstackapi_sysConfigWriteReq()

    If you look at the data type for this Zstackapi call (zstack_sysConfigWriteReq_t), you will see that it contains many different Z-Stack configuration parameters. The reason it exists is because of the App/Stack separation, we can't call APIs like NLME_SetPollRate() directly, so we must use the Zstackapi function instead to set the poll rate from the Application thread.

    So basically, the flow is this:

    Stack thread starts -> default poll rate set to POLL_RATE in f8wConfig.cfg -> app thread starts -> nwk commissioning starts, ZED joins a new network -> application thread receives callback saying that it's Z-Stack device state is zstack_DevState_DEV_END_DEVICE -> poll rate is now updated to ZNWK_POLL_RATE via application API Switch_setPollRate()