Forums - Sending ON/OFF packet trough zb not working

2 posts / 0 new
Last post
Sending ON/OFF packet trough zb not working
ing.matiasalvarez
Join Date: 26 Jun 19
Posts: 2
Posted: Fri, 2019-12-06 06:48

Hello everyone,

I'm developing a zigbee coordinator that sends on/off packets. Instead of sending an on/off packet to an end device when calling qapi_ZB_CL_OnOff_Send_On() it sends a match descriptor request packet as shown in the figure in the next link:

https://subefotos.com/ver/?64f84e4086adfb2aac00ae6dfad8f3f1o.png

The device is a ZB router with ZB 1.2 HA stack. First of all, we open zb network by broadcasting a permit join message. The when we receive a Device announce msg we send an active endpoint request. After receiveing active endpoint response msg we send a simple descriptor request msg for each active endpoint that the device has. After receiveing all the simple descriptor responses we send a bind request on cluster 6(on/off).

Here is a sniffer capture of the zb messages exchanged between the QCA4020 and the on/off device:

https://we.tl/t-BJtlqhmtkF

In the next code snippet is the network configuration I use:

/* The default PAN ID used by the ZigBee demo application. */
#define DEFAULT_ZIGBEE_PAN_ID                         (0xB89B)
/* The default end device time out value. */
#define DEFAULT_END_DEVICE_TIME_OUT                   (0xFF)

/* Channel mask used when forming a network. */
#define FORM_CHANNEL_MASK                             (1 << 11)//(0x07FFF800)

/* Channel mask used when joining a network. */
#define JOIN_CHANNEL_MASK                             (0x07FFF800)

/* The maximum number of registered devices for the demo's device list. */
#define DEV_ID_LIST_SIZE                              (16)

/* The maxium length of an attribute being read and written.          */  
#define MAXIMUM_ATTRIUBTE_LENGTH                      (8)

/* Default ZigBee Link Key used during commissioning. */
#define DEFAULT_ZIGBEE_LINK_KEY                       {'Z', 'i', 'g', 'B', 'e', 'e', 'A', 'l', 'l', 'i', 'a', 'n', 'c', 'e', '0', '9'}

/* Capability falgs used for coordinators. */
#define COORDINATOR_CAPABILITIES                      (QAPI_MAC_CAPABILITY_ALTERNATE_COORD | QAPI_MAC_CAPABILITY_FULL_FUNCTION | QAPI_MAC_CAPABILITY_MAINS_POWER | QAPI_MAC_CAPABILITY_RX_ON_IDLE | QAPI_MAC_CAPABILITY_ALLOCATE_ADDR)    
static const uint16_t serverClusterList[] = {QAPI_ZB_CL_CLUSTER_ID_BASIC, QAPI_ZB_CL_CLUSTER_ID_IDENTIFY};
#define SERVER_CLUSTER_LIST_COUNT           (sizeof(serverClusterList) / sizeof(serverClusterList[0]))

static const uint16_t clientClusterList[] = {QAPI_ZB_CL_CLUSTER_ID_IDENTIFY, QAPI_ZB_CL_CLUSTER_ID_ONOFF, QAPI_ZB_CL_CLUSTER_ID_LEVEL_CONTROL};
#define CLIENT_CLUSTER_LIST_COUNT           (sizeof(clientClusterList) / sizeof(clientClusterList[0]))

static void config_zb(void)
{
    uint8_t                             attrValue = 0;
    qapi_ZB_APS_Add_Endpoint_t          endpointData;
    qapi_ZB_NetworkConfig_t             zbNetworkConfig;

    qapi_ZB_CL_Cluster_Info_t           clusterInfo;

    zbNetworkConfig.ExtendedPanId                   = DEFAULT_ZIGBEE_PAN_ID;
    zbNetworkConfig.StackProfile                    = QAPI_ZB_STACK_PROFILE_PRO_E;
    zbNetworkConfig.Page                            = 0;
    zbNetworkConfig.ChannelMask                     = FORM_CHANNEL_MASK;
    zbNetworkConfig.ScanAttempts                    = 2;
    zbNetworkConfig.Capability                      = COORDINATOR_CAPABILITIES;

    memscpy(&(zbNetworkConfig.Security), sizeof(qapi_ZB_Security_t), &default_ZB_security, sizeof(qapi_ZB_Security_t));


    zbNetworkConfig.Security.Security_Level         = QAPI_ZB_SECURITY_LEVEL_ENC_MIC32_E;
    zbNetworkConfig.Security.Trust_Center_Address   = 0;

    
    if(QAPI_OK != qapi_ZB_Initialize(&zbHandler, zb_event_cbk, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_INIT");
    }

    if(QAPI_OK != qapi_ZB_ZDP_Register_Callback(zbHandler, zb_zdp_event_cbk, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_ZDP_CB");
    }

    if(QAPI_OK != qapi_ZB_Get_Extended_Address(zbHandler, &macZbU64))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_EXT_ADDR");
    }

    if(QAPI_OK != qapi_ZB_BDB_Set_Request(zbHandler, QAPI_ZB_BDB_ATTRIBUTE_ID_BDB_TC_REQUIRE_KEY_EXCHANGE_E, 1, 4, &attrValue))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_BDB");
    }

    endpointData.Endpoint                = 1;
    endpointData.Version                 = 1;
    endpointData.DeviceId                = QAPI_ZB_CL_DEVICE_ID_DEVICE_UNDER_TEST; //Custom Server
    endpointData.OutputClusterCount      = CLIENT_CLUSTER_LIST_COUNT;
    endpointData.OutputClusterList       = clientClusterList;
    endpointData.InputClusterCount       = SERVER_CLUSTER_LIST_COUNT;
    endpointData.InputClusterList        = serverClusterList;
    endpointData.BDBCommissioningGroupId = QAPI_ZB_BDB_COMMISSIONING_DFAULT_GROUP_ID;
    endpointData.BDBCommissioningMode    = QAPI_ZB_BDB_COMMISSIONING_MODE_DEFAULT;

    zclClusterInfo.clusterCnt = 0;

    memset(&clusterInfo, 0, sizeof(qapi_ZB_CL_Cluster_Info_t));
    clusterInfo.Endpoint = 1;
    clusterInfo.AttributeCount = 0;
    clusterInfo.AttributeList = NULL;

    if(QAPI_OK != qapi_ZB_CL_Basic_Create_Client(zbHandler, &(zclClusterInfo.clusterList[zclClusterInfo.clusterCnt++]), &clusterInfo, zcl_basic_client_cb, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_BASIC_CLIENT");
    }

    if(QAPI_OK != qapi_ZB_CL_Identify_Create_Server(zbHandler, &zclClusterInfo.clusterList[zclClusterInfo.clusterCnt++], &clusterInfo, zcl_identify_server_cb, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_IDENT_SERVER");
    }

    if(QAPI_OK != qapi_ZB_CL_Identify_Create_Client(zbHandler, &zclClusterInfo.clusterList[zclClusterInfo.clusterCnt++], &clusterInfo, zcl_identify_client_cb, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_IDENT_CLIENT");
    }

    if(QAPI_OK != qapi_ZB_CL_OnOff_Create_Client(zbHandler, &(zclClusterInfo.clusterList[zclClusterInfo.clusterCnt++]), &clusterInfo, zcl_onoff_client_cb, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_ON_OFF_CLIENT");
    }

    if(QAPI_OK != qapi_ZB_CL_LevelControl_Create_Client(zbHandler, &(zclClusterInfo.clusterList[zclClusterInfo.clusterCnt++]), &clusterInfo, zcl_levelcontrol_client_cb, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_LVL_CTRL_CLIENT");
    }
 
    if(QAPI_OK != qapi_ZB_CL_Register_Callback(zbHandler, zb_cl_event_cb, 0))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_CL_CB");
    }

    if(QAPI_OK != qapi_ZB_APS_Add_Endpoint(zbHandler, &endpointData))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_ADD_EP");
    }

    if(QAPI_OK != qapi_ZB_Form(zbHandler, &zbNetworkConfig))
    {
        PAL_CONSOLE_WRITE_STRING_LITERAL("ERROR_FORM");
    }
}

Any idea what's the problem?

Thanks in advance,

Matias

 

  • Up0
  • Down0
raja_pedada
Profile picture
Join Date: 18 Jun 18
Location: San Jose
Posts: 300
Posted: Thu, 2020-01-16 14:45

Can you confirm if the same behaviour is seen with our QCLI_demo ?

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.