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.

CC2530: user defined Cluser (with command) in ZStack 3.0.2 on CC2530

Part Number: CC2530


hello all,

i am programming with IAR 10 and  ZStack 3.0.2 on CC2530. In GenericApp example project. I created an user cluster and command (cmd Server received).

After connection between coordinator and end device is set up,   the cluster ("ZCL_CLUSTER_LIGHT_ON_OFF" and command "CMD_TOGGLE") can be sent by end device and received by coordinator successfully.   However my cluster (command) can not be received by coordinator (even no comming message on coordinator triggered). However, "zcl-SendCmd" returned "Z_SUCESS" on end device.

     Has anyone encountered a similar problem and how to solve it ?


thanx in advance for help.

wei
  • Hello Wei,

    Have you used a sniffer device to see whether the message is sent over-the-air?  Are you able to share your custom Zigbee cluster implementation and zclSendCmd syntax?  Please ensure that the proper endpoints with supported clusters are used on both devices.  Below are some relevant E2E threads:

    https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/759125 
    https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/707353 
    https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/765190 
    https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/679655 
    https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/870940

    Regards,
    Ryan

  • To add on what Ryan's suggestions, I also like to suggest you to check if you use correct source and destination endpoint with correct cluster.

  • Ryan and Yikai,

    thank you for your reply. Based on your sugestion, i checked again. The endpoints on both end device , coordinator are correct set. The user defined cluster and command is not captured by sniffer (no over-the-air message catched).

    I past some pieces of my code as below :

    ->End device Side:
      in file "zcl_genericapp_data.c", I have following code:
              const cId_t zclGenericApp_OutClusterList[] =
              {
                ZCL_CLUSTER_ID_GEN_BASIC,
     
                  // GENERICAPP_TODO: Add application specific Output Clusters Here.
                  //       See zcl.h for Cluster ID definitions
                  ZCL_CLUSTER_ID_GEN_ON_OFF,
                  ZCL_CLUSTER_ID_H2_CMD001,
                };
       in file "zcl_genericapp.c", I have following code:
                //Send toggle every 500ms
                if( events & SAMPLESW_TOGGLE_TEST_EVT )
               {
                    HalUARTWrite(0,"sending command toggle \n",24);
                    //working
                    //ZStatus_t s = zclGeneral_SendOnOff_CmdToggle( GENERICAPP_ENDPOINT, &zclSampleH2_DstAddr, FALSE, 0 );
                    //not working
                    ZStatus_t s = zclGeneral_SendH2Cmd_001( GENERICAPP_ENDPOINT, &zclSampleH2_DstAddr, FALSE, 0 );
                    // return unprocessed events
                    return (events ^ SAMPLESW_TOGGLE_TEST_EVT);
               }
         where "zclGeneral_SendH2Cmd_001" is defined as following in "zcl_general.h".
        
         #define zclGeneral_SendH2Cmd_001(a,b,c,d) zcl_SendCommand( (a), (b), ZCL_CLUSTER_ID_H2_CMD001, COMMAND_H2_CMD001, TRUE, ZCL_FRAME_CLIENT_SERVER_DIR, (c), 0, (d), 0, NULL )
        
         The ZCL_CLUSTER_ID_H2_CMD001 and COMMAND_H2_CMD001 are customer defined in "zcl.h" and "zcl_general.h".
        
        
    ->Coordinator Side:
     in file "zcl_genericapp_data.c", I have following code:
     
     
            const cId_t zclGenericApp_InClusterList[] =
            {
                    ZCL_CLUSTER_ID_GEN_BASIC,
                    ZCL_CLUSTER_ID_GEN_IDENTIFY,
     
                    // GENERICAPP_TODO: Add application specific Input Clusters Here.
                    //       See zcl.h for Cluster ID definitions
                    ZCL_CLUSTER_ID_GEN_ON_OFF,
                    ZCL_CLUSTER_ID_H2_CMD001
            };
            where "ZCL_CLUSTER_ID_H2_CMD001" is my cluster.
            ...
            CONST zclAttrRec_t zclGenericApp_Attrs[] =
            { ...
            
               {
                ZCL_CLUSTER_ID_H2_CMD001,
                {  // Attribute record
                    ATTRID_H2_CMD001,
                    ZCL_DATATYPE_BOOLEAN,
                    ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE,
                    (void *)&zclSampleUser_H2_Cmd001
                }
            }
            where "zclSampleUser_H2_Cmd001" is my callback to handle my command "COMMAND_H2_CMD001".
     in file "zcl_genericapp.c", I have following code:

            static zclGeneral_AppCallbacks_t zclGenericApp_CmdCallbacks =
            {
              zclGenericApp_BasicResetCB,             // Basic Cluster Reset command
              NULL,                                   // Identify Trigger Effect command
              zclSampleLight_H2_OnOffCB,              // On/Off cluster commands
              NULL,                                   // On/Off cluster enhanced command Off with Effect
              NULL,                                   // On/Off cluster enhanced command On with Recall Global Scene
              NULL,                                   // On/Off cluster enhanced command On with Timed Off
            #ifdef ZCL_LEVEL_CTRL
              NULL,                                   // Level Control Move to Level command
              NULL,                                   // Level Control Move command
              NULL,                                   // Level Control Step command
              NULL,                                   // Level Control Stop command
            #endif
            #ifdef ZCL_GROUPS
              NULL,                                   // Group Response commands
            #endif
            #ifdef ZCL_SCENES
              NULL,                                  // Scene Store Request command
              NULL,                                  // Scene Recall Request command
              NULL,                                  // Scene Response command
            #endif
            #ifdef ZCL_ALARMS
              NULL,                                  // Alarm (Response) commands
            #endif
            #ifdef SE_UK_EXT
              NULL,                                  // Get Event Log command
              NULL,                                  // Publish Event Log command
            #endif
              NULL,                                  // RSSI Location command
              NULL,                                  // RSSI Location Response command
              zclSampleUser_H2_Cmd001                //H-2 technik: user defined commnad 001
            };
        in this file, my command handler is implemented.

    in file "zcl_general.h", I modified structure as following:
        typedef struct
        {
          zclGCB_BasicReset_t               pfnBasicReset;                // Basic Cluster Reset command
          zclGCB_IdentifyTriggerEffect_t    pfnIdentifyTriggerEffect;     // Identify Trigger Effect command
          zclGCB_OnOff_t                    pfnOnOff;                     // On/Off cluster commands
          zclGCB_OnOff_OffWithEffect_t      pfnOnOff_OffWithEffect;       // On/Off cluster enhanced command Off with Effect
          zclGCB_OnOff_OnWithRecallGlobalScene_t  pfnOnOff_OnWithRecallGlobalScene;  // On/Off cluster enhanced command On with Recall Global Scene
          zclGCB_OnOff_OnWithTimedOff_t     pfnOnOff_OnWithTimedOff;      // On/Off cluster enhanced command On with Timed Off
        #ifdef ZCL_LEVEL_CTRL
          zclGCB_LevelControlMoveToLevel_t  pfnLevelControlMoveToLevel;   // Level Control Move to Level command
          zclGCB_LevelControlMove_t         pfnLevelControlMove;          // Level Control Move command
          zclGCB_LevelControlStep_t         pfnLevelControlStep;          // Level Control Step command
          zclGCB_LevelControlStop_t         pfnLevelControlStop;          // Level Control Stop command
        #endif
        #ifdef ZCL_GROUPS
          zclGCB_GroupRsp_t                 pfnGroupRsp;                  // Group Response commands
        #endif
        #ifdef ZCL_SCENES
          zclGCB_SceneStoreReq_t            pfnSceneStoreReq;             // Scene Store Request command
          zclGCB_SceneRecallReq_t           pfnSceneRecallReq;            // Scene Recall Request command
          zclGCB_SceneRsp_t                 pfnSceneRsp;                  // Scene Response command
        #endif
        #ifdef ZCL_ALARMS
          zclGCB_Alarm_t                    pfnAlarm;                     // Alarm (Response) commands
        #endif
        #ifdef SE_UK_EXT
          zclGCB_GetEventLog_t              pfnGetEventLog;               // Get Event Log command
          zclGCB_PublishEventLog_t          pfnPublishEventLog;           // Publish Event Log command
        #endif
          zclGCB_Location_t                 pfnLocation;                  // RSSI Location command
          zclGCB_LocationRsp_t              pfnLocationRsp;               // RSSI Location Response command
          
          zclGCB_H2Cmd001_t                 pfnH2Cmd001;                  //H-2 Technik: command 001
        } zclGeneral_AppCallbacks_t;
                        
        where     "zclGCB_H2Cmd001_t" is defined as "typedef void (*zclGCB_H2Cmd001_t)( uint8 cmd )"
                    
                   

  • What is inside your zclSampleH2_DstAddr?

  • hi, yikai,

    on end device side, "zclSampleH2_DstAddr" is set with following values:

    void zclGenericApp_Init( byte task_id )
    {
     
      zclGenericApp_TaskID = task_id;
     
      zclSampleH2_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
      zclSampleH2_DstAddr.endPoint = GENERICAPP_ENDPOINT;          
      zclSampleH2_DstAddr.addr.shortAddr = 0;  //coordinator

    .....

    my clused is defined in file "zcl.h"

    #define ZCL_CLUSTER_ID_H2_CMD001                            0x0018 

  • If you use AddrNotPresent, you have to do binding. Do you do binding?

  • yikai,

    in init function of end device,  i called

     bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING | BDB_COMMISSIONING_MODE_FINDING_BINDING);         
           

    in init function of coordinator, i called:

     bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_FORMATION|BDB_COMMISSIONING_MODE_FINDING_BINDING);

  • I am not sure that would do binding to your custom cluster correctly. I would suggest you to send binding request for your custom cluster.

  • I agree with YK that a bind is most likely not formed on the ZED, therefore you should manually create one or use direct addressing.

    Regards,
    Ryan

  • hello, Ryan and Yikai,

    i tested another cluster (ZCL_CLUSTER_ID_GEN_ON_OFF) and command (COMMAND_ON). It works well (using packet sniffer, the short addr is assigned by cocordinator). Can it prove that the connection (binding) is O.K. ? Do you know if there are any limitation to the max number of clusters ?

    Wei

     

  • No, it only proves ON/OFF cluster is bind successfully. Different cluster need separate binding.

  • You application has most likely not surpassed NWK_MAX_BINDING_ENTRIES and there is no defined maximum number of clusters supported per endpoint.  Each node is limited to less than 255 endpoints but this is also not a concern for your purposes.  You can refer to the Zigbee Fundamentals SLA for an example of the manual binding process, although note that the code cannot be copied directly due to the difference of device architecture.

    Regards,
    Ryan