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.

CC2652R: Zigbee & Thread forum

Part Number: CC2652R
Other Parts Discussed in Thread: UNIFLASH, Z-STACK, SIMPLELINK-CC13X2-26X2-SDK

Hi TI Team,

Previously we did not encounter any problem when we used zed switch (non-ota) where coordinator send report data to ZED upon commissioning.

We want to expand our ZED devices with FOTA using sdk 310.

Note: we reset first, and load the BIM using uniflash also and FOTA operation can work..

Here is basic config as below using  zed switch-ota :

But when I just run debug and put breakpoint in zclSampleSw_ProcessInReportCmd function, but the breakpoint is not kicking in.

1. Did we miss anything in configuration of sample code with FOTA?

Regards,

Walter

  • Hi TI Team,

    I used the zed switch non-ota with exactly the same basic modification as zed switch with ota sample code.

    When I just run debug and put breakpoint in zclSampleSw_ProcessInReportCmd function, the breakpoint is kicking in.

    It seems an SDK issue please confirm. 

    Also, please note that the issue is only incoming message. Sending outgoing message can send successfully.

    Regards,

    Walter

  • Hi Ryan,

    I need feedback from you, because our project completely stop at the moment until we  know FOTA package can work or no.

    Regards,

    Walter

  • Hi Walter,

    Are you able to break inside zclParseInReportCmd or zclSampleSw_ProcessIncomingMsg for an attribute report?  Have you compared the zcl_samplesw[_data].c/.h files for any differences?  Is the issue replicable with the v4.10 SDK?

    Regards,
    Ryan

  • Hi Ryan,

    We compared no difference zcl_samplesw[_data].c/.h  between the sample code with ota and with no-ota.

    Also, cannot break inside zclSampleSw_ProcessIncomingMsg.This problem in zed switch ota we saw in sDK3.10 and SDK3.20. No problem in sample switch(non-ota) in  in sDK3.10.

    For latest SDK I will try and let you know.

    Can anyone confirm this problem in zed switch ota sample code?

    Regards,

    Walter

  • Hi Ryan,

    I used the sdk310/3.20, it can break in zclParseInReportCmd in zcl.c but not in zclSampleSw_ProcessIncomingMsg.

    Please give us idea how to resolve.

    Regards,

    Walter

  • Hi Walter,

    Thank you for bringing this to our attention.  Using OTAClient_SetEndpoint(SAMPLESW_ENDPOINT); calls zclport_registerZclHandleExternal(OTA_ProcessUnhandledFoundationZCLMsgs); which overwrites zclport_registerZclHandleExternal(zclSampleSw_ProcessIncomingMsg);.  Currently, Z-Stack applications only register one function to zcl_HandleExternal and therefore only a single callback can handle ZCL messages.  This appears problematic when attempting to have 2 or more endpoints coexist, such as OTA alongside an application.  All SDK versions are affected by this issue.  I will work with the Software Development Team to resolve the issue and provide a workaround as soon as possible.

    Regards,
    Ryan

  • Hi Ryan,

    Thanks for confirming this issue. 

    Please let us know if you have work-around because we need it ASAP.

    Regards,

    Walter

  • // multiple endpoint for ZCL handler external, added by luoyiming 2020-02-08
    typedef struct
    {
        void *next;
        uint8_t endpoint;
        zclport_pFnZclHandleExternal pfn;
    } zclHandleExternalList_t;
    
    ...........................................................................
    
    // Function pointer for applications to ZCL Handle External
    // added multiple endpoint processing by luoyiming at 2020-02-08
    zclHandleExternalList_t *zclHandleExternalList = NULL;
    
    
    ..........................................................................
    
    /**
     * Call to register a function pointer to handle zcl_HandleExternal() messages.
     * Added multiple endpoint processing by luoyiming at 2020-02-08.
     *
     * Public function defined in zcl_port.h
     */
    bool zclport_registerZclHandleExternal( uint8_t endpoint, zclport_pFnZclHandleExternal pfn )
    {
        zclHandleExternalList_t *find = zclHandleExternalList;
        zclHandleExternalList_t *tail = NULL;
        // If endpoint is valid, added by luoyiming 2020-02-08
        if ( zcl_afFindEndPointDesc( endpoint ) == NULL )
        {
            return false;
        }
    
        // match if there be same endpoint and find tail item, fixed by luoyiming 2020-02-08
        while ( find )
        {
            if ( find->endpoint == endpoint )
            {
                find->pfn = pfn;
                return true;
            }
            if ( find->next == NULL )
            {
                tail = find;
            }
            find = find->next;
        }
    
        // add new item,  fixed by luoyiming 2020-02-08
        zclHandleExternalList_t *newItem = zcl_mem_alloc( sizeof(zclHandleExternalList_t) );
        if ( newItem )
        {
            newItem->next = NULL;
            newItem->endpoint = endpoint;
            newItem->pfn = pfn;
            if ( zclHandleExternalList == NULL )
            {
                zclHandleExternalList = newItem;
            }
            else
            {
                tail->next = newItem;
            }
            return true;
        }
        return false;
    }
    
    
    ..............................................
    
    
    
    
    /*********************************************************************
     * @fn      zcl_HandleExternal
     *
     * @brief   Callback function to handle messages externally
     *
     * @param   pInMsg - incoming message to process
     *
     * @return  TRUE
     */
    uint8_t zcl_HandleExternal(zclIncoming_t *pInMsg)
    {
    
    #ifdef BDB_REPORTING
        zclIncomingMsg_t *pCmd;
    
        pCmd = (zclIncomingMsg_t *)OsalPort_msgAllocate( sizeof ( zclIncomingMsg_t ) );
        if ( pCmd != NULL )
        {
          // fill in the message
          pCmd->hdr.event = ZCL_INCOMING_MSG;
          pCmd->zclHdr    = pInMsg->hdr;
          pCmd->clusterId = pInMsg->msg->clusterId;
          pCmd->srcAddr   = pInMsg->msg->srcAddr;
          pCmd->endPoint  = pInMsg->msg->endPoint;
          pCmd->attrCmd   = pInMsg->attrCmd;
    
          if(pCmd->zclHdr.commandID == ZCL_CMD_CONFIG_REPORT)
          {
            zstack_bdbProcessInConfigReportReq_t Req = {0};
            Req.pZclIncommingMsg = pCmd;
    
            Zstackapi_bdbProcessInConfigReportCmd(zclPortFindEntity(pCmd->endPoint),&Req);
            OsalPort_msgDeallocate((uint8_t*)pCmd);
            return TRUE;
          }
          if(pCmd->zclHdr.commandID == ZCL_CMD_READ_REPORT_CFG)
          {
            zstack_bdbProcessInReadReportCfgReq_t Req = {0};
            Req.pZclIncommingMsg = pCmd;
    
            Zstackapi_bdbProcessInReadReportCfgCmd(zclPortFindEntity(pCmd->endPoint),&Req);
    
            OsalPort_msgDeallocate((uint8_t*)pCmd);
            return TRUE;
          }
          OsalPort_msgDeallocate((uint8_t*)pCmd);
        }
    
    #endif
    
        // zclHandleExternal for multiple endpoint, fixed by luoyiming 2020-02-08
        zclHandleExternalList_t *find = zclHandleExternalList;
        // Did the application register to handle this message
        while ( find )
        {
            if ( ( find->endpoint == pInMsg->msg->endPoint ) && ( find->pfn ) )
            {
                // Let the application handle it
                return (find->pfn( pInMsg ));
            }
            find = find->next;
        }
        return(TRUE);
    }
    
    
    
    
    

  • Hi Aries/Ryan,

    Thank you.

    I tested it can work if I use different endpoint.

    Initialization like this:

    OTAClient_SetEndpoint(SAMPLESW_ENDPOINT + 1);

    zclport_registerZclHandleExternal(SAMPLESW_ENDPOINT, zclSampleSw_ProcessIncomingMsg);

     Is it needed?

    Regards,

    Walter

  • Hi Ryan/ Aries,

    Configuration 1

    OTAClient_SetEndpoint(SAMPLESW_ENDPOINT + 1);

    zclport_registerZclHandleExternal(SAMPLESW_ENDPOINT, zclSampleSw_ProcessIncomingMsg);

     -- have incoming message but cannot OTA.

    Configuration 2

    OTAClient_SetEndpoint(SAMPLESW_ENDPOINT);

    zclport_registerZclHandleExternal(SAMPLESW_ENDPOINT, zclSampleSw_ProcessIncomingMsg);

     -- No incoming message  but can OTA

    Note: It did not fix the issue.

    Regards,

    Walter

  • If your OTA-Client use same endpoint with application-endpoint, look here :https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/916746

    If your OTA-Client use different endpoint with application-endpoint, define "OTA_STANDALONE" in your project.

  • Hi Ryan,

    I tried to use define "OTA_STANDALONE" and uncommented this static uint8 zclOTA_TaskID to complete build, but got this problem:

    [E0004] Invalid data size for relocation:

     ERROR! at line 861: [E0004] Invalid data size for relocation
    .bits zclOTA_TaskID,8 ; $O1$$.zclOTA_Ep.epType @ 584

    Regards,

    Walter

  • Hi Aries,

    I tried adding yu yuming changes to use same endpoint.

    I noticed that all calls of OTAClient_SetEndpoint uses NULL as second parameter.

    So, I used same in sample switch code:

    #if defined (OTA_CLIENT_CC26XX)

    OTAClient_SetEndpoint(SAMPLESW_ENDPOINT, NULL);

    OTA_Client_Init ( appSemHandle, appServiceTaskId);
    #endif

    But,  no more incoming message if I put breakpoint in zclSampleSw_ProcessIncomingMsg.

    And, commenting :

    #if defined (OTA_CLIENT_CC26XX)

    //OTAClient_SetEndpoint(SAMPLESW_ENDPOINT, NULL);

    //OTA_Client_Init ( appSemHandle, appServiceTaskId);
    #endif

    it it can receive message zclSampleSw_ProcessIncomingMsg.

    Any idea what to pass in OTAClient_SetEndpoit as 2nd parameter from my switch application.

    Regards,

    Walter

  • In your application file "zcl_samplesw.c", fix like this

    static void zclSampleSw_initialization(void)
    {
    
     ......
    
    #if defined (OTA_CLIENT_CC26XX)
        OTAClient_SetEndpoint(SAMPLESW_ENDPOINT , zclSampleSw_ProcessIncomingMsg );
        OTA_Client_Init ( appSemHandle, appServiceTaskId, gCuiHandle );
    #endif
    
    
    }
    

  • The main purpose is force "zclSampleSw_ProcessIncomingMsg" is running in "OTA_ProcessUnhandledFoundationZCLMsgs"

  • Hi Aries,

    Thank you. I confirm same endpoint works with some added fix from luyuming

    Regards,

    Walter

  • Hi Aries/Ryan,

    After adding Aries solution FOTA is working but, I noticed that the commissioning not completing properly.

    We are using smart switch_ota sample code in SDK 3.10.

    Please take a look at the sniffer log.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/158/snifferlog-cannot-complete-commisoning-0x9005.7z

    Regards,

    Walter

  • Hi Walter,

    I assume the PAN ID in question is 0x7E91?  Device short address 0x9005 joins correctly and starts sending regular data requests so can you please clarify what else you are expecting to occur?  If the coordinator is to take further F&B action then please ensure that it has this feature enabled during this time.

    Regards,
    Ryan

  • Hi Ryan,

    My original implementation like this, using non-fota code like this. After node descriptor request/response it can join completely:

     FOTA switch sample code.

    The device in question is 0x9005. After node descriptor request/response it cannot join completely:

    and, Why device sending too many match descriptor request. Is it correct?

  • Hi Walter,

    The ZED joins the network successfully but does not complete binding.  The ZC parent does not respond to Identify Requests, which is why I suggested that you enable F&B mode in the previous reply.  Therefore the ZED never sends a Node Descriptor Request from which to form a bind and start sending attribute reports.  As for the Match Descriptor Requests, this is from ZCL_OTA_SEND_MATCH_DESCRIPTOR_EVT in order to discover the OTA server, which the ZC is also not responding to.  So you would need to further investigate your ZC OTA server solution.

    Note: The newest SIMPLELINK-CC13X2-26X2-SDK version includes several improvements to the OTA solution and I highly implore you to migrate accordingly.

    Regards,
    Ryan