This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Best practice for sending multiple Zigbee cluster commands

Dear community,

we are using nRF52840 (s140) and nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8 to develop a multiprotocol (BLE, ZB) application. Regarding the sending of ZB cluster commands, we use, e.g. (in the case of on/off commands) the macros ZB_ZCL_ON_OFF_SEND_REQ or ZB_ZCL_ON_OFF_SEND_REQ_NO_APS_ACK. Before every sending we allocate the OUT buffer with zb_buf_get_out(). The macros are only executed when the returned OUT buffer is not 0. We noticed that when we want to send those commands to multiple ZB nodes in a for loop (in our case 6 nodes after a specific button action), the buffer is always successfully allocated and the command macros executed. However, when using a ZB sniffer, we noticed that in the case of ZB_ZCL_ON_OFF_SEND_REQ only the 5 first commands are sent (semi)synchronously- the 6th is always sent with a delay of 3 seconds by the ZB stack. In the case of ZB_ZCL_ON_OFF_SEND_REQ_NO_APS_ACK the 6th command is apparently dropped in the ZB stack. Since the OUT buffer is always successfully allocated it is hard to handle the sending in a queue. What would be the best practice in that case? 

Thanks in advance!

Parents
  • Sending the ZCL request commands with a random delay seems to do the trick ;). I.e. using ZB_ZCL_SEND_COMMAND_SHORT_WITHOUT_ACK or ZB_ZCL_SEND_COMMAND_SHORT_SCHEDULE in zb_zcl_commands.h

  • Hi,

    Great to hear that you found a workaround. I will ask our developers why this is happening. Due to Easter I will not be able to get a response from them until early next week.

    Best regards,

    Marte

  • Hi,

    I'm sorry for the delay.

    I have some questions that might help figuring this out. Why are you sending the commands to multiple nodes in a for loop? Is there a reason why are doing it in that way instead of broadcasting the message? If you want to send a message to multiple nodes the best way to do that is by broadcasting the message. If you only want specific devices, such as all light bulbs, to receive the broadcast message you can use the Groups cluster to create a group of these devices and then broadcast the message to that group. This is already implemented in the light control example in nRF5 SDK for T&Z v4.1.0. You can read about testing Zigbee light switch with ZCL groups here. The code itself can be found in the experimental light switch code, examples/zigbee/experimental/light_control/light_switch_groups/.

    If this is not what you're looking for, please clarify why you want to send messages to multiple nodes using a for loop.

    Best regards,

    Marte

Reply
  • Hi,

    I'm sorry for the delay.

    I have some questions that might help figuring this out. Why are you sending the commands to multiple nodes in a for loop? Is there a reason why are doing it in that way instead of broadcasting the message? If you want to send a message to multiple nodes the best way to do that is by broadcasting the message. If you only want specific devices, such as all light bulbs, to receive the broadcast message you can use the Groups cluster to create a group of these devices and then broadcast the message to that group. This is already implemented in the light control example in nRF5 SDK for T&Z v4.1.0. You can read about testing Zigbee light switch with ZCL groups here. The code itself can be found in the experimental light switch code, examples/zigbee/experimental/light_control/light_switch_groups/.

    If this is not what you're looking for, please clarify why you want to send messages to multiple nodes using a for loop.

    Best regards,

    Marte

Children
  • Hi Marte,

    Thanks for the reply!

    Unfortunately broadcasting messages to groups, like in the example you mention, seems not to be working robustly in our case. For example, when we send on/off commands to all members (lights) of a group by toggling a button multiple times, sometimes messages are dropped in the zigbee stack (the send callback is executed correctly though). This can happen for all nodes of a group or a subset. On the other hand, if we address each node with individual messages in a for loop with the random delay macros (as mentioned above) in the same use case, we haven't noticed such problem. We also use a FIFO queue if the OUT buffer is not available (can happen with a higher number of nodes).

  • Hi,

    I am sorry for the delay. The Zigbee team were able to reproduce this issue, and they noticed that when the out buffer was allocated with a call to zb_buf_get_out in a for loop without a delay, then only 5 packets were sent. They suggested using zb_buf_get_out_delayed_ext, which will allocate the buffer as soon as any is free and will use it to send the packet.

    Best regards,

    Marte

Related