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.

WEBENCH® Tools/CC2652R: ZDP-trans-ID is not ZDP-sequence-number.

Part Number: CC2652R

Tool/software: WEBENCH® Design Tools

ZDP-transID is used to process "AF_DATA_CONFIRM_MSG" of a ZDP-Command-Request. It can protect zigbee-chip from memory overflowing, and make sure command had been really sent.

ZDP-sequence-number is used to match right ZDP-Response-command with sent ZDP-Request-command.

But in zstack, they are a same variable.

  • ZDP_TransID and ZDP_SeqNum should have 2 different variable, because "transID" can be received in "AF_DATA_CONFIRM_CMD"  when a ZDP-Response-Command was sending , but it not equal to "transSeq" of Command-frame. That might disorganize to match "transID" when user program process "AF_DATA_CONFIRM_CMD" of ZDP-Command.

  • Hi Aries,

    From my observation, I don't see the need to split ZDP_TransID into two variables. Consider the following use-case that I reproduced with our latest code (4.10 SDK):

    1. Start a network with 2 nodes (ZED + ZC)

    2. From the sample application, send ZDP IEEE Addr Req from ZED -> ZC using Zstackapi_ZdoIeeeAddrReq(). This tells the stack to call the API ZDP_IEEEAddrReq(), which sends a ZDP IEEE Addr Req from Endpoint 0 on the ZED to Endpoint 0 on the ZC. Let's say ZDP_TransID in this case is 61. If we look at a sniffer log, you can see the value 61 in the field ZDP Transaction Sequence Number within the APS Payload of the command.

    3. On the ZED, after successfully buffering the ZDP IEEE Addr Req at the NWK Layer to eventually be sent over-the-air, we will first increment ZDP_TransID to 62 and then internally send a NLDE_DataCnf() for this packet. This will eventually call the API afDataConfirm(), which sends an AF_DATA_CONFIRM_CMD to the endpoint which originally requested the command. In this case, that would be the ZDO endpoint 0, so the AF_DATA_CONFIRM_CMD event within zd_app.c will receive and process this message.

    4. On the ZED, within ZDApp_ProcessOSALMsg() we will process the case for AF_DATA_CONFIRM_CMD and if you were to place a breakpoint here and view the value of the local variable afDataConfirm->transID, you will see that it is equal to 61. The ZDO layer doesn't need to do anything with this incoming message so it just discards it, but if you wanted you could put another callback function in here to do some further verification. As mentioned above, if you were to compare afDataConfirm->transID to ZDP_TransID at this point, they will not match because ZDP_TransID is incremented immediately after a command is successfully buffered at the NWK layer.

    If you want to verify that a command was sent successfully via your own mechanism, you would need to save another copy of ZDP_TransID into your own structure (array, circular buffer, etc) at the time the command is sent, i.e. within the ZDP API right before calling fillAndSend(), and then create a callback function within the AF_DATA_CONFIRM_CMD case within zd_app.c to match the transaction ID. You shouldn't need to do that though because the stack already does this kind of logic internally. Note that the sample application never receives AF_DATA_CONFIRM_CMD for the ZDP command, it is received by the stack instead since it originates from endpoint 0 and is sent back to endpoint 0 (the internal ZDO endpoint).

    If this does not cover your use case, can you please explain further using a specific example where what I mentioned above fails or has issues? Thanks.

  • If AF_DATA_CONFIRM_CMD of ZDP-Request needs to be processed in application. Some times a node(eg. coordinator) will send ZDP-Request and ZDP-Response at same time. Trans-ID is a handle that is used to mark software processing, but Trans-Sequence is used to mark wireless packets. If coordinator is sending a ZDP-Active-EP to node "A", with its trans ID is "62". At the same time, node "B" is sending "ZDP-Node-Description-Request" to coordinator, and its trans-ID is "62" too。AF_DATA_CONFIRM_CMD is triggered, which message has sent?

  • I have set a callback pointer to process AF_DATA_CONFIRM_CMD of both ZDP-Sending and ZCL-Sending. It is better to help application to send radio frame.

    1, When a ZDP-Request or ZCL-Request is sent, the Response-command needs to be wait. Waiting Response-command needs buffer to remember which command should be received. So to start waiting at AF_DATA_CONFIRM_CMD triggering is better.

    2, Sometimes application is control by other device from UART. The speed of UART controller some times is more fast than zigbee-transmit. So the AF_DATA_CONFIRM_CMD message can be used to tell other device to send slower.