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.

Sending PC to ZED through ZC

Other Parts Discussed in Thread: CC2530

Hi,

     i am Using two ZED and one ZC. One ZED is sending a Sensor Data to ZC and ZC will send to PC, From the PC, data will send as a string to ZC, if Sensor goes Abnormal. Then ZC should Receive that and send to other ZED to on and off the device. I have Discussed my project in different thread, But This question is enhancement of that, so opened new thread. So my questions are

1) initUart(halUARTCBack_t pf); i should call from zclSampleLight_Init, what is pf?

2)i need register the callback uartRxCB Function in zclSampleLight_CmdCallbacks or directly i can write a fuction?

3)While sending data through UART HalUARTWrite ( uint8 port, uint8 *pBuffer, uint16 length );. In the Buffer we need to follow any serialization format or we can directly pass raw data . For example i want to send number 20, can i send like this pBuffer = (uint8) 20;?

4)Same thing for Receving also, HalUARTRead ( uint8 port, uint8 *pBuffer, uint16 length ); after calling this function data will store in the pBuffer. Directly can i read a data, for example, PC sends a data as "ON". can i read as uart_data = pBuffer.

  • I have attached my ZC Code.2727.Code.rar

  • I have attached my ZC Code 2117.Code.rar

  • OK, I find your problem. You use wrong API to parse message in Device_annce case. You can use the following code to replace yours.

            case Device_annce:
            {
                
          ZDO_DeviceAnnce_t devAnnce;
          ZDO_ParseDeviceAnnce(inMsg, &devAnnce);
          DstAddr.addrMode = Addr16Bit;
          DstAddr.addr.shortAddr = devAnnce.nwkAddr;
                ZDP_SimpleDescReq(&DstAddr, devAnnce.nwkAddr,
                                            SAMPLELIGHT_ENDPOINT , FALSE );
            }
            break;

  • Thank you, 

       But one last query, If my End device is having multiple endpoints, Then after  ZDP_SimpleDescReq from Coordinator, which simple descriptor will get?

  • Thank you, 

       1)But one last query, If my End device is having multiple endpoints, Then after  ZDP_SimpleDescReq from Coordinator, which simple descriptor will get?

    2)Is there any way to know how many Endpoints is there in particular End device?

  • If you have multiple endpoint, you can use ZDP_ActiveEPReq to get all of endpoints.

  • Now i am struct in the response from Simple Desc. I called Simple Desc Req after Active_EP_rsp, Here the Code

    case Simple_Desc_rsp:
    {
    char buff[10];
    ZDO_SimpleDescRsp_t *pSimpleDescRsp;
    zclCfgReportCmd_t cfgRptCmd;
    pSimpleDescRsp = NULL;
    uint8 *msg;
    uint8 i = 0;
    uint8 numInCluster = 0;
    uint8 release = 0;
    static uint8 count = 0;
    msg = inMsg->asdu;
    pSimpleDescRsp->status = *msg++;
    pSimpleDescRsp->nwkAddr = BUILD_UINT16( msg[LOW], msg[HIGH] );
    msg += sizeof ( uint16 );
    msg++; // Skip past the length field.
    if ( pSimpleDescRsp->status == ZDP_SUCCESS )
    {
    ZDO_ParseSimpleDescBuf( msg, &(pSimpleDescRsp->simpleDesc));
    if(pSimpleDescRsp->simpleDesc.EndPoint == 14)
    {
    HalLcdWriteString ("Endpoint", HAL_LCD_LINE_1);
    }
    numInCluster = pSimpleDescRsp->simpleDesc.AppNumInClusters;
    while(i < numInCluster && release == LOW)
    {
    if(pSimpleDescRsp->simpleDesc.pAppInClusterList[i] ==
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY)
    {
    HalLcdWriteString ("Cluster Matchd", HAL_LCD_LINE_1);
    DstAddr.addrMode = (afAddrMode_t)Addr16Bit;//DstAddr is declared globally as afAddrType_t
    DstAddr.addr.shortAddr = pSimpleDescRsp->nwkAddr;
    DstAddr.endPoint = pSimpleDescRsp->simpleDesc.EndPoint;
    cfgRptCmd.attrList[0].direction = LOW;
    cfgRptCmd.attrList[0].attrID =
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY;
    cfgRptCmd.attrList[0].dataType =
    ZCL_DATATYPE_INT16;
    cfgRptCmd.attrList[0].minReportInt = 20;
    cfgRptCmd.attrList[0].maxReportInt = 10;
    cfgRptCmd.attrList[0].timeoutPeriod = 0;
    cfgRptCmd.attrList[0].reportableChange = NULL;
    zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
    &DstAddr,
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY,
    &cfgRptCmd,
    ZCL_FRAME_CLIENT_SERVER_DIR,
    false, true);
    release = HIGH;
    }
    i++;
    }
    }
    }
    break;

    After calling simple Desc, i am getting Response, Even i am matching thenat cluster Id, you can see the content which i display in the lcd for debugging, But i am able to send config report to the destination. Is my above is correct, way of getting nwk address is correct??

  • Please learn to use packet sniffer and IAR debugger to check your problem first. 

  • yes, i have checked with packet sniffer, Meanwhile, can you tell me, whether this code is correct.

  • This Command is now working for me, Instead of this, if i use OnOffcmd, it is working fine. with same DstAddr. Is any thing i am missing?

    zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
    &DstAddr,
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY,
    &cfgRptCmd,
    ZCL_FRAME_CLIENT_SERVER_DIR,
    false, true);. 

  • Is the endpoint of your ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY is the same with SMAPLELIGHT_ENDPOINT?

  • No, End point of ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY  is 17 and SAMPLELIGHT_ENDPOINT is 13

  • So, you should use 17 as your endpoint to send report configuration.

  • But prototype is of zcl_SendConfigReportCmd is indicates source endpoint, right? Though i have tried that, it is not working. But this same command is working if i tried in Device announcement, Since i am using different endpoints in a ZED, so i used ZDP_ActiveEPFReq and simpleDescReq to Send report configuration.

  • Yes, you are right about the endpoint. Another point is that do you define ZCL_REPORT in your device? Please also use packet sniffer to check if the report configuration command is sent out.

  • Yes i have defined ZCL_REPORT. As i told i have tried this same in device_announce, if it is working fine with that, Then  why it is not working in the Simple_Desc. 

    case Device_annce:
    {
    ZDO_DeviceAnnce_t devAnnce;

    zclCfgReportCmd_t cfgRptCmd;
    ZDO_ParseDeviceAnnce(inMsg, &devAnnce);
    DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    DstAddr.addr.shortAddr = devAnnce.nwkAddr;
    DstAddr.endPoint = 17;
    cfgRptCmd.attrList[0].direction = LOW;
    cfgRptCmd.attrList[0].attrID = 
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY;
    cfgRptCmd.attrList[0].dataType = 
    ZCL_DATATYPE_INT16;
    cfgRptCmd.attrList[0].minReportInt = 20;
    cfgRptCmd.attrList[0].maxReportInt = 10;
    cfgRptCmd.attrList[0].timeoutPeriod = 0;
    cfgRptCmd.attrList[0].reportableChange = NULL;
    zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
    &DstAddr,
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY,
    &cfgRptCmd,
    ZCL_FRAME_CLIENT_SERVER_DIR,
    false, true);

    In this Code i am hard coding endpoint, in order to avoid this, i have used endpoint req. By the way, can you tell how to check in packet sniffer, whether it is sending sending config cmd or not?

  • This is my sniffer log. Can you tell me,  how to check whether coordinator Sends a Config command or not2703.lates.psd

  • Since you say that it can be received if you send it in Device_annce, you can compare the sniffer log between them to see what is wrong.

  • 1)I tried to find the difference between the two logs, In fact i found the difference, but i don't know what is the exactly, Since all MAC PAYLOAD are almost same. The log which  got by sending config report in Device_announce is 6724.dev_annce.psd.

    And the log which got by sending config report in simple_Desc. 0385.Simple_desc.psd.

    Please can you help me to solve this issue.

    2) One more issue i faced is in the device announcement i put the endpoint of fire detector Sensor, but it is configuring for humidity sensor.

    #include <stdio.h>
    #include "ZComDef.h"
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDApp.h"
    #include "ZDObject.h"
    #include "zcl_ss.h"
    #include "onboard.h"
    #include "zcl_includes.h"
    #include "zcl_samplelight.h"
    /* HAL */
    #include "hal_lcd.h"
    #include "hal_led.h"
    #include "hal_key.h"
    
    
    /*********************************************************************
     * MACROS
     */
    
    /*********************************************************************
     * CONSTANTS
     */
    /*********************************************************************
     * TYPEDEFS
     */
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    byte zclSampleLight_TaskID;
    
    /*********************************************************************
     * GLOBAL FUNCTIONS
     */
    
    /*********************************************************************
     * LOCAL VARIABLES
     */
    static afAddrType_t  zclSampleLight_DstAddr;
     static afAddrType_t ZED1_DstAddr;
     //static zAddrType_t  Tempy_DstAddr;
    // Test Endpoint to allow SYS_APP_MSGs
    static endPointDesc_t sampleLight_TestEp =
    {
    	TEST_ENDPOINT,                       	// Test endpoint
    	&zclSampleLight_TaskID,
    	(SimpleDescriptionFormat_t *)NULL,  	// No Simple description for this test endpoint
    	(afNetworkLatencyReq_t)null            // No Network Latency req
    };
    
    /*********************************************************************
     * ZCL General Profile Callback table
     */
    static zclGeneral_AppCallbacks_t zclSampleLight_CmdCallbacks =
    {
    	zclSampleLight_BasicResetCB,              	// Basic Cluster Reset cmd
    	zclSampleLight_IdentifyCB,                	// Identify command 
    	zclSampleLight_IdentifyQueryRspCB,        	// Identify Query Response cmd
    	NULL,                 				// On/Off cluster command
    	NULL,                                     	// Level Control Move to Level cmd
    	NULL,                                     	// Level Control Move command
    	NULL,                                     	// Level Control Step command
    	NULL,                                     	// Level Control Stop command
    	NULL,                                     	// Group Response commands
    	NULL,                                     	// Scene Store Request command
    	NULL,                                     	// Scene Recall Request command
    	NULL,                                     	// Scene Response command
    	NULL,                                     	// Alarm (Response) command
    	NULL,                                      	// RSSI Location commands
    	NULL,                                     	// RSSI Location Response cmds
    };
    
    /*********************************************************************
     * ZCL SS Callback table
     */
    static zclSS_AppCallbacks_t zclsampleLight_SS_CmdCallbacks = 
    {
    	zclSS_ChangeNotificationCB,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    	NULL,
    };
       
    /**************************************************************************
     * @fn	zclSampleLight_Init
     *
     * @brief	Initialization function for the zclGeneral layer and zclss.
     *
     * @param	[IN]	Task id to do Initialization task
     *
     * @return	SUCCESS
     */
    void zclSampleLight_Init( byte task_id )
    {
    	zclSampleLight_TaskID = task_id;
    
    	// This app is part of the Home Automation Profile
    	zclHA_Init( &zclSampleLight_SimpleDesc );
    	// Register the ZCL General Cluster Library callback functions
    	zclGeneral_RegisterCmdCallbacks( SAMPLELIGHT_ENDPOINT, 
    										&zclSampleLight_CmdCallbacks );
    	//Register the SS IAS Cluster Library callback functions
    	zclSS_RegisterCmdCallbacks(SAMPLELIGHT_ENDPOINT, 
    										&zclsampleLight_SS_CmdCallbacks);
    	// Register the application's attribute list
    	zcl_registerAttrList( SAMPLELIGHT_ENDPOINT, 
    							SAMPLELIGHT_MAX_ATTRIBUTES, zclSampleLight_Attrs );
    	/* Register the Application to receive 
    				the unprocessed Foundation command/response messages*/
    	zcl_registerForMsg( zclSampleLight_TaskID );
    	// Register for all key events - This app will handle all key events
    	RegisterForKeys( zclSampleLight_TaskID ); 
    	//Register for Device Announcement
    	ZDO_RegisterForZDOMsg(zclSampleLight_TaskID, Device_annce);
    	ZDO_RegisterForZDOMsg(zclSampleLight_TaskID, Simple_Desc_rsp); 
        ZDO_RegisterForZDOMsg(zclSampleLight_TaskID, IEEE_addr_rsp);
        ZDO_RegisterForZDOMsg(zclSampleLight_TaskID, Active_EP_rsp);
    	//Call back function for UART
    	initUART(uartRxCB);
    	// Register for a test endpoint
    	afRegister( &sampleLight_TestEp );
    }
    
      
    
    /*********************************************************************
     * @fn	zclSampleLight_event_loop
     *
     * @brief	Event Loop Processor for Receiving Sensor's value and Sends
    			On/off Command to BEE 4.
     *
     * @param task_id [IN]	Task id for Processing Event
     * @param event   [IN]	Events to do for Receiving Sensor value
     
     * @return		SUCESS
     */
    uint16 zclSampleLight_event_loop( uint8 task_id, uint16 events )
    {
    	afIncomingMSGPacket_t *MSGpkt;
    	//devStates_t zclSample_NWKstate;
    	//zAddrType_t dstAddr;
    	(void)task_id;  // Intentionally unreferenced parameter
    
    	if ( events & SYS_EVENT_MSG )
    	{
    		while ( (MSGpkt = (afIncomingMSGPacket_t *)
    					osal_msg_receive( zclSampleLight_TaskID )) )
    		{
    			switch ( MSGpkt->hdr.event )
    			{
    				case ZCL_INCOMING_MSG:
    					// Incoming ZCL Foundation command/response messages
    					zclSampleLight_ProcessIncomingMsg
    											((zclIncomingMsg_t *)MSGpkt );
    				break;
    				case KEY_CHANGE:
    					zclSampleLight_HandleKeys(((keyChange_t *)MSGpkt)->state, 
    												((keyChange_t *)MSGpkt)->keys);
    				break;
    				case ZDO_CB_MSG:
    					zclSampleLight_ProcessZDOMsgs((zdoIncomingMsg_t *)MSGpkt );
    				break;
    				default:
    				break;
    			}
    			// Release the memory
    			osal_msg_deallocate( (uint8 *)MSGpkt );
    		}
    		// return unprocessed events
    		return (events ^ SYS_EVENT_MSG);
    	}
    	if ( events & SAMPLELIGHT_IDENTIFY_TIMEOUT_EVT )
    	{
    		if ( zclSampleLight_IdentifyTime > INIT_VAL )
    		{
    			zclSampleLight_IdentifyTime--;
    		}
    		zclSampleLight_ProcessIdentifyTimeChange();
    		return ( events ^ SAMPLELIGHT_IDENTIFY_TIMEOUT_EVT );
    	}
    	// Discard unknown events
    	return SUCCESS;
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_HandleKeys
     *
     * @brief   Handles all key events for this device.
     *
     * @param   shift - true if in shift/alt.
     * @param   keys - bit field for key events. Valid entries:
     *                 HAL_KEY_SW_4
     *                 HAL_KEY_SW_3
     *                 HAL_KEY_SW_2
     *                 HAL_KEY_SW_1
     *
     * @return  none
     */
    static void zclSampleLight_HandleKeys( byte shift, byte keys )
    {
    	(void)shift;  // Intentionally unreferenced parameter
    
    	if ( keys & HAL_KEY_SW_2 )
    	{
        
    	}
    	if ( keys & HAL_KEY_SW_3 )
    	{
        
    	}
    	if ( keys & HAL_KEY_SW_4 )
    	{
    	
    	}
    }
    
    /*********************************************************************
    * @fn 	zclSampleLight_ProcessZDOMsgs()
    *
    * @brief 	Process response messages
    *
    * @param inMsg	[IN]	Pointer to ZDO incoming Messages
    *
    * @return 	none
    */
    void zclSampleLight_ProcessZDOMsgs( zdoIncomingMsg_t *inMsg )
    {	
      zAddrType_t DstAddr;
    	switch ( inMsg->clusterID )
    	{
    		case Device_annce:
    		{
    			ZDO_DeviceAnnce_t devAnnce;
    			ZDO_ParseDeviceAnnce(inMsg, &devAnnce);
    			zclSampleLight_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    			zclSampleLight_DstAddr.addr.shortAddr = devAnnce.nwkAddr;
    			zclSampleLight_DstAddr.endPoint = 17;//end point of fire sensor
                zclCfgReportCmd_t cfgRptCmd;
                            cfgRptCmd.numAttr = 1;
                            cfgRptCmd.attrList[0].direction = 0;
                            cfgRptCmd.attrList[0].attrID = ATTRID_SS_IAS_ZONE_STATUS;
                            cfgRptCmd.attrList[0].dataType = ZCL_DATATYPE_INT16;
                            cfgRptCmd.attrList[0].minReportInt = 5;
                            cfgRptCmd.attrList[0].maxReportInt = 10;
                            cfgRptCmd.attrList[0].timeoutPeriod = 0;
                            cfgRptCmd.attrList[0].reportableChange = NULL;
                            zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
                                                      &zclSampleLight_DstAddr,
                                                      ZCL_CLUSTER_ID_SS_IAS_ZONE,
                                                       &cfgRptCmd,
                                                      ZCL_FRAME_CLIENT_SERVER_DIR,
                                                      0, 1);
    			
    			/*DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    			DstAddr.addr.shortAddr = devAnnce.nwkAddr;
               ZDP_ActiveEPReq(&DstAddr, devAnnce.nwkAddr, false);*/
    		} 
    		break;
    		/*case Simple_Desc_rsp:
            {
                char buff[10];
    			ZDO_SimpleDescRsp_t *pSimpleDescRsp;
                zclCfgReportCmd_t cfgRptCmd;
                pSimpleDescRsp = NULL;
                uint8 *msg;
                uint8 i = INIT_VAL;
                uint8 numInCluster = INIT_VAL;
                uint8 DummyVar = INIT_VAL;
                static uint8 count = 0;
                msg = inMsg->asdu;
                pSimpleDescRsp->status = *msg++;
                pSimpleDescRsp->nwkAddr = BUILD_UINT16( msg[LOW], msg[HIGH] );
                msg += sizeof ( uint16 );
                msg++; // Skip past the length field.
                if ( pSimpleDescRsp->status == ZDP_SUCCESS )
                {
                    ZDO_ParseSimpleDescBuf( msg, &(pSimpleDescRsp->simpleDesc));
                    numInCluster = pSimpleDescRsp->simpleDesc.AppNumInClusters;
                    while(i < numInCluster && DummyVar == LOW)
                    {
                        count++;
                        if(pSimpleDescRsp->simpleDesc.pAppInClusterList[i] ==
                                      ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY)
                        {
                            HalLcdWriteString ("Humi Match", HAL_LCD_LINE_3);
                            DummyVar = HIGH;
                            ZED1_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
                            ZED1_DstAddr.addr.shortAddr = pSimpleDescRsp->nwkAddr;
                            ZED1_DstAddr.endPoint = pSimpleDescRsp->simpleDesc.EndPoint;
                            cfgRptCmd.attrList[INIT_VAL].direction = LOW;
                            cfgRptCmd.attrList[INIT_VAL].attrID = 
                                          ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY;
                            cfgRptCmd.attrList[INIT_VAL].dataType = 
                                                                 ZCL_DATATYPE_INT16;
                            cfgRptCmd.attrList[INIT_VAL].minReportInt = HUMI_REPORT;
                            cfgRptCmd.attrList[INIT_VAL].maxReportInt = 10;
                            cfgRptCmd.attrList[INIT_VAL].timeoutPeriod = 0;
                            cfgRptCmd.attrList[INIT_VAL].reportableChange = NULL;
                            zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
                                           &ZED1_DstAddr,
                                           ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY,
                                           &cfgRptCmd,
                                           ZCL_FRAME_CLIENT_SERVER_DIR,
                                           false, true);
                        }
                        else if(pSimpleDescRsp->simpleDesc.pAppInClusterList[i] ==
                                      ZCL_CLUSTER_ID_SS_IAS_ZONE)
                        {
                            DummyVar = HIGH;
                            ZED2_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
                            ZED1_DstAddr.addr.shortAddr = pSimpleDescRsp->nwkAddr;
                            ZED1_DstAddr.endPoint = 14;
                            cfgRptCmd.attrList[INIT_VAL].direction = LOW;
                            cfgRptCmd.attrList[INIT_VAL].attrID = 
                                          ATTRID_SS_IAS_ZONE_STATUS;
                            cfgRptCmd.attrList[INIT_VAL].dataType = 
                                                                 ZCL_DATATYPE_INT16;
                            cfgRptCmd.attrList[INIT_VAL].minReportInt = FIRE_REPORT;
                            cfgRptCmd.attrList[INIT_VAL].maxReportInt = 10;
                            cfgRptCmd.attrList[INIT_VAL].timeoutPeriod = 0;
                            cfgRptCmd.attrList[INIT_VAL].reportableChange = NULL;
                            zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
                                                      &ZED1_DstAddr,
                                                      ZCL_CLUSTER_ID_SS_IAS_ZONE,
                                                       &cfgRptCmd,
                                                      ZCL_FRAME_CLIENT_SERVER_DIR,
                                                      0, 1);
                        }
                                        i++;
                    }
               }	
    		}
    		break;*/
                 /*case Active_EP_rsp:
            {
               HalLcdWriteString ("Active", HAL_LCD_LINE_2);
                uint8 i = INIT_VAL;
                uint8 dev_endpt = INIT_VAL;
                uint8 ep[MAX_EP] = {INIT_VAL};
              
                ZDO_ActiveEndpointRsp_t *pRsp = ZDO_ParseEPListRsp(inMsg);
                DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
                DstAddr.addr.shortAddr = pRsp->nwkAddr; 
                for(i = INIT_VAL; i< MAX_EP && pRsp->epList[i]; i++)
                {
                  dev_endpt++;
                }
                osal_memcpy(&ep, pRsp->epList, dev_endpt);
                for(i = LOW; i < dev_endpt; i++)
                {
                    ZDP_SimpleDescReq(&DstAddr, pRsp->nwkAddr, 
    										ep[i] , FALSE );
                 }
              } 
            break;*/
        }         
    }
    
    *******************************************************************************
    * @fn	zclSS_ChangeNotificationCB call back Function
    *
    * @brief	Process incoming Change Notification Command
    *
    * @param pcmd	[IN]	Zone Status Change Notification command
    *
    * @return  none
    */
    *********************************************************************
     * @fn	zclSampleLight_ProcessIdentifyTimeChange
     *
     * @brief	Called to process any change to the IdentifyTime attribute.
     *
     * @param   none
     *
     * @return  none
     */
    static void zclSampleLight_ProcessIdentifyTimeChange( void )
    {
    	if ( zclSampleLight_IdentifyTime > INIT_VAL )
    	{
    		osal_start_timerEx( zclSampleLight_TaskID, 
    							SAMPLELIGHT_IDENTIFY_TIMEOUT_EVT, IDENTIFY_TIME );
    		HalLedBlink ( HAL_LED_4, 0xFF, HAL_LED_DEFAULT_DUTY_CYCLE,
    										HAL_LED_DEFAULT_FLASH_TIME );
    	}
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_BasicResetCB
     *
     * @brief   Callback from the ZCL General Cluster Library
     *          to set all the Basic Cluster attributes to default values.
     *
     * @param   none
     *
     * @return  none
     */
    static void zclSampleLight_BasicResetCB( void )
    {
    	// Reset all attributes to default values
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_IdentifyCB
     *
     * @brief   Callback from the ZCL General Cluster Library when
     *          it received an Identity Command for this application.
     *
     * @param srcAddr		[IN]	source address and endpoint of the response message
     * @param identifyTime 	[IN]	the number of seconds to identify 
     *
     * @return  none
     */
    static void zclSampleLight_IdentifyCB( zclIdentify_t *pCmd )
    {
    	zclSampleLight_IdentifyTime = pCmd->identifyTime;
    	zclSampleLight_ProcessIdentifyTimeChange();
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_IdentifyQueryRspCB
     *
     * @brief   Callback from the ZCL General Cluster Library when
     *          it received an Identity Query Response Command for this application.
     *
     * @param srcAddr 	[IN]	requestor's address
     * @param timeout	[IN]	number of seconds to identify 
    							(valid for query response)
     *
     * @return  none
     */
    static void zclSampleLight_IdentifyQueryRspCB(  zclIdentifyQueryRsp_t *pRsp )
    {
    	// Query Response (with timeout value)
    	(void)pRsp;
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_ProcessIncomingMsg
     *
     * @brief   Process ZCL Foundation incoming message
     *
     * @param pInMsg	[IN]	pointer to the received message
     *
     * @return  none
     */
    static void zclSampleLight_ProcessIncomingMsg( zclIncomingMsg_t *pInMsg)
    {
    	switch ( pInMsg->zclHdr.commandID )
    	{
    		#ifdef ZCL_READ
    		case ZCL_CMD_READ_RSP:
    			zclSampleLight_ProcessInReadRspCmd( pInMsg );
    		break;
    		#endif
    		#ifdef ZCL_WRITE    
    		case ZCL_CMD_WRITE_RSP:
    			zclSampleLight_ProcessInWriteRspCmd( pInMsg );
    		break;
    		#endif
    		#ifdef ZCL_REPORT
    		case ZCL_CMD_CONFIG_REPORT:
    				//zclSampleLight_ProcessInConfigReportCmd( pInMsg );
    		break;
    		case ZCL_CMD_CONFIG_REPORT_RSP:
    			//zclSampleLight_ProcessInConfigReportRspCmd( pInMsg );
    		break; 
    		case ZCL_CMD_READ_REPORT_CFG:
    			//zclSampleLight_ProcessInReadReportCfgCmd( pInMsg );
    		break;
    		case ZCL_CMD_READ_REPORT_CFG_RSP:
    			//zclSampleLight_ProcessInReadReportCfgRspCmd( pInMsg );
    		break;
    		case ZCL_CMD_REPORT:
    			zclSampleLight_ProcessInReportCmd( pInMsg );
    		break;
    		#endif   
    		case ZCL_CMD_DEFAULT_RSP:
    			zclSampleLight_ProcessInDefaultRspCmd( pInMsg );
    		break;
    		#ifdef ZCL_ZONE
    		case COMMAND_SS_IAS_ZONE_STATUS_CHANGE_NOTIFICATION:
    			zclSampleLight_ProcessInReportCmd(pInMsg);
    		break;
    		#endif
            #ifdef ZCL_DISCOVER     
    		case ZCL_CMD_DISCOVER_RSP:
    			zclSampleLight_ProcessInDiscRspCmd( pInMsg );
    		break;
    		#endif  
    		default:
    		break;
    	}
    	if ( pInMsg->attrCmd )
    		osal_mem_free( pInMsg->attrCmd );
    }
    
    #ifdef ZCL_READ
    /*********************************************************************
     * @fn      zclSampleLight_ProcessInReadRspCmd
     *
     * @brief   Process the "Profile" Read Response Command
     *
     * @param pInMsg	[IN]	incoming message to process
     *
     * @return  SUCCESS
     */
    static uint8 zclSampleLight_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg )
    {
    	zclReadRspCmd_t *readRspCmd;
    	uint8 i;
    
    	readRspCmd = (zclReadRspCmd_t *)pInMsg->attrCmd;
    	for (i = INIT_VAL; i < readRspCmd->numAttr; i++)
    	{
    		// Notify the originator of the results of the original read attribute 
    		// attempt and, for each successfull request,the value of the request
    		// attribute
    	}
      return SUCCESS; 
    }
    #endif // ZCL_READ
    
    #ifdef ZCL_WRITE
    /*********************************************************************
     * @fn      zclSampleLight_ProcessInWriteRspCmd
     *
     * @brief   Process the "Profile" Write Response Command
     *
     * @param   pInMsg - incoming message to process
     *
     * @return  none
     */
    static uint8 zclSampleLight_ProcessInWriteRspCmd( zclIncomingMsg_t *pInMsg )
    {
    	zclWriteRspCmd_t *writeRspCmd;
    	uint8 i;
    
    	writeRspCmd = (zclWriteRspCmd_t *)pInMsg->attrCmd;
    	for (i = INIT_VAL; i < writeRspCmd->numAttr; i++)
    	{
    		// Notify the device of the results of the its original write attributes
    		// command.
    	}
    	return SUCCESS; 
    }
    #endif // ZCL_WRITE
    
    #ifdef ZCL_REPORT
    /*********************************************************************
     * @fn      zclSampleLight_ProcessInReportCmd
     *
     * @brief   Process the "Profile" Report Command
     *
     * @param   pInMsg - incoming message to process
     *
     * @return  none
     */
    static void zclSampleLight_ProcessInReportCmd( zclIncomingMsg_t *pInMsg )
    {
    	zclReportCmd_t *pReportCmd;
    	pReportCmd = (zclReportCmd_t *)pInMsg->attrCmd;
    	uint8 Data;
    	uint16 len = INIT_VAL;
    	char Data1[DATA_LENGHT];
    
    		if (pInMsg->clusterId == ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY || 
    									ZCL_CLUSTER_ID_SS_IAS_ZONE)
    	{
    		if (pInMsg->clusterId == ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY)
    		{
    			if (pReportCmd->attrList[INIT_VAL].attrID == 
    									ATTRID_MS_RELATIVE_HUMIDITY_MEASURED_VALUE)
    			{
                    uint8 count = INIT_VAL;
    				Data = *(int16*)pReportCmd->attrList[INIT_VAL].attrData;
    				sprintf(Data1,"%d",Data);
    		   }	
    		}
    		if (pInMsg->clusterId == ZCL_CLUSTER_ID_SS_IAS_ZONE)
    		{
    			if (pReportCmd->attrList[INIT_VAL].attrID == 
    										ATTRID_SS_IAS_ZONE_STATUS)
    			{
                    uint8 count = INIT_VAL;
                    
    				Data = *(int16*)pReportCmd->attrList[INIT_VAL].attrData;
    				sprintf(Data1,"%d",Data);
    				                    #if defined( LCD_SUPPORTED )
                          #ifdef HAL_MCU_CC2530
    						HalLcdWriteScreen( "Fire Status", Data1);
                          #endif
                        #endif
                       count++;
                       MicroWait(WAIT_DELAY);
                    }
    			} 
    		}
    	}	
    }
    #endif   /* ZCL_REPORT */
    
    /*********************************************************************
     * @fn      zclSampleLight_ProcessInDefaultRspCmd
     *
     * @brief   Process the "Profile" Default Response Command
     *
     * @param   pInMsg - incoming message to process
     *
     * @return  none
     */
    static uint8 zclSampleLight_ProcessInDefaultRspCmd( zclIncomingMsg_t *pInMsg )
    {
    	// Device is notified of the Default Response command.
    	(void)pInMsg; 
    	return SUCCESS; 
    }
    
    #ifdef ZCL_DISCOVER
    /*********************************************************************
     * @fn      zclSampleLight_ProcessInDiscRspCmd
     *
     * @brief   Process the "Profile" Discover Response Command
     *
     * @param   pInMsg - incoming message to process
     *
     * @return  none
     */
    static uint8 zclSampleLight_ProcessInDiscRspCmd( zclIncomingMsg_t *pInMsg )
    {
    	zclDiscoverRspCmd_t *discoverRspCmd;
    	uint8 i;
    	  
    	discoverRspCmd = (zclDiscoverRspCmd_t *)pInMsg->attrCmd;
    	for ( i = INIT_VAL; i < discoverRspCmd->numAttr; i++ )
    	{
    		// Device is notified of the result of its attribute discovery command.
    	}
    	return SUCCESS;
    }
    #endif // ZCL_DISCOVER
    
    
    /****************************************************************************
    ****************************************************************************/
    
    

    This is my code, see if u can help me.

  • I tried to figure out the issue, but it is looking strange to me. in the simple desc rsp with same destination addr, i send OnOffcmd instead of config command for testing, it is working fine. I have shared my Code in my previous post. Did i done any mistake?

  • In Device_annce case, you use zcl_SendConfigReportCmd to send config report to ZCL_CLUSTER_ID_SS_IAS_ZONE of zclSampleLight_DstAddr with endpoint 17. You said it works in Device_annce case that your ZED can receive config report. However, you fail to send config report to ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY in Simple_Desc_rsp case. If you try to send config report to ZCL_CLUSTER_ID_SS_IAS_ZONE in Simple_Desc_rsp case, does it work?

  • Yes ZED receives config report in device announce. And it starts to send report at 5 sec which i configured in ZC, by default ZED will send report at 10 sec.

     No, ZCL_CLUSTER_ID_SS_IAS_ZONE also not working in  Simple_Desc_rsp case. But if i change 

    zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
    &ZED1_DstAddr,
    ZCL_CLUSTER_ID_SS_IAS_ZONE,
    &cfgRptCmd,
    ZCL_FRAME_CLIENT_SERVER_DIR,
    0, 1);  

    to 

    zclGeneral_SendOnOff_CmdOff((SAMPLELIGHT_ENDPOINT,
    &ZED1_DstAddr,0,0);

    this command i am getting in the ZED. Then there is no problem with dstaddr. I think issue with the config command.


  • My suggest is to set a breakpoint at ZCL_INCOMING_MSG in your ZED and send the config report command from ZC. Check if ZED can receive ZCL_INCOMING_MSG first.

  • I have set a break point in ZCL_INCOMING_MSG, it is hitting the break point. But when call config report in Device announce, it is hitting the break point.

  • I have set a break point in ZCL_INCOMING_MSG, it is not  hitting the break point. But when call config report in Device announce, it is hitting the break point.

  • I have set a break point in ZCL_INCOMING_MSG, it is not  hitting the break point. But when call config report in Device announce, it is hitting the break point.e

    And i have set breakpoint. 

    if(pSimpleDescRsp->simpleDesc.pAppInClusterList[i] ==
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY)
    {
    HalLcdWriteString ("Humi Match", HAL_LCD_LINE_3);
    DummyVar = HIGH;
    ZED1_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    ZED1_DstAddr.addr.shortAddr = pSimpleDescRsp->nwkAddr;
    ZED1_DstAddr.endPoint = pSimpleDescRsp->simpleDesc.EndPoint;
    cfgRptCmd.attrList[0].direction = 0;
    cfgRptCmd.attrList[0].attrID =
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY;
    cfgRptCmd.attrList[0].dataType =
    ZCL_DATATYPE_INT16;
    cfgRptCmd.attrList[INIT_VAL].minReportInt = HUMI_REPORT;
    cfgRptCmd.attrList[INIT_VAL].maxReportInt = 10;
    cfgRptCmd.attrList[INIT_VAL].timeoutPeriod = 0;
    cfgRptCmd.attrList[INIT_VAL].reportableChange = NULL;
    zcl_SendConfigReportCmd(SAMPLELIGHT_ENDPOINT,
    &ZED1_DstAddr,
    ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY,
    &cfgRptCmd,
    ZCL_FRAME_CLIENT_SERVER_DIR,
    false, true);

    HalLcdWriteString ("Breakpoint", HAL_LCD_LINE_2);//set a break point here

    }

    I got a sniffer after setting a break point. Can you tell me, what is happening after sending config command by referring  last two mac payload 4628.brea.psd


  • Dear Yikai, Can you support me with the above information

  • Mr. Yikai, Can you support me with the above information. I tired to figure it out. I am getting.  

  • So, you have multiple endpoint in your ZED. Please read the discussion at http://e2e.ti.com/support/low_power_rf/f/158/t/302786.aspx and see if you suffer from the same issue. Could you attach all of your ZED source code?

  • That discussion is based on known endpoints. But in my case i don't want to hard code my endpoints. For that only i used Activeendpoint request  and Configuring the report. my ZED code is 5460.Source.rar

  • I need to check your OSAL_XXX.c. Would you please attach it?

  • Here the file 

    /*********************************************************************
     * INCLUDES
     */
    #include "ZComDef.h"
    #include "hal_drivers.h"
    #include "OSAL.h"
    #include "OSAL_Tasks.h"
    #if defined ( MT_TASK )
      #include "MT.h"
      #include "MT_TASK.h"
    #endif
    #include "nwk.h"
    #include "APS.h"
    #include "ZDApp.h"
    #if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
      #include "ZDNwkMgr.h"
    #endif
    #if defined ( ZIGBEE_FRAGMENTATION )
      #include "aps_frag.h"
    #endif
    
    #include "zcl_Humidity.h"
    #include "zcl_Fire.h"
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    // The order in this table must be identical to the task initialization calls below in osalInitTask.
    const pTaskEventHandlerFn tasksArr[] = {
      macEventLoop,
      nwk_event_loop,
      Hal_ProcessEvent,
    #if defined( MT_TASK )
      MT_ProcessEvent,
    #endif
      APS_event_loop,
    #if defined ( ZIGBEE_FRAGMENTATION )
      APSF_ProcessEvent,
    #endif
      ZDApp_event_loop,
    #if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
      ZDNwkMgr_event_loop,
    #endif
      zcl_event_loop,
      zclHumidity_event_loop,
      zclFire_event_loop
    };
    
    const uint8 tasksCnt = sizeof( tasksArr ) / sizeof( tasksArr[INIT_VAL] );
    uint16 *tasksEvents;
    
    /*********************************************************************
     * FUNCTIONS
     *********************************************************************/
    
    /*********************************************************************
     * @fn      osalInitTasks
     *
     * @brief   This function invokes the initialization function for each task.
     *
     * @param   void
     *
     * @return  none
     */
    void osalInitTasks( void )
    {
    	uint8 taskID = INIT_VAL;
    
    	tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);
    	osal_memset( tasksEvents, INIT_VAL, (sizeof( uint16 ) * tasksCnt));
    	macTaskInit( taskID++ );
    	nwk_init( taskID++ );
    	Hal_Init( taskID++ );
    	#if defined( MT_TASK )
    	MT_TaskInit( taskID++ );
    	#endif
    	APS_Init( taskID++ );
    	#if defined ( ZIGBEE_FRAGMENTATION )
    	APSF_Init( taskID++ );
    	#endif
    	ZDApp_Init( taskID++ );
    	#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
    	ZDNwkMgr_Init( taskID++ );
    	#endif
    	zcl_Init( taskID++ );
    	zclHumidity_Init(taskID++);
        zclFire_Init(taskID);
    }
    
    /*********************************************************************
    *********************************************************************/
    

  • According to your ZED source code, the ZCL report config command to be received by zclHumidity_ProcessInConfigReportCmd no matter what endpoint you use. You can set a breakpoint to check it.

  • But i am not receiving any config command in ZED i have set a break point in ZCL_INCOMING_MSG. 

  • Set another breakpoint at the beginning of zclSendMsg function and check again.

  •  zclSendMsg?? In ZC or ZED?? where is that?

  • It is in ZCL.c

  • Why i am getting this error in Packet Sniffer, Error: Parsed Data is too Long Data length 1515. And i have noticed, it is due to, that i am requesting for Active Endpoints in device announcement and from there i am requesting for Simple desc for Sending Config Cmd. when i  comment that, then i am not getting any parsing Error. How can i get rid of this? but my devices were working as per my requirement.

  • Do you mean you will have this error if you request for Simple desc? If so, would you show me your zcl_XXX_data.c?

  • i will try it later.
    Thank you for considering my request.