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.

LP-CC2652RB: Reducing OTA update time?

Part Number: LP-CC2652RB


Hello,

Is there a way to reduce the time required to perform an OTA update? My current project for a zigbee device with ota is based on a sample temperature sensor app and stands at 172KB with UI disabled and optimisation level Z. Looking through repositories of other zigbee devices i see binary sizes in the order of 50-100KB and update times of a few dozens minutes. My binary file is so large that updates take upwards of 90 minutes to complete.

Can i remove further libraries or functionalities from the sample project to reduce its size? My only addition is a processing task and a SHT35 driver that is just a couple of functions. And I2C as a communication protocol. 

Is there an option to increase packet size or raise the transmission rate to one significantly higher, thus bringing down the update time to a more acceptable duration? By default it seems that requests for new image packets are issued about once every second. 

  • This might be more related to your SED polling rate and I suggest you to decrease polling rate during OTA to see if it improves.

  • Hello,

    You can try increasing the OTA_MAX_MTU.  Relevant threads: https://e2e.ti.com/search?q=OTA_MAX_MTU 

    Default example OTA updates usually take 5 to 10 minutes from start to completion, so I agree with YK that something else is amiss.  How many devices are in the network and actively communicating?  Do you have a sniffer log of the OTA update to share?

    Regards,
    Ryan

  • Hello Ryan,

    I've increased the MTU to 64 (as it seems that a zigbee packet is 127 bytes; actual payload sizes i've seen mentioned vary in size so i've stuck with 64) and saw an improvement in transmission time, but still not acceptable. If SED refers to the polling time that can be set in the Power Management section of syscfg, i've set it to 1000ms and got an update time of around 40 minutes. That is still too high and would ruin standby power consumption.

    There are only three zigbee devices in the network but many other 2.4GHz wifi devices. I'm not sure if these would cause interference. I don't have a sniffer and cannot get one anytime soon, unfortunately.

    If i could get an update time of ~40 minutes and keep the power savings, though still too large, could be acceptable. 

    I've looked around the code and found the otaClient_ProcessOTAMsgs function that seems to have a call to otaClient_setPollRate to set a new polling rate for OTA, but choosing a smaller poll rate didn't have any effect.

    static void otaClient_ProcessOTAMsgs( zclOTA_CallbackMsg_t* pMsg )
    {
      bool RxOnIdle;
    
      switch(pMsg->ota_event)
      {
      case ZCL_OTA_START_CALLBACK:
        if (pMsg->hdr.status == ZSuccess)
        {
          // Speed up the poll rate
          RxOnIdle = true;
          otaClient_setPollRate(500, RxOnIdle); // otaClient_setPollRate(2000, RxOnIdle);
        }
        break;
    
      case ZCL_OTA_DL_COMPLETE_CALLBACK:
        if (pMsg->hdr.status == ZSuccess)
        {
    
          otaClient_loadExtImage(ST_FULL_IMAGE);
        }
        else
        {
    #if (ZG_BUILD_ENDDEVICE_TYPE)
          // slow the poll rate back down.
          RxOnIdle = false;
          otaClient_setPollRate(POLL_RATE_MAX, RxOnIdle);
    #endif
        }
        break;
    
      default:
        break;
      }
    
      OsalPort_free(pMsg);
    }

    Also, the original value of 2000 was hardcoded and had no connection to the polling rate that can be configured through syscfg.

    Is there a different function with/from which i could increase the polling rate for the duration of the OTA and then lower it back down to save on power? Any guidance will be appreciated. 

  • Did you change MTU for the OTA server project as well?  You brought up a good point with otaClient_ProcessOTAMsgs, can you please try to change POLL_RATE_TYPE_APP_1 to POLL_RATE_TYPE_DEFAULT and disable the response/queued poll rates

            // disable response and queued poll rates
            writeReq.pollRate = POLL_RATE_MAX;
            writeReq.pollRateType = POLL_RATE_TYPE_QUEUED;
            Zstackapi_sysConfigWriteReq(appServiceTaskId, &writeReq);
            writeReq.pollRateType = POLL_RATE_TYPE_RESPONSE;
            Zstackapi_sysConfigWriteReq(appServiceTaskId, &writeReq);

    This is sampled from zcl_samplesw.c for power test cases

    #if defined (POWER_TEST_POLL_ACK) || defined (POWER_TEST_POLL_DATA)
            // set poll rate to POLL_RATE after joining
            zstack_sysConfigWriteReq_t writeReq = { 0 };
            // Set the new poll rates
            writeReq.has_pollRate = true;
            writeReq.pollRate = POLL_RATE;
            writeReq.pollRateType = POLL_RATE_TYPE_DEFAULT;
            Zstackapi_sysConfigWriteReq(appServiceTaskId, &writeReq);
            // disable response and queued poll rates
            writeReq.pollRate = POLL_RATE_MAX;
            writeReq.pollRateType = POLL_RATE_TYPE_QUEUED;
            Zstackapi_sysConfigWriteReq(appServiceTaskId, &writeReq);
            writeReq.pollRateType = POLL_RATE_TYPE_RESPONSE;
            Zstackapi_sysConfigWriteReq(appServiceTaskId, &writeReq);
    #endif

    Note that CSMA/CA backoffs from significant channel traffic could delay Zigbee communication.  You can try finding a less noisy channel if able.

    Regards,
    Ryan