This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: ZNP project added OTA server feature but don't work correctly

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

I added OTA server feature upon ZNP project,but zclOTA_HdlIncoming callback function can't be call on OTA server side. Z-Stack 3.0 ZNP project.

zcl_registerPlugin ( ZCL_CLUSTER_ID_OTA,ZCL_CLUSTER_ID_OTA,zclOTA_HdlIncoming );

This is my following steps:

1. add zclOTA_Init( taskID++ ); at last of osalInitTasks() func;

2. add zclOTA_event_loop events callback at last tasksArr arrary;

3. add Preprocessor MT_OTA_FUNC OTA_SERVER=TRUE OTA_HA in ZNP project options per line;

  zcl_registerPlugin ( ZCL_CLUSTER_ID_OTA,
                       ZCL_CLUSTER_ID_OTA,
                       zclOTA_HdlIncoming );

4. But zclOTA_HdlIncoming callback function can't be call when other OTA client sent a "Query Next Image Request" to ZNP(coordinator mode),what's wrong with me?following image is Ubiqua sniffer capture log:

5. The following image is IAR workbench step through when OTA client(0xF033) sent image request to ZNP(0x0000):

6. I review all Z-Stack 3.0 project source code,I have found ZCL_STANDALONE don't defined by default,I don't know what's meaning. Very very important is zcl_Init( taskID++ ); and zcl_event_loop is not be call in all ZNP project,this caused zcl task can't be create,this may be caused  zcl_TaskID task can't receive any AF message?

// Endpoint for OTA Cluster
static endPointDesc_t zclOTA_Ep =
{
  ZCL_OTA_ENDPOINT,
  0,
#ifndef ZCL_STANDALONE
  &zcl_TaskID,
#else
  &zclOTA_TaskID,
#endif
  ( SimpleDescriptionFormat_t * ) &zclOTA_SimpleDesc,
  ( afNetworkLatencyReq_t ) 0
};

void zclOTA_Init ( uint8 task_id )
{
  zclOTA_TaskID = task_id;

  // Register for the cluster endpoint
  afRegister ( &zclOTA_Ep );

  // Register as a ZCL Plugin
  zcl_registerPlugin ( ZCL_CLUSTER_ID_OTA,
                       ZCL_CLUSTER_ID_OTA,
                       zclOTA_HdlIncoming );

......
......
}

  • Hi Hold Li,

    ZNP architecture is not meant to host the ZigBee application such as OTA or other ZCL clusters, instead is meat to be the network processor.

    Is expected that the Zigbee application will run in a host processor such as the LinuxGateway provided by TI, which by the way, already have the OTA server implemented.

    Can you tell why are you approaching this way? or what you want to archieve with this?, may be there is a better way to do it.

    Hope this helps!
  • Because the newest Z-Stack 3.0 don't supported by old zigbee Linux Gateway(last version update 2014 years,may be TI will be update in the future ,but not now),so that we have to consider use znp-host-framework instead of zigbee Linux Gateway,this framework is so simple that don't include OTA server and full zigbee network processor feature etc..

    We have to add OTA server feature in znp-host-framework by ourself.

    That is real experience,everything have to be done by ourself .TI don't support anything.

    znp-host-framework(last software update  when May 11 2015),zigbee Linux Geteway(last software update when 2014 years). at least two years don't gave support.

    Fortunately,we have found that bugs in znp.eww project,and fix that.

    Steps:

    1. Modify the following source code in znpEventLoop function(znp_app.c source file)

          case AF_INCOMING_MSG_CMD:
    #if defined ZCL_KEY_ESTABLISH
            if (ZCL_KE_ENDPOINT == (((afIncomingMSGPacket_t *)pMsg)->endPoint))
            {
              zcl_ProcessMessageMSG((afIncomingMSGPacket_t *)pMsg);
            }
            else
    #endif
            {
              //comment following line,add zcl_ProcessMessageMSG function call 
              //MT_AfIncomingMsg((afIncomingMSGPacket_t *)pMsg);
              zcl_ProcessMessageMSG((afIncomingMSGPacket_t *)pMsg);
            }
            break;

    2. Rebuilt znp.eww project,zclOTA_HdlIncoming callback function must be work correctly.

  • Can you tell what you mean by Z3.0 is not supported by the old gateway?
    I remember that I did some basic network testings with this and I did work for me.
    Also, is my understanding that an update for Z3.0 SDK and the Linux Gateway framework is comming soon.

    Anyway, so you have your project working or you have any other issue?
  • I have been attempted porting zigbee Linux Gateway to another arm linux platform(default arm linux platform is AM335x Soc) three month ago,use the Z-Stack 3.0 ZNP project,in the beginning is built error,I solve them,at last is running error,include communication error and a lot of strange error.
    I have to consult the TI's FAE,he say the Z-Stack 3.0 don't support current zigbee Linux Gateway(issued by TI 2014 years),Finally, I have to give up.
    TI's FAE gave me another solution,this is the above-mentioned znp-host-framework,but this don't include OTA server feature,I have to porting the OTA server source code from zigbee Linux Gateway,I have done that work successful.
    Currently,I will debugging the ZNP communication with other zigbee node,include Image Request,Block Request etc.
  • Currently,I have encounter a bugs.

    1. On OTA upgrade Image Request Stage,OTA server will sent "Image Response" to OTA client with imageSize to tell the client there image size,but client receive incorrect.

    2. The following Image present left side is Ubiqua sniffer capture"Query Next Image Response",imageSize is 132964(0x20764),I'm guarantee sent side must be correct,right side is step through on client side in zclOTA_ProcessQueryNextImageRsp function(IAR workbench IDE),but the receive side received imageSize is zero,what's wrong with me? This may be a IAR workbench build tool chain bugs?

    3. The following image present the memory contents on client side.The red mark on the right side is memory contents of 4 bytes imageSize(part of structure zclOTA_QueryImageRspParams_t),as we see,the receive content seem correct,and osal_build_uint32 return seem no error,but imageSize is zero,this is very very strange.

  • Hi Hold Li,

    That is pretty strange...
    Have you manage to solve it?
  • I have solve that bugs(this may be caused by IAR for ARM tool chain),I reboot the computer and reopen IAR for ARM,all well.