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.

IAS sample from TI can not work

Other Parts Discussed in Thread: CC2530EM, Z-STACK

Dear TI,

I got the IAS samples  “IAS sample code-1_2_1.zip” from TI, and there are two projects “SampleCIE” and “6683.SampleFireDetector”. I compile these two projects with IAR 8.30.2, and they show the similar warning messages as follows. When using sniffer to watch packets, after run the EZMode then I do not see the change notification by push the smartRF05 SW1 and I think it don't send the alarm to CIE.

What modification do I need to make these two IAS samples work normally?

Environment: Z-Stack 1.2.1, IAR 8.30.2, CC2530EM

 

  • These warnings seem come from mismatching API call with Z-Stack Home 1.2.1. Where do you download IAS sample code-1_2_1.zip?
  • Hi TI, any suggestion or help?

    Hi YiKai, this zip file is a source code for http://processors.wiki.ti.com/index.php/Fire_Alarm_System.

  • There is already no link to download the fire alarm source code from  and I believe the source code you downloaded has to work with old Z-Stack version. So, which Z-Stack version do you use?

  • Hi YK,

    Thanks for your help.

    Sorry forget to say, I got this IAS sample from  local TI sales representative, and it is indeed no download link on the web site. Since this sample use EZ_Mode, I think it should be used with zstack 1.2.1, and I build this IAS sample with zstack 1.2.1.

    /*********************************************************************
     * @fn      zclSampleFireDetector_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_5
     *                 HAL_KEY_SW_4
     *                 HAL_KEY_SW_3
     *                 HAL_KEY_SW_2
     *                 HAL_KEY_SW_1
     *
     * @return  none
     */
    static void zclSampleFireDetector_HandleKeys( byte shift, byte keys )
    {
      if ( keys & HAL_KEY_SW_1 )
      {
        // Fire Alarm
        giFireDetectorScreenMode = FIREDETECTOR_MAINMODE;
        zclSampleFireDetector_SendChangeNotification() ;
      }
    
      else if ( keys & HAL_KEY_SW_2 )
      {
        if ( ( giFireDetectorScreenMode == FIREDETECTOR_MAINMODE ) ||
            ( giFireDetectorScreenMode == FIREDETECTOR_HELPMODE ) )
        {
          giFireDetectorScreenMode = FIREDETECTOR_MAINMODE;
    
    #ifdef ZCL_EZMODE
          zclEZMode_InvokeData_t ezModeData;
          static uint16 clusterIDs[] = { ZCL_CLUSTER_ID_SS_IAS_ZONE };
    
          // Invoke EZ-Mode
          ezModeData.endpoint = SAMPLEFIREDETECTOR_ENDPOINT; // endpoint on which to invoke EZ-Mode
          if ( ( zclSampleFireDetector_NwkState == DEV_ZB_COORD ) ||
               ( zclSampleFireDetector_NwkState == DEV_ROUTER )   ||
               ( zclSampleFireDetector_NwkState == DEV_END_DEVICE ) )
          {
            ezModeData.onNetwork = TRUE;      // node is already on the network
          }
          else
          {
            ezModeData.onNetwork = FALSE;     // node is not yet on the network
          }
          ezModeData.initiator = TRUE;        //  initiator
          ezModeData.numActiveInClusters = 1;
          ezModeData.pActiveInClusterIDs = clusterIDs;
          ezModeData.numActiveOutClusters = 0;   // active output cluster
          ezModeData.pActiveOutClusterIDs = NULL;
          zcl_InvokeEZMode( &ezModeData );
    
    #ifdef LCD_SUPPORTED
          HalLcdWriteString( "EZMode", HAL_LCD_LINE_2 );
    #endif
    
          // NOT ZCL_EZMODE, Use EndDeviceBind
    #else
          {
            zAddrType_t dstAddr;
            dstAddr.addrMode = Addr16Bit;
            dstAddr.addr.shortAddr = 0;   // Coordinator makes the EDB match
    
            // Initiate an End Device Bind Request, this bind request will
            // only use a cluster list that is important to binding.
            HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
            ZDP_EndDeviceBindReq( &dstAddr, NLME_GetShortAddr(),
                                  SAMPLEFIREDETECTOR_ENDPOINT,
                                  ZCL_HA_PROFILE_ID,
                                  0, NULL,
                                  ZCLSAMPLEFIREDETECTOR_BINDINGLIST, bindingOutClusters,
                                  FALSE );
          }
    #endif // ZCL_EZMODE
        }
      }
    
      
      else if ( shift && ( keys & HAL_KEY_SW_5 ) )
      {
        giFireDetectorScreenMode = FIREDETECTOR_MAINMODE;
        zclSampleFireDetector_BasicResetCB();
        
      }
      else if ( keys & HAL_KEY_SW_5 )
      {
       giFireDetectorScreenMode = FIREDETECTOR_HELPMODE;
      }
    
      // update display
      zclSampleFireDetector_LcdDisplayUpdate();
    }

  • I don't have the source files. Maybe you can attach it and I will try.
  • Hi YK,

    I am not sure whether I can attach this IAS sample on public forum or not since TI do not have download link on web site. Can I mail to you in private like TI e2e forum in China? But I do not find the same function on this forum.

  • Maybe you can request to be my friend on E2E forum and attach source code in private message.
  • I see the same warning in my test. You can disable FEATURE_GREEN_POWER in compile option to solve it.
  • Hi YK,

    Can you tell me how do you know to disable "FEATURE_GREEN_POWER" option to avoid the 4 warning messages?
    There are 6 FEATURE_GREEN_POWER define, and I do not see the relationship with MAC_McpsDataAlloc, MAC_McpsDataReq, pMacDataTx and MAC_CbackEvent.
  • It's my experiences told me that. Ha!
  • Hi YK,

    I just made some little change, but I can not see change notification response any more. Can you give me some hints to debug why IAS CIE do not send change notification response?  like suggest me to add breakpoint somewhere to trace it. 

    I notice there is default ZCL default response in zcl.c, but where is change notification response command.

    attach file is sniffer log. Thanks for your help.

    no_change_notification_rsp.zip

     if ( UNICAST_MSG( inMsg.msg ) && inMsg.hdr.fc.disableDefaultRsp == 0 )
      {
        // Send a Default Response command back
        defautlRspCmd.statusCode = status;
        defautlRspCmd.commandID = inMsg.hdr.commandID;
        zcl_SendDefaultRspCmd( inMsg.msg->endPoint, &(inMsg.msg->srcAddr),
                               inMsg.msg->clusterId, &defautlRspCmd,
                               ZCL_FRAME_SERVER_CLIENT_DIR, true,
                               inMsg.hdr.manuCode, inMsg.hdr.transSeqNum );
      }

  • If IAS zone sends change notification to CIE, you can set a breakpoint on case ZCL_CMD_REPORT: in zclSampleCIE_ProcessIncomingMsg() to check it.
  • Hi YK,

    1. This sample disable default response, so need to enable it if want to receive response.

    //generates a Zone Status Change Notification Command
    zclSS_IAS_Send_ZoneStatusChangeNotificationCmd(SAMPLEFIREDETECTOR_ENDPOINT,
    &zclCIE_IEEE_Addr,
    zclSampleFireDetector_ZoneStatus, 0, zoneid,0,
    1, 1 );

    2. my question is, if I enable change notification default response, when IAS Zone do not receive change notification response, will IAS Zone resent alarm to CIE automatically? ZigBee have the protocol like the TCP three-way handshaking to guarantee the IAS Zone alarm be received by CIE or not?
  • 1. You can set breakpoint at if ( UNICAST_MSG( inMsg.msg ) && inMsg.hdr.fc.disableDefaultRsp == 0 ) in zcl_ProcessMessageMSG to see if Z-Stack does default response.
    2. No. IAS Zone won't resend alarm to CIE automatically.
  • This sample CIE send the write attribute CIE IEEE address to Zone after enroll, but some company's IAS CIE won't send write attribute after receiving enroll request. And according to Wiki says, "The IAS CIE also sets the IAS CIE Address attribute of the IAS WD remotely by issuing a Send Write attribute command. This could have been accomplished locally in the IAS WD using the address of the incoming Zone Enroll Response, but the method using the Send Write Attribute command was used to illustrate this ZigBee Cluster Library functionality.".

    I trace both functions zclSampleFireDetector_EnrollResponseCB(zclZoneEnrollRsp_t *rsp) and 

    zclSS_ProcessInCmd_ZoneStatus_EnrollResponse( zclIncoming_t *pInMsg, zclSS_AppCallbacks_t *pCBs ), but they don't have CIE IEEE address information in parameters.

    So if I want to write CIE IEEE address when receiving enroll response from CIE in SampleFireDetector, which function can I get the CIE IEEE address to write attribute zclSampleFireDetector_IAS_CIE_Address?

  • There is no IEEE address in Enroll response.
  • So wiki says "This could have been accomplished locally in the IAS WD using the address of the incoming Zone Enroll Response, " is wrong, I still need to send write CIE IEEE address attribute from IAS CIE device to IAS Zone?
  • There is an alternative. You can try to get the short address in zclSS_ProcessInCmd_ZoneStatus_EnrollResponse() and use it to request IEEE address of CIE.

  • Hi James,

    You can use ZDP_IEEEAddrReq( uint16 shortAddr, byte ReqType, byte StartIndex, byte SecurityEnable ) to obtain the IEEE address if you only have the short address of the device.

  • Hi TI,

    If I use this IAS sample with z-stack 1.2.2 and IAR 9.10.3, then the FireDetector's  IAS CIE address attribute cannot get the full 8 byte IEEE address.

    Only write the first 5 byte successfully.

    Can you help to check it?

    I test it's ok in zstack 1.2.1.

  • According to " 如何感知zcl_sendwrite()http://w244627.s117-18.myverydz.com/thread-2118-1-1.html"

    I change CIE address attribute to NULL, and add the callback function zcl_GetReadWriteCB(uint16 clusterId, uint16 attrId, uint8 oper,uint8 *pValue,uint16 *pLen); to debug.

    When I dump the CIE address value, it seems receive correctly.

    So why write CIE address attribute command got the wrong value, do I do anything wrong?

  • Is it possible that write CIE address attribute is not correctly sent to your device?
  • I got what happen,  write CIE IEEE address attribute is success.

    But I need to change IAR watch type to display the correct value.

    And is it correct to use zclReadCmd_t of zcl_SendRead() as below?

        
        afAddrType_t addr;
        addr.endPoint = 17;
        addr.addrMode = (afAddrMode_t) AddrNotPresent;
        addr.addr.shortAddr = 0x0000; 
    
        zclReadCmd_t *readCmd;
        
        readCmd = (zclReadCmd_t *)osal_mem_alloc(sizeof( zclReadCmd_t ));  
        
        readCmd->numAttr = 1;
        readCmd->attrID[0] = ATTRID_SS_IAS_CIE_ADDRESS;                // Attribute ID 
        zcl_SendRead(17, &addr, ZCL_CLUSTER_ID_SS_IAS_ZONE, readCmd, ZCL_FRAME_CLIENT_SERVER_DIR, TRUE, 0);
        

  • It is good to know you find the root cause of CIE address issue. About your question on zcl_SendRead, I don't know what you intend to do. Can you explain?
  • Hi YK,

    according to this TI thread www.deyisupport.com/.../50151.aspx , he change the structure of zclReadCmd_t, so strange?
    Do you have a better solution to handle the use of zclReadCmd_t ?
  • I don't understand what your question on zclReadCmd_t. In general, zcl_SendRead is used for request some attribute from server side. For example, CIE can request CIE address from a ZED to check if the CIE address on ZED is correct.
  • sorry to make you confused, my question is not concerned with zcl_SendRead() now.

    zstack define zclReadCmd_t as bellow,

    typedef struct

    {

     uint8  numAttr;            // number of attributes in the list

     uint16 attrID[];           // supported attributes list - this structure should

                                // be allocated with the appropriate number of attributes.

    } zclReadCmd_t;

    "www.deyisupport.com/.../50151.aspx"

    suggest to change it to

    #define ZCLRead_Max_Attrs_Num  20

    typedef struct

    {

    uint8 numAttr;

    uint16 attrID[ZCLRead_Max_Attrs_Num];

    } zclReadCmd_t;

    I think it is not the good solution, right?

    Can you give me the better solution about the usage of zclReadCmd_t ?

  • It is not good but workable. If you want a clean code, you can allocate memory for uint16 attrID[] before you use it and release it after.
  • Hi James:
    I found you have got the IAS samples “IAS sample code-1_2_1.zip” that what I want, can you tell me where can I download this sample, or can you send a copy for me ? thanks
  • To get IAS samples “IAS sample code-1_2_1.zip, you have to contact TI local representative and sign SLA with TI to get it.
  • Hi Troy,

    As YK says, since TI does not offer in public web site, you need to send your request to TI for IAS sample.

    Or you can try this URL:

    "http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=BEEKIT_WIRELESS_CONNECTIVITY_TOOLKIT&fpsp=1&tab=Design_Tools_Tab"

    I guess it has IAS sample also for reference.