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.

zcl_incoming reached for zcl command



Hi guys, anybody can help me please. I tried to design a Texas Home Automation simpleSW as a ZED, on my customized SOC. I had a success to connect on a commercial gateway. I got a success to join in a gateway. i see it on a Perytons Protocol Analyzer.  You can see it on a message log below:

During the debug procedure on a IAR 8051 i can see that the join procedure was reached, as you can see it above, but wen the ZCL command On/Off came from the Gateway to ZED (my customized SOC). As you can see below, the "afIncomingMSGPacket_t", on the loop, was reached when the ZED received MgmntPermitJoinReq. But the ZCL_INCOMING MSG never was not reached. Please anybody can help me. 

IAR Debug code:

Below i including a few parameters to help the code analyze:

void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;

// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 10;

// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );

// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );

// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );

// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );

// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );

// Register for a test endpoint
afRegister( &sampleSw_TestEp );

ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
}

/*********************************************************************
* @fn zclSample_event_loop
*
* @brief Event Loop Processor for zclGeneral.
*
* @param none
*
* @return none
*/
uint16 zclSampleSw_event_loop( uint8 task_id, uint16 events )
{
afIncomingMSGPacket_t *MSGpkt;
(void)task_id; // Intentionally unreferenced parameter
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON ); //ASA
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON ); //ASA

if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case ZCL_INCOMING_MSG:
// Incoming ZCL Foundation command/response messages
zclSampleSw_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;

case ZDO_CB_MSG:
zclSampleSw_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;

default:
break;
}

// Release the memory
osal_msg_deallocate( (uint8 *)MSGpkt );
}

// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}

if ( events & SAMPLESW_IDENTIFY_TIMEOUT_EVT )
{
zclSampleSw_IdentifyTime = 10;
zclSampleSw_ProcessIdentifyTimeChange();

return ( events ^ SAMPLESW_IDENTIFY_TIMEOUT_EVT );
}

// Discard unknown events
return 0;
}

void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;

// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 10;

// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );

// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );

// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );

// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );

// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );

// Register for a test endpoint
afRegister( &sampleSw_TestEp );

ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
}

/*********************************************************************
* @fn zclSample_event_loop
*
* @brief Event Loop Processor for zclGeneral.
*
* @param none
*
* @return none
*/
uint16 zclSampleSw_event_loop( uint8 task_id, uint16 events )
{
afIncomingMSGPacket_t *MSGpkt;
(void)task_id; // Intentionally unreferenced parameter
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON ); //ASA
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON ); //ASA

if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case ZCL_INCOMING_MSG:
// Incoming ZCL Foundation command/response messages
zclSampleSw_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;

case ZDO_CB_MSG:
zclSampleSw_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;

default:
break;
}

// Release the memory
osal_msg_deallocate( (uint8 *)MSGpkt );
}

// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}

if ( events & SAMPLESW_IDENTIFY_TIMEOUT_EVT )
{
zclSampleSw_IdentifyTime = 10;
zclSampleSw_ProcessIdentifyTimeChange();

return ( events ^ SAMPLESW_IDENTIFY_TIMEOUT_EVT );
}

// Discard unknown events
return 0;
}

void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;

// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 10;

// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );

// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );

// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );

// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );

// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );

// Register for a test endpoint
afRegister( &sampleSw_TestEp );

ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
}

/*********************************************************************
* @fn zclSample_event_loop
*
* @brief Event Loop Processor for zclGeneral.
*
* @param none
*
* @return none
*/
uint16 zclSampleSw_event_loop( uint8 task_id, uint16 events )
{
afIncomingMSGPacket_t *MSGpkt;
(void)task_id; // Intentionally unreferenced parameter
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON ); //ASA
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON ); //ASA

if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case ZCL_INCOMING_MSG:
// Incoming ZCL Foundation command/response messages
zclSampleSw_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;

case ZDO_CB_MSG:
zclSampleSw_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;

default:
break;
}

// Release the memory
osal_msg_deallocate( (uint8 *)MSGpkt );
}

// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}

if ( events & SAMPLESW_IDENTIFY_TIMEOUT_EVT )
{
zclSampleSw_IdentifyTime = 10;
zclSampleSw_ProcessIdentifyTimeChange();

return ( events ^ SAMPLESW_IDENTIFY_TIMEOUT_EVT );
}

// Discard unknown events
return 0;
}

Thanks a lot.

BR

Alex

  • Sample switch shows you how to send on/off command. If you want to receive on/off command, you should try sample light project.

  • Hi Mr Yikai Chen. Thanks a lot for your answer. I change my test from SampleSW to SampleLight and i saw the same behavior. The PermitJoinReq was reached zclSampleLight_event_loop on a  afIncomingMSGPacket_t *MSGpkt. 

    I would like that my SampleLight will reach the ZCL_INCOMING_MSG and after it i can wrote the CallBack procedure and the device (samplelight) can send the HA DefaultResp. 

    I will try to explain you more about my test environment:

    Zstack: ZStack-CC2530-2.4.0-1.4.0

    The commercial Gateway just working with Sample light switch as a RouterEB, when i using EndDeviceEB the gateway didnt send the CMD ON to the SampleLight device. Maybe i can change any configuration to working 

    As you see above the Cluster ID is On/Off (0x006), because it i was change the SimpleDescriptor and General Basic Cluster Attributes from ZCL_CLUSTER_ID_GEN_BASIC to ZCL_CLUSTER_ID_GEN_ON_OFF, according the ZCL CMD ON/OFF sent by Commercial Gateway.

    You can see my project files attached on this post. Please, would you can help me to understanding, why the CMD on was not reach on the zclSampleLight_event_loop in the ZCL_INCOMIG MSG, below:

    part of the code structure i got on samplelight.c file:

    if ( events & SYS_EVENT_MSG )
    {

    /**************************************************************************************************
      Filename:       zcl_sampleLight.c
      Revised:        $Date: 2009-03-18 15:56:27 -0700 (Wed, 18 Mar 2009) $
      Revision:       $Revision: 19453 $
    
    
      Description:    Zigbee Cluster Library - sample device application.
    
    
      Copyright 2006-2009 Texas Instruments Incorporated. All rights reserved.
    
      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License").  You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product.  Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.
    
      YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
      PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
      INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, 
      NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
      OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
      OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
      (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
    
      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com. 
    **************************************************************************************************/
    
    /*********************************************************************
      This device will be like a Light device.  This application is not
      intended to be a Light device, but will use the device description
      to implement this sample code.
    *********************************************************************/
    
    /*********************************************************************
     * INCLUDES
     */
    #include "ZComDef.h"
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDApp.h"
    
    #include "zcl.h"
    #include "zcl_general.h"
    #include "zcl_ha.h"
    
    #include "zcl_samplelight.h"
    
    #include "onboard.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;
    
    // Test Endpoint to allow SYS_APP_MSGs
    static endPointDesc_t sampleLight_TestEp =
    {
      20,                                 // Test endpoint
      &zclSampleLight_TaskID,
      (SimpleDescriptionFormat_t *)NULL,  // No Simple description for this test endpoint
      (afNetworkLatencyReq_t)0            // No Network Latency req
    };
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    static void zclSampleLight_IdentifyQueryRspCB( zclIdentifyQueryRsp_t *pRsp );
    static void zclSampleLight_OnOffCB( uint8 cmd );
    
    // Functions to process ZCL Foundation incoming Command/Response messages 
    static void zclSampleLight_ProcessIncomingMsg( zclIncomingMsg_t *msg );
    #ifdef ZCL_READ
    static uint8 zclSampleLight_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg );
    #endif
    #ifdef ZCL_WRITE
    static uint8 zclSampleLight_ProcessInWriteRspCmd( zclIncomingMsg_t *pInMsg );
    #endif
    static uint8 zclSampleLight_ProcessInDefaultRspCmd( zclIncomingMsg_t *pInMsg );
    #ifdef ZCL_DISCOVER
    static uint8 zclSampleLight_ProcessInDiscRspCmd( zclIncomingMsg_t *pInMsg );
    #endif
    
    /*********************************************************************
     * ZCL General Profile Callback table
     */
    static zclGeneral_AppCallbacks_t zclSampleLight_CmdCallbacks =
    {
      NULL,      						        // Basic Cluster Reset command
      NULL,						                // Identify command  
      zclSampleLight_IdentifyQueryRspCB,        // Identify Query Response command
      zclSampleLight_OnOffCB,                   // On/Off cluster command
      NULL,                                     // Level Control Move to Level command
      NULL,                                     // Level Control Move command
      NULL,                                     // Level Control Step 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 commands
    };
    
    /*********************************************************************
     * @fn          zclSampleLight_Init
     *
     * @brief       Initialization function for the zclGeneral layer.
     *
     * @param       none
     *
     * @return      none
     */
    void zclSampleLight_Init( byte task_id )
    {
      zclSampleLight_TaskID = task_id;
    
      // Set destination address to indirect
      //zclSampleLight_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
      //zclSampleLight_DstAddr.endPoint = 0;
      //zclSampleLight_DstAddr.addr.shortAddr = 0;
    
      // 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 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 a test endpoint
      afRegister( &sampleLight_TestEp );
    }
    
    /*********************************************************************
     * @fn          zclSample_event_loop
     *
     * @brief       Event Loop Processor for zclGeneral.
     *
     * @param       none
     *
     * @return      none
     */
    uint16 zclSampleLight_event_loop( uint8 task_id, uint16 events )
    {
      afIncomingMSGPacket_t *MSGpkt;
      
      (void)task_id;  // Intentionally unreferenced parameter
      HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF ); // wrote ASA
      
      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;
              
            default:
              break;
          }
    
          // Release the memory
          osal_msg_deallocate( (uint8 *)MSGpkt );
        }
    
        // return unprocessed events
        return (events ^ SYS_EVENT_MSG);
      }
    
      // Discard unknown events
      return 0;
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_IdentifyQueryRspCB
     *
     * @brief   Callback from the ZCL General Cluster Library when
     *          it received an Identity Query Response Command for this application.
     *
     * @param   srcAddr - requestor's address
     * @param   timeout - number of seconds to identify yourself (valid for query response)
     *
     * @return  none
     */
    static void zclSampleLight_IdentifyQueryRspCB(  zclIdentifyQueryRsp_t *pRsp )
    {
      // Query Response (with timeout value)
      (void)pRsp;
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_OnOffCB
     *
     * @brief   Callback from the ZCL General Cluster Library when
     *          it received an On/Off Command for this application.
     *
     * @param   cmd - COMMAND_ON, COMMAND_OFF or COMMAND_TOGGLE
     *
     * @return  none
     */
    static void zclSampleLight_OnOffCB( uint8 cmd )
    {
      // Turn on the light
      if ( cmd == COMMAND_ON )
        zclSampleLight_OnOff = LIGHT_ON;
    
      // Turn off the light
      else if ( cmd == COMMAND_OFF )
        zclSampleLight_OnOff = LIGHT_OFF;
    
      // Toggle the light
      else
      {
        if ( zclSampleLight_OnOff == LIGHT_OFF )
          zclSampleLight_OnOff = LIGHT_ON;
        else
          zclSampleLight_OnOff = LIGHT_OFF;
      }
    
      // In this sample app, we use LED4 to simulate the Light
      if ( zclSampleLight_OnOff == LIGHT_ON ) {
        HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF );
    	HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
    	}
      else {
        HalLedSet( HAL_LED_3, HAL_LED_MODE_ON );
    	HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
    	}
    }
    
    
    /****************************************************************************** 
     * 
     *  Functions for processing ZCL Foundation incoming Command/Response messages
     *
     *****************************************************************************/
    
    /*********************************************************************
     * @fn      zclSampleLight_ProcessIncomingMsg
     *
     * @brief   Process ZCL Foundation incoming message
     *
     * @param   pInMsg - 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
        // See ZCL Test Applicaiton (zcl_testapp.c) for sample code on Attribute Reporting
        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_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 - incoming message to process
     *
     * @return  none
     */
    static uint8 zclSampleLight_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg )
    {
      zclReadRspCmd_t *readRspCmd;
      uint8 i;
    
      readRspCmd = (zclReadRspCmd_t *)pInMsg->attrCmd;
      for (i = 0; i < readRspCmd->numAttr; i++)
      {
        // Notify the originator of the results of the original read attributes 
        // attempt and, for each successfull request, the value of the requested 
        // attribute
    	
      }
     
      return TRUE; 
    }
    #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 = 0; i < writeRspCmd->numAttr; i++)
      {
        // Notify the device of the results of the its original write attributes
        // command.
    
      }
    
      return TRUE; 
    }
    #endif // ZCL_WRITE
    
    /*********************************************************************
     * @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 )
    {
      // zclDefaultRspCmd_t *defaultRspCmd = (zclDefaultRspCmd_t *)pInMsg->attrCmd;
       
      // Device is notified of the Default Response command.
      (void)pInMsg;
      
      return TRUE; 
    }
    
    #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 = 0; i < discoverRspCmd->numAttr; i++ )
      {
        // Device is notified of the result of its attribute discovery command.
      }
      
      return TRUE;
    }
    #endif // ZCL_DISCOVER
    
    
    /****************************************************************************
    ****************************************************************************/
    
    
    
    0488.zcl_samplelight.h
    /**************************************************************************************************
      Filename:       zcl_samplelight_data.c
      Revised:        $Date: 2008-03-11 11:01:35 -0700 (Tue, 11 Mar 2008) $
      Revision:       $Revision: 16570 $
    
    
      Description:    Zigbee Cluster Library - sample device application.
    
    
      Copyright 2006-2007 Texas Instruments Incorporated. All rights reserved.
    
      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License").  You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product.  Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.
    
      YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
      PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
      INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, 
      NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
      OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
      OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
      (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
    
      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com. 
    **************************************************************************************************/
    
    /*********************************************************************
     * INCLUDES
     */
    #include "ZComDef.h"
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDConfig.h"
    
    #include "zcl.h"
    #include "zcl_general.h"
    #include "zcl_ha.h"
    
    #include "zcl_samplelight.h"
    
    /*********************************************************************
     * CONSTANTS
     */
    
    #define SAMPLELIGHT_DEVICE_VERSION     0
    #define SAMPLELIGHT_FLAGS              0
    
    #define SAMPLELIGHT_HWVERSION          1
    #define SAMPLELIGHT_ZCLVERSION         1
    
    /*********************************************************************
     * TYPEDEFS
     */
    
    /*********************************************************************
     * MACROS
     */
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    
    // Basic Cluster
    const uint8 zclSampleLight_HWRevision = SAMPLELIGHT_HWVERSION;
    const uint8 zclSampleLight_ZCLVersion = SAMPLELIGHT_ZCLVERSION;
    const uint8 zclSampleLight_ManufacturerName[] = { 16, 'T','e','x','a','s','I','n','s','t','r','u','m','e','n','t','s' };
    const uint8 zclSampleLight_ModelId[] = { 16, 'T','I','0','0','0','1',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
    const uint8 zclSampleLight_DateCode[] = { 16, '2','0','0','6','0','8','3','1',' ',' ',' ',' ',' ',' ',' ',' ' };
    const uint8 zclSampleLight_PowerSource = POWER_SOURCE_MAINS_1_PHASE;
    
    uint8 zclSampleLight_LocationDescription[17] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
    uint8 zclSampleLight_PhysicalEnvironment = 0;
    uint8 zclSampleLight_DeviceEnable = DEVICE_ENABLED;
    
    // Identify Cluster
    uint16 zclSampleLight_IdentifyTime = 0;
    
    // On/Off Cluster
    uint8  zclSampleLight_OnOff = LIGHT_ON;
    
    /*********************************************************************
     * ATTRIBUTE DEFINITIONS - Uses REAL cluster IDs
     */
    CONST zclAttrRec_t zclSampleLight_Attrs[SAMPLELIGHT_MAX_ATTRIBUTES] =
    {
      // *** General Basic Cluster Attributes ***
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,             // Cluster IDs - defined in the foundation (ie. zcl.h)
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        {  // Attribute record
          ATTRID_BASIC_HW_VERSION,            // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
          ZCL_DATATYPE_UINT8,                 // Data Type - found in zcl.h
          ACCESS_CONTROL_READ,                // Variable access control - found in zcl.h
          (void *)&zclSampleLight_HWRevision  // Pointer to attribute variable
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_ZCL_VERSION,
          ZCL_DATATYPE_UINT8,
          ACCESS_CONTROL_READ,
          (void *)&zclSampleLight_ZCLVersion
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_MANUFACTURER_NAME,
          ZCL_DATATYPE_CHAR_STR,
          ACCESS_CONTROL_READ,
          (void *)zclSampleLight_ManufacturerName
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_MODEL_ID,
          ZCL_DATATYPE_CHAR_STR,
          ACCESS_CONTROL_READ,
          (void *)zclSampleLight_ModelId
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_DATE_CODE,
          ZCL_DATATYPE_CHAR_STR,
          ACCESS_CONTROL_READ,
          (void *)zclSampleLight_DateCode
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_POWER_SOURCE,
          ZCL_DATATYPE_UINT8,
          ACCESS_CONTROL_READ,
          (void *)&zclSampleLight_PowerSource
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_LOCATION_DESC,
          ZCL_DATATYPE_CHAR_STR,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)zclSampleLight_LocationDescription
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_PHYSICAL_ENV,
          ZCL_DATATYPE_UINT8,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)&zclSampleLight_PhysicalEnvironment
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_DEVICE_ENABLED,
          ZCL_DATATYPE_BOOLEAN,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)&zclSampleLight_DeviceEnable
        }
      },
    
      // *** Identify Cluster Attribute ***
      {
        ZCL_CLUSTER_ID_GEN_IDENTIFY,
        { // Attribute record
          ATTRID_IDENTIFY_TIME,
          ZCL_DATATYPE_UINT16,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)&zclSampleLight_IdentifyTime
        }
      },
    
      // *** On/Off Cluster Attributes ***
      {
        ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_ON_OFF,
          ZCL_DATATYPE_UINT8,
          ACCESS_CONTROL_READ,
          (void *)&zclSampleLight_OnOff
        }
      },
    };
    
    /*********************************************************************
     * SIMPLE DESCRIPTOR
     */
    // This is the Cluster ID List and should be filled with Application
    // specific cluster IDs.
    #define ZCLSAMPLELIGHT_MAX_INCLUSTERS       5
    const cId_t zclSampleLight_InClusterList[ZCLSAMPLELIGHT_MAX_INCLUSTERS] =
    {
      ZCL_CLUSTER_ID_GEN_BASIC,
      ZCL_CLUSTER_ID_GEN_SCENES,
      ZCL_CLUSTER_ID_GEN_GROUPS,
      ZCL_CLUSTER_ID_GEN_ON_OFF,
      ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL
    };
    
    #define ZCLSAMPLELIGHT_MAX_OUTCLUSTERS       2
    const cId_t zclSampleLight_OutClusterList[ZCLSAMPLELIGHT_MAX_OUTCLUSTERS] =
    {
      ZCL_CLUSTER_ID_GEN_BASIC,
      ZCL_CLUSTER_ID_GEN_ON_OFF
    };
    
    SimpleDescriptionFormat_t zclSampleLight_SimpleDesc =
    {
      SAMPLELIGHT_ENDPOINT,                  //  int Endpoint;
      ZCL_HA_PROFILE_ID,                     //  uint16 AppProfId[2];
      //ZCL_HA_DEVICEID_DIMMABLE_LIGHT,        //  uint16 AppDeviceId[2];
      ZCL_CLUSTER_ID_GEN_ON_OFF,             //  uint16 AppDeviceId[2];
      SAMPLELIGHT_DEVICE_VERSION,            //  int   AppDevVer:4;
      SAMPLELIGHT_FLAGS,                     //  int   AppFlags:4;
      ZCLSAMPLELIGHT_MAX_INCLUSTERS,         //  byte  AppNumInClusters;
      (cId_t *)zclSampleLight_InClusterList, //  byte *pAppInClusterList;
      ZCLSAMPLELIGHT_MAX_OUTCLUSTERS,        //  byte  AppNumInClusters;
      (cId_t *)zclSampleLight_OutClusterList //  byte *pAppInClusterList;
    };
    
    /*********************************************************************
     * GLOBAL FUNCTIONS
     */
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    
    /****************************************************************************
    ****************************************************************************/
    
    
    

    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;

    default:
    break;
    }

    // Release the memory
    osal_msg_deallocate( (uint8 *)MSGpkt );
    }

    Below you can see the correct behavior HA DefaultResp sent by Commercial Ligth Device:

    /**************************************************************************************************
      Filename:       zcl_sampleLight.c
      Revised:        $Date: 2009-03-18 15:56:27 -0700 (Wed, 18 Mar 2009) $
      Revision:       $Revision: 19453 $
    
    
      Description:    Zigbee Cluster Library - sample device application.
    
    
      Copyright 2006-2009 Texas Instruments Incorporated. All rights reserved.
    
      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License").  You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product.  Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.
    
      YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
      PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
      INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, 
      NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
      OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
      OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
      (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
    
      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com. 
    **************************************************************************************************/
    
    /*********************************************************************
      This device will be like a Light device.  This application is not
      intended to be a Light device, but will use the device description
      to implement this sample code.
    *********************************************************************/
    
    /*********************************************************************
     * INCLUDES
     */
    #include "ZComDef.h"
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDApp.h"
    
    #include "zcl.h"
    #include "zcl_general.h"
    #include "zcl_ha.h"
    
    #include "zcl_samplelight.h"
    
    #include "onboard.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;
    
    // Test Endpoint to allow SYS_APP_MSGs
    static endPointDesc_t sampleLight_TestEp =
    {
      20,                                 // Test endpoint
      &zclSampleLight_TaskID,
      (SimpleDescriptionFormat_t *)NULL,  // No Simple description for this test endpoint
      (afNetworkLatencyReq_t)0            // No Network Latency req
    };
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    static void zclSampleLight_IdentifyQueryRspCB( zclIdentifyQueryRsp_t *pRsp );
    static void zclSampleLight_OnOffCB( uint8 cmd );
    
    // Functions to process ZCL Foundation incoming Command/Response messages 
    static void zclSampleLight_ProcessIncomingMsg( zclIncomingMsg_t *msg );
    #ifdef ZCL_READ
    static uint8 zclSampleLight_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg );
    #endif
    #ifdef ZCL_WRITE
    static uint8 zclSampleLight_ProcessInWriteRspCmd( zclIncomingMsg_t *pInMsg );
    #endif
    static uint8 zclSampleLight_ProcessInDefaultRspCmd( zclIncomingMsg_t *pInMsg );
    #ifdef ZCL_DISCOVER
    static uint8 zclSampleLight_ProcessInDiscRspCmd( zclIncomingMsg_t *pInMsg );
    #endif
    
    /*********************************************************************
     * ZCL General Profile Callback table
     */
    static zclGeneral_AppCallbacks_t zclSampleLight_CmdCallbacks =
    {
      NULL,      						        // Basic Cluster Reset command
      NULL,						                // Identify command  
      zclSampleLight_IdentifyQueryRspCB,        // Identify Query Response command
      zclSampleLight_OnOffCB,                   // On/Off cluster command
      NULL,                                     // Level Control Move to Level command
      NULL,                                     // Level Control Move command
      NULL,                                     // Level Control Step 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 commands
    };
    
    /*********************************************************************
     * @fn          zclSampleLight_Init
     *
     * @brief       Initialization function for the zclGeneral layer.
     *
     * @param       none
     *
     * @return      none
     */
    void zclSampleLight_Init( byte task_id )
    {
      zclSampleLight_TaskID = task_id;
    
      // Set destination address to indirect
      //zclSampleLight_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
      //zclSampleLight_DstAddr.endPoint = 0;
      //zclSampleLight_DstAddr.addr.shortAddr = 0;
    
      // 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 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 a test endpoint
      afRegister( &sampleLight_TestEp );
    }
    
    /*********************************************************************
     * @fn          zclSample_event_loop
     *
     * @brief       Event Loop Processor for zclGeneral.
     *
     * @param       none
     *
     * @return      none
     */
    uint16 zclSampleLight_event_loop( uint8 task_id, uint16 events )
    {
      afIncomingMSGPacket_t *MSGpkt;
      
      (void)task_id;  // Intentionally unreferenced parameter
      HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF ); // wrote ASA
      
      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;
              
            default:
              break;
          }
    
          // Release the memory
          osal_msg_deallocate( (uint8 *)MSGpkt );
        }
    
        // return unprocessed events
        return (events ^ SYS_EVENT_MSG);
      }
    
      // Discard unknown events
      return 0;
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_IdentifyQueryRspCB
     *
     * @brief   Callback from the ZCL General Cluster Library when
     *          it received an Identity Query Response Command for this application.
     *
     * @param   srcAddr - requestor's address
     * @param   timeout - number of seconds to identify yourself (valid for query response)
     *
     * @return  none
     */
    static void zclSampleLight_IdentifyQueryRspCB(  zclIdentifyQueryRsp_t *pRsp )
    {
      // Query Response (with timeout value)
      (void)pRsp;
    }
    
    /*********************************************************************
     * @fn      zclSampleLight_OnOffCB
     *
     * @brief   Callback from the ZCL General Cluster Library when
     *          it received an On/Off Command for this application.
     *
     * @param   cmd - COMMAND_ON, COMMAND_OFF or COMMAND_TOGGLE
     *
     * @return  none
     */
    static void zclSampleLight_OnOffCB( uint8 cmd )
    {
      // Turn on the light
      if ( cmd == COMMAND_ON )
        zclSampleLight_OnOff = LIGHT_ON;
    
      // Turn off the light
      else if ( cmd == COMMAND_OFF )
        zclSampleLight_OnOff = LIGHT_OFF;
    
      // Toggle the light
      else
      {
        if ( zclSampleLight_OnOff == LIGHT_OFF )
          zclSampleLight_OnOff = LIGHT_ON;
        else
          zclSampleLight_OnOff = LIGHT_OFF;
      }
    
      // In this sample app, we use LED4 to simulate the Light
      if ( zclSampleLight_OnOff == LIGHT_ON ) {
        HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF );
    	HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
    	}
      else {
        HalLedSet( HAL_LED_3, HAL_LED_MODE_ON );
    	HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
    	}
    }
    
    
    /****************************************************************************** 
     * 
     *  Functions for processing ZCL Foundation incoming Command/Response messages
     *
     *****************************************************************************/
    
    /*********************************************************************
     * @fn      zclSampleLight_ProcessIncomingMsg
     *
     * @brief   Process ZCL Foundation incoming message
     *
     * @param   pInMsg - 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
        // See ZCL Test Applicaiton (zcl_testapp.c) for sample code on Attribute Reporting
        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_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 - incoming message to process
     *
     * @return  none
     */
    static uint8 zclSampleLight_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg )
    {
      zclReadRspCmd_t *readRspCmd;
      uint8 i;
    
      readRspCmd = (zclReadRspCmd_t *)pInMsg->attrCmd;
      for (i = 0; i < readRspCmd->numAttr; i++)
      {
        // Notify the originator of the results of the original read attributes 
        // attempt and, for each successfull request, the value of the requested 
        // attribute
    	
      }
     
      return TRUE; 
    }
    #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 = 0; i < writeRspCmd->numAttr; i++)
      {
        // Notify the device of the results of the its original write attributes
        // command.
    
      }
    
      return TRUE; 
    }
    #endif // ZCL_WRITE
    
    /*********************************************************************
     * @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 )
    {
      // zclDefaultRspCmd_t *defaultRspCmd = (zclDefaultRspCmd_t *)pInMsg->attrCmd;
       
      // Device is notified of the Default Response command.
      (void)pInMsg;
      
      return TRUE; 
    }
    
    #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 = 0; i < discoverRspCmd->numAttr; i++ )
      {
        // Device is notified of the result of its attribute discovery command.
      }
      
      return TRUE;
    }
    #endif // ZCL_DISCOVER
    
    
    /****************************************************************************
    ****************************************************************************/
    
    
    

    /**************************************************************************************************
      Filename:       zcl_samplelight_data.c
      Revised:        $Date: 2008-03-11 11:01:35 -0700 (Tue, 11 Mar 2008) $
      Revision:       $Revision: 16570 $
    
    
      Description:    Zigbee Cluster Library - sample device application.
    
    
      Copyright 2006-2007 Texas Instruments Incorporated. All rights reserved.
    
      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License").  You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product.  Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.
    
      YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
      PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
      INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, 
      NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
      OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
      OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
      (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
    
      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com. 
    **************************************************************************************************/
    
    /*********************************************************************
     * INCLUDES
     */
    #include "ZComDef.h"
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDConfig.h"
    
    #include "zcl.h"
    #include "zcl_general.h"
    #include "zcl_ha.h"
    
    #include "zcl_samplelight.h"
    
    /*********************************************************************
     * CONSTANTS
     */
    
    #define SAMPLELIGHT_DEVICE_VERSION     0
    #define SAMPLELIGHT_FLAGS              0
    
    #define SAMPLELIGHT_HWVERSION          1
    #define SAMPLELIGHT_ZCLVERSION         1
    
    /*********************************************************************
     * TYPEDEFS
     */
    
    /*********************************************************************
     * MACROS
     */
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    
    // Basic Cluster
    const uint8 zclSampleLight_HWRevision = SAMPLELIGHT_HWVERSION;
    const uint8 zclSampleLight_ZCLVersion = SAMPLELIGHT_ZCLVERSION;
    const uint8 zclSampleLight_ManufacturerName[] = { 16, 'T','e','x','a','s','I','n','s','t','r','u','m','e','n','t','s' };
    const uint8 zclSampleLight_ModelId[] = { 16, 'T','I','0','0','0','1',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
    const uint8 zclSampleLight_DateCode[] = { 16, '2','0','0','6','0','8','3','1',' ',' ',' ',' ',' ',' ',' ',' ' };
    const uint8 zclSampleLight_PowerSource = POWER_SOURCE_MAINS_1_PHASE;
    
    uint8 zclSampleLight_LocationDescription[17] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
    uint8 zclSampleLight_PhysicalEnvironment = 0;
    uint8 zclSampleLight_DeviceEnable = DEVICE_ENABLED;
    
    // Identify Cluster
    uint16 zclSampleLight_IdentifyTime = 0;
    
    // On/Off Cluster
    uint8  zclSampleLight_OnOff = LIGHT_ON;
    
    /*********************************************************************
     * ATTRIBUTE DEFINITIONS - Uses REAL cluster IDs
     */
    CONST zclAttrRec_t zclSampleLight_Attrs[SAMPLELIGHT_MAX_ATTRIBUTES] =
    {
      // *** General Basic Cluster Attributes ***
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,             // Cluster IDs - defined in the foundation (ie. zcl.h)
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        {  // Attribute record
          ATTRID_BASIC_HW_VERSION,            // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
          ZCL_DATATYPE_UINT8,                 // Data Type - found in zcl.h
          ACCESS_CONTROL_READ,                // Variable access control - found in zcl.h
          (void *)&zclSampleLight_HWRevision  // Pointer to attribute variable
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_ZCL_VERSION,
          ZCL_DATATYPE_UINT8,
          ACCESS_CONTROL_READ,
          (void *)&zclSampleLight_ZCLVersion
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_MANUFACTURER_NAME,
          ZCL_DATATYPE_CHAR_STR,
          ACCESS_CONTROL_READ,
          (void *)zclSampleLight_ManufacturerName
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_MODEL_ID,
          ZCL_DATATYPE_CHAR_STR,
          ACCESS_CONTROL_READ,
          (void *)zclSampleLight_ModelId
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_DATE_CODE,
          ZCL_DATATYPE_CHAR_STR,
          ACCESS_CONTROL_READ,
          (void *)zclSampleLight_DateCode
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_POWER_SOURCE,
          ZCL_DATATYPE_UINT8,
          ACCESS_CONTROL_READ,
          (void *)&zclSampleLight_PowerSource
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_LOCATION_DESC,
          ZCL_DATATYPE_CHAR_STR,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)zclSampleLight_LocationDescription
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_PHYSICAL_ENV,
          ZCL_DATATYPE_UINT8,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)&zclSampleLight_PhysicalEnvironment
        }
      },
      {
        //ZCL_CLUSTER_ID_GEN_BASIC,
    	ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_BASIC_DEVICE_ENABLED,
          ZCL_DATATYPE_BOOLEAN,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)&zclSampleLight_DeviceEnable
        }
      },
    
      // *** Identify Cluster Attribute ***
      {
        ZCL_CLUSTER_ID_GEN_IDENTIFY,
        { // Attribute record
          ATTRID_IDENTIFY_TIME,
          ZCL_DATATYPE_UINT16,
          (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
          (void *)&zclSampleLight_IdentifyTime
        }
      },
    
      // *** On/Off Cluster Attributes ***
      {
        ZCL_CLUSTER_ID_GEN_ON_OFF,
        { // Attribute record
          ATTRID_ON_OFF,
          ZCL_DATATYPE_UINT8,
          ACCESS_CONTROL_READ,
          (void *)&zclSampleLight_OnOff
        }
      },
    };
    
    /*********************************************************************
     * SIMPLE DESCRIPTOR
     */
    // This is the Cluster ID List and should be filled with Application
    // specific cluster IDs.
    #define ZCLSAMPLELIGHT_MAX_INCLUSTERS       5
    const cId_t zclSampleLight_InClusterList[ZCLSAMPLELIGHT_MAX_INCLUSTERS] =
    {
      ZCL_CLUSTER_ID_GEN_BASIC,
      ZCL_CLUSTER_ID_GEN_SCENES,
      ZCL_CLUSTER_ID_GEN_GROUPS,
      ZCL_CLUSTER_ID_GEN_ON_OFF,
      ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL
    };
    
    #define ZCLSAMPLELIGHT_MAX_OUTCLUSTERS       2
    const cId_t zclSampleLight_OutClusterList[ZCLSAMPLELIGHT_MAX_OUTCLUSTERS] =
    {
      ZCL_CLUSTER_ID_GEN_BASIC,
      ZCL_CLUSTER_ID_GEN_ON_OFF
    };
    
    SimpleDescriptionFormat_t zclSampleLight_SimpleDesc =
    {
      SAMPLELIGHT_ENDPOINT,                  //  int Endpoint;
      ZCL_HA_PROFILE_ID,                     //  uint16 AppProfId[2];
      //ZCL_HA_DEVICEID_DIMMABLE_LIGHT,        //  uint16 AppDeviceId[2];
      ZCL_CLUSTER_ID_GEN_ON_OFF,             //  uint16 AppDeviceId[2];
      SAMPLELIGHT_DEVICE_VERSION,            //  int   AppDevVer:4;
      SAMPLELIGHT_FLAGS,                     //  int   AppFlags:4;
      ZCLSAMPLELIGHT_MAX_INCLUSTERS,         //  byte  AppNumInClusters;
      (cId_t *)zclSampleLight_InClusterList, //  byte *pAppInClusterList;
      ZCLSAMPLELIGHT_MAX_OUTCLUSTERS,        //  byte  AppNumInClusters;
      (cId_t *)zclSampleLight_OutClusterList //  byte *pAppInClusterList;
    };
    
    /*********************************************************************
     * GLOBAL FUNCTIONS
     */
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    
    /****************************************************************************
    ****************************************************************************/
    
    
    

    4274.zcl_samplelight.h

    Thanks a lot.

    BR

    Alex

     

  • Do you mean that, when you config your Sample Light as router, it can reach on the zclSampleLight_event_loop in the ZCL_INCOMIG MSG but if you config it to end device, it can't reach ZCL_INCOMIG MSG?

  • Hi Yikai Chen.

    No, my router just send the CMD On/Off when the Device (Sample Light)  was joined as Router (FFD). I included the Device as a EndDevice in this post jut to compare my solution with the TI trivial solution Sample SW (Router) and Sample Light (EndDevice). Maybe the SampleLight is prepared t just o working as a EndDevice and because it i cant see the ZCL_INCOMING triggered (when i using as a Router). But i cant see any parameter that can show it to me.

    My main problem is, when DEVICE (as a Router) received the CMD on/off from a commercial Gateway i cant see the  zclSampleLight_event_loop/ZCL_INCOMING reached. I just see the beginning of the  zclSampleLight_event_loop reached, with the same Device, during joining procedure, when the DEVICE received the PermitJoinReq from the Gateway.

    Thanks a lot for your assistance.

    BR

    Alex

     

  • I would suggest you to use a sniffer to have a look and make sure the destination address and endpoint of your ZCL on/off command is correct.

  • Hi Mr  Yikai, firstly i would like to say thanks a lot for your assistance.

    As you suggest to me i was check the DstAdd and DEP and  was compare, my device, with a Device Light Switch from a same gateway vendor. As i explain it for you below:

    Device 1 (same vendor) - Light Switch:

    MAC layer DstAdd: 3CB8 (you can see on the PIC below):

    HA laye DEP:10

    Device 2 (My with a sample Light Code):

    MAC Layer DstAdd: 797F

    HA laye DEP:10

    I was see that has a little bit difference, between two devices, during Join Procedure, on the AssociationReq sent from the Device (Router) to Commercial Gateway, i was compare the two devices,  and see that the device types is totally different the 1st is FFD and 2st is RFD , but i think that it is not relevant. You can see the differences below:

    Device 1 (same vendor) - Light Switch:

    Type: FFD

    Device 2 (My with a sample Light Code):

    Type: RFD

    Thanks a lot.

    BR

    Alex

  • The on/of command will be passed to zclSampleLight_OnOffCB and not go to ZCL_INCOMING_MSG. This is why you don't reach it. You can set breakpoint on zclSampleLight_OnOffCB to check.

  • Hi Yikai, 

    i included Breakpoints on the zclSampleLight_OnOffCB and i got the same behavior is not reached! After it i was analyze again your last suggestion about DEP. I´ll trye to explain for you below.

    I wrote for you that a DEP sent by the ZC (Gateway), i make a little bit confusion, sorry, i would be informed the DEP sent by My ZED.  I have check the address, sent from ZED (My Device) and ZC (Commercial Gateway) and ZED (reference from the same vendor). i was able to check that the DefaultResp sent by ZED (reference) have a DEP value as 10.

    After it i was check on the zcl_sample.c on topic "Set destination address to indirect"  and I  have see a follow value:

    // zclSampleLight_DstAddr.endPoint = 0;

    Maybe the problem will not be this. The DstAddr value, according your last concern?

    I was remove the comments at this topic (three lines) and change the DsAddr.endPoint to:

    zclSampleLight_DstAddr.endPoint = 0xA;

    During the compile procedure i got the follow error:

    Error[Pe020]: identifier "zclSampleLight_DstAddr" is undefined C:\Texas Instruments\ZStack-CC2530-2.4.0-1.4.0\Projects\zstack\HomeAutomation\SampleLightAJS\Source\zcl_samplelight.c 157

    Would you suggest me how to define the ZclsampeLight_DstAddrr?

    BR

    Alex

  • I am really confused by your description now. Let my try to clarify your problem. You have a coordinator that is made by 3rd party and you want to make your own samplelight which can receive on/off command from 3rd party's coordinator. Is this what you intend to do?

  • Sorry Mr Yikai Chen. I´ll try to clarify for you bellow.

    I have two commercial devices (ZED and ZC-Gateway) from the same vendor (Mstartech China), i am using the commercial ZED) to compare with my ZED (TI SampleLight) Light device.

    My ZED received the ZCL HA CMD-ON/OFF, as i was explain for you, and not sending the HA DefaultResp, i just see on the Protocol Analyzer MAC Layer with  ACK in response to the HA CMD On/Off. As i told you yesterday i was start Breakpoints on zclSampleLight_OnOffCB and was never reached.

    Thanks a lot

    BR

    Alex

  • Mr Yikai, i was change on my ZED the destination address to indirect parameters, compiled and started the Debug mode on IAR, i was set the follow parameters:

    //zclSampleLight_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
    zclSampleLight_DstAddr.addrMode = (afAddrMode_t)Addr16Bit; --->>>> inserted this
    zclSampleLight_DstAddr.endPoint = 0xA; --->>>> inserted this
    //zclSampleLight_DstAddr.addr.shortAddr = 0; (i kept the original)

    I include the correct declaration variable zclSampleLight_DstAddr.

    I can't see any changes on the Protocol Analyzer. My ZED continued not responding the ZCL CMD on/off.

    BR

    Alex

     

  • Before ZC sends command to your sample light, ZC need to know the short address of your sample light. So, the problem might be on ZC. Do you use packet sniffer to check the destination address of on/off command is the address of your sample light?

  • Hi Mr Yikai. Thanks a lot!

    I including here the sniffer from ZED (Commercial) and mine ZED (samplelight) and seem to have a little differences on ZCL-CMD On/off sent by ZC, but the DstAdd is correct! 

    Commercial ZED associated on ZC and received CMD-On/Off (NWK-Layer):

    DstAdd: 3CB8

    Mime ZED associated on ZC and received CMD-On/Off (NWK-Layer):

    DstAdd: 7973

    I was observe differences also in long logMAC, as you can see bellow:

    Commercial ZED associated on ZC - LOGMAC

    LongMAC: 1CAF:0000

    Mine ZED associated on ZC - LOGMAC

    LongMAC: 00A200040100004

  • The original endpoint of Sample light is 13.

    #define SAMPLELIGHT_ENDPOINT            13

    Please check if the on/off command send to endpoint 13. I suspect your the ZC sends on/off command to endpoint 10 only. If so, you need to change "#define SAMPLELIGHT_ENDPOINT            13" to "#define SAMPLELIGHT_ENDPOINT            10".

  • Mr Yikai. Excellent now is running well. Thanks a lot for your assistance.

    You are the BEST!!!

    BR

    Alex 

  • HI Mr Yikai. Would you can help me, please!

    The commercial Gateway didn't recognized the DefaultResp sent from my ZED (SampleLight). I was analyze the DefaultResp and compared with a Commercial ZED and saw that:

    On the NWK layer:

    The DestAddress (Destination Address) is: 0000, totally different that i saw on the Commercial ZED:

    The DestAddress (Destination Address) is: FFFC.

    Did you can advise me, please, how to I can change the NWK DestAddress to FFFC on my Device (SampleLight)?

     

    BR

    ALEX

  • The address 0xFFFC is used to send to all routers and the coordinator. Why do you think The commercial Gateway didn't recognized the DefaultResp sent from your ZED? 

  • Hi Mr Yikai. 

    I understand after your explanation. After it i observed the differences between commercial ZED and Mine and see that on the DefaultResp (from Commercail ZED) have a Payload (APS Payload) as you can see bellow:

    Would you give me direction, please, to include APS Payload on the DefaultResp?

    I was observed also that for each command On/Off the Commercial ZED sent 3 DefaultRep as you can see above.

    Thanks a lot for your assistance.

    BR

    Alex

  • I have no idea why your reference device sends 3 DefaultResp and I see the three DefaultResp using the same seq  133.  in my design and my reference devices, there is only one DefaultResp. Could you tell me which zigbee soc or module does your reference device use? Do they pass zigbee certification?

  • Hi Mr Yikai. Thanks a lot for your assistance again.

    I using as reference Mstartech from China. I haven't seen on Zigbee Org.

    I thinks that the 3 default responses is not the main problem. Probably the ZC (GW) didn't see my DefaultResp because the additional byte not included on APS Payload. 

    I already study during toaday and i cant find how to include the Payload on my DefaultResp as a Mstartech DefaultResp.

    You can see bellow the Mstartech DefaultResp:

    Did you can advise me how to include it (payload) on my DefaultResp?

    BR

    Alex

  • You can try to revise zcl_SendDefaultRspCmd and zcl_ProcessMessageMSG in zcl.c