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: ZCL Reporting Atrributes

Part Number: CC2530


Hi Guys,

I´m working to implement the message report attribute according to ZCL foundation, using the "push" method attribute reporting, the devices themselves send reports when the attribute changes. In my case, I using the ZCL_CLUSTER_ID_GEN_ON_OFF, but when I check the message sent by device, over the air,  I saw that has malformed ZCL parameters. It can be seen on PIC attached.

I have configured in my APP file the parameters as you can see below:

/*********************************************************************
 * GLOBAL VARIABLES
 */
zclReportCmd_t rptcmd;

Init was configured in the ZCL cluster parameters:
//reporting attributes configuration

rptcmd.numAttr = 1;

rptcmd.attrList[0].attrID = ATTRID_ON_OFF; // Attribute ID of OnOff included in the Cluster Gen On/Off is 0 (ZigBee Cluster Library spec)

rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;

rptcmd.attrList[0].attrData = (uint8*)&zclTTa0003_OnOff;


ZCL Reporting CMD was inclued in My APP OnOffCB:
static void zclTTa0003_OnOffCB( uint8 cmd )
{
  afIncomingMSGPacket_t *pPtr = zcl_getRawAFMsg();

  zclTTa0003_DstAddr.addr.shortAddr = pPtr->srcAddr.addr.shortAddr;


  // Turn on the light
  if ( cmd == COMMAND_ON )
  {
    zclTTa0003_OnOff = LIGHT_ON;
	seqNumb++;
	zcl_SendReportCmd(TTa0003_ENDPOINT,&zclTTa0003_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, seqNumb );

  }
  // Turn off the light 
  else if ( cmd == COMMAND_OFF )
  {
   zclTTa0003_OnOff = LIGHT_OFF;
   seqNumb++;
   zcl_SendReportCmd(TTa0003_ENDPOINT,&zclTTa0003_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );

  }

I see in the ZigBee Cluster Library Quick Reference, as you see below, that All those parameters included in zcl_SendReportCMD are right but I cat in Wireshark, file attached, that has malformed parameters. 

Does someone, please, give an idea of how to fix it?

  • Hi alexander,

    I evaluated the zcl_SendReportCmd API with similar parameters and was able to send the command successfully, without any error in the sniffer log (attached for comparison, captured in Ubiqua).  Can you please share your sniffer log file?  Can you provide the the Attribute Field and packet frame?  Is the destination ZC device able to correctly parse and process the incoming packet?  You may also consider BDB reporting and the Zstackapi_bdbRepChangedAttrValueReq API: http://dev.ti.com/tirex/explore/node?node=AJeGnyIqlkquNAYMtLtovQ__pTTHBmu__LATEST https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/158/zcl_5F00_sendreportcmd_5F00_successful.cubx

    Regards,
    Ryan 

  • Hi Ryan, thanks a lot for your support!

    I´ll answer bellow your questions!

    1. Would you see attached the log, the same I cat the PIC.

    2 . The attributes I have used:

    ZCL Attribute: ATTRID_ON_OFF

    Defined in my App_data.c
    
    ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_ON_OFF,
          ZCL_DATATYPE_BOOLEAN,
          ACCESS_CONTROL_READ,
    (void *)&zclTTa0003_OnOff }

    3. I use a commercial ZC (Gateway) and I can not confirm if he received well, but I do not see any response on Wireshark.

    Thanks for sharing BDB reporting, I never see it!

    BR,

    Alex

    my wireshark_log_2019_0609.zip

  • Try the following code to send on/off status report.

    rptcmd.numAttr = 1;

    rptcmd.attrList[0].attrID = ATTRID_ON_OFF;

    rptcmd.attrList[0].dataType = ZCL_DATATYPE_UINT8;

    rptcmd.attrList[0].attrData = (uint8*)&zclSampleLight_OnOff;

    zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT, 0,

    ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd,

    ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );

  • Hi Mr. Yk, thanks a lot for your assistance!

    I have configured as you told me, I have seen that when included _DstAddr=0 directly as you used the ZCL report attributes (0x0a) message is not sent. After it, I adopted as I did before &zclTTa0003_DstAddr. But still get no data type including, I believe that because it Wireshark decoded as malformed message/parameter. 

    I also changed the ZCL parameter to Level Control and I observed the same behavior. As you see on Wireshark message attached. 

    You can see it in the PIC bellow, get from Quick Watch, that Attributes parameter filed is empty!

    I including my codes bellow used to send the last Report Attribute Message.

    // used at ZCL Reporting attribute
    	zclTTa0003_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    	zclTTa0003_DstAddr.addr.shortAddr = 0;
    	zclTTa0003_DstAddr.endPoint=1; // DST Endpoint sent by Gateway
    	// on-off
    	rptcmd.numAttr = 1;
    	rptcmd.attrList[0].attrID = ATTRID_ON_OFF; // Attribute ID of OnOff included in the Cluster Gen On/Off is 0 (ZigBee Cluster Library spec)
    	rptcmd.attrList[0].dataType = ZCL_DATATYPE_UINT8;
    	rptcmd.attrList[0].attrData = (uint8*)&zclTTa0003_OnOff;
    
    	//level control
    	//rptcmd.numAttr = 1;
    	//rptcmd.attrList[0].attrID = ATTRID_LEVEL_CURRENT_LEVEL; // Attribute ID of OnOff included in the Cluster Gen On/Off is 0 (ZigBee Cluster Library spec)
    	//rptcmd.attrList[0].dataType = ZCL_DATATYPE_UINT8;
    	//rptcmd.attrList[0].attrData = (uint8*)&zclTTa0003_LevelCurrentLevel;

    static void zclTTa0003_OnOffCB( uint8 cmd )
    {
      afIncomingMSGPacket_t *pPtr = zcl_getRawAFMsg();
    
    
      // Turn on the light
      if ( cmd == COMMAND_ON )
      {
        zclTTa0003_OnOff = LIGHT_ON;
    	seqNumb++;
    	zcl_SendReportCmd(TTa0003_ENDPOINT,&zclTTa0003_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, seqNumb );
    	//zcl_SendReportCmd(TTa0003_ENDPOINT,&zclTTa0003_DstAddr, ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, seqNumb );
    
      }
      // Turn off the light 
      else if ( cmd == COMMAND_OFF )
      {
       zclTTa0003_OnOff = LIGHT_OFF;
       seqNumb++;
         zcl_SendReportCmd(TTa0003_ENDPOINT,&zclTTa0003_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, seqNumb);
       //zcl_SendReportCmd(TTa0003_ENDPOINT,&zclTTa0003_DstAddr, ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, seqNumb );
      }


    Please, do you have an idea of how to fix it?

    my wireshark_log_2019_0609_d.zip

  • Try the following code.

    zclReportCmd_t *pReportCmd;
    
      pReportCmd = osal_mem_alloc( sizeof(zclReportCmd_t) + sizeof(zclReport_t) );
      if ( pReportCmd != NULL )
      {
        pReportCmd->numAttr = 1;
        pReportCmd->attrList[0].attrID = ATTRID_ON_OFF;
        pReportCmd->attrList[0].dataType = ZCL_DATATYPE_UINT8;
        pReportCmd->attrList[0].attrData = (uint8*)&zclSampleLight_OnOff;
    
        zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT, 0,ZCL_CLUSTER_ID_GEN_ON_OFF,
                                         pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, SeqNum++ );
      }
    
      osal_mem_free( pReportCmd );
    

  • As YK has shown you can reference the example from bdb_RepReport

    Regards,
    Ryan

  • Hi Mr. YK, thanks a lot for your assistance. After I implemented the last code you sent me, I had success to send ZCL report attributes!

    As you can see in the PIC attached.

    , thanks a lot for you assistance also!

    Best Regards,

    Alex