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.

CC3235S: Local OTA state/percentage update

Part Number: CC3235S

Hi,

I'm trying to use the local OTA example.

When i'm sending the Tar file, i don't see any percentage value being refreshed as the download is supposed to progress.

When i look at the developpers option, it seems that the javascript used for this is the function :

function getOtaProgress() {

    if (otaProgressInvoke == 1)
    {
        otaProgressInvoke = 0;
        h = new XMLHttpRequest();
        h.onreadystatechange = function(h) {
            return function() {
                if ((h.readyState == 4) && ((h.status == 200) || (h.status == 204))) {
                    clearTimeout(xmlHttpTimeout);
                    var data = h.response;
                    
                    if(data == "") {
                        
                    }
                    
                    otaProgressInvoke = 1;
                    
                    if(data == "fail"){
                        clearTimeout(xmlHttpTimeout);
                        clearTimeout(otaReportExec);
                        console.log("fail");
                        $(".wrong").show(500);
                    } else {
                        xmlHttpTimeout=setTimeout(ajaxTimeout, 30000);
                        
                        $("#progressPrecent").text(data);
                        $("#progressBar").val(data);
                        if (data == '100'){
                            clearTimeout(xmlHttpTimeout);
                            clearTimeout(otaReportExec);
                            console.log("100%");
                            wait15andcheck();
                             // check if the file if uploaded successfuly
                            // $("#progressEnd").show(500);
                        }
                    }
                }
            }
        } (h);
        h.open("GET", "https://"+deviceIpAddr+":5432", true);
        h.send();
    }
}

This query seems to be blocked for security reason. Coult it be related to https being using a self signed certificate ?

Is there any other way to get the update state ?

Best regards,

Théodore

  • What browser are you using?

    Was the TAR file sent successfully?  

    Do you see the progress if you use HTTP (and not HTTPS)?

    Basically you can change the code and HTML files to use any other method for the progress bar.

  • Hi Théodore,

    Yes, this is know issue with Local OTA example, from SDK 5.20 release notes:

    CC3X20SDK-156 Rarely the progress bar get stuck during OTA procedure
    CC3X20SDK-116 Progress bar on Windows FireFox and Chrome and Chrome browser doesn't update process status on the fly

    Personally I don't see anything significantly wrong with that AJAX code, but I did not deeply dig into this example. Personally I use my own javascript and backend code for local OTA. I use original ota_archive.h/.c code which works for me well. For deeper description please wait for answer from TI.

    But be aware that Local OTA examples was removed from latest SDK 5.30. It seems that some new OTA examples will come later.

    Jan

  • An example using the new OTA design will be available probably next week.

    The new OTA implementation uses a different method for the progress bar.

  • Hi Kobi,

    I'm using Firefox.

    Yes the tar was sent successfully and is basically and rebooting the module correctly (i need to figure out out to commit it properly it but that's another question)

    I haven't tried the HTTP solution yet. Is this trouble any related with threads and the fact that the thread used for handling the tar cannot handle other HTTP queries while doing it ?

    Is the new OTA implementation available somewhere  ?

  • Hi,

    it seems that the http let me see the percentage update.

    But the next query "http://<address>:443/ota?phase=" is not implemented and gets a 404 error code from the module..

    Any update any time soon on this ?

  • The new OTA design (one example shows both Local and Cloud OTA) is now available in the sl_wifi_example git :

    https://git.ti.com/cgit/slwfat/sl_wifi_examples (see the mqtt_client_w_ota example)

    I'm not an expert of the html part so hopefully the updated progress bar support will work for you. The "ota.html" was updated and the report is not based on the reports polled from a second HTTP connection. Instead it is based on internal check of number of byte sent in the HTTP POST and a status message at the end of the reception (i.e. without using a second HTTP connection for the reports).

  • Hi,

    Thanks Kobi, i'll figure that out with your example.

    Moreover, could you guide me on the right way to accept/commit a pending OTA update ?

    I managed to apply the update but it doesn't seems to be recognized as pending when restarting the new program.

    Best regards,

    Théodore

  • are you  using the local OTA example or a customized code?

    after the download/upload is completed, you need to call sl_Stop(200), before resetting the MCU.

    This will put the device in PENDING COMMIT state.

    After the reset you will be able to check the status (see the call to OtaArchive_GetPendingCommit in HandlePingComplete() in local_ota_task.c). In the new example if you call OTA_IF_init(), the OTA_NOTIF_IMAGE_PENDING_COMMIT event will be notified automatically through the registered OtaCallback.

    if the image is not identified as PENDING-COMMIT, something was not executed correctly during the image download or sl_Stop.

    Once you identified the "PENDING-COMMIT" you should verify that the image working (e.g. that it can connect to the local network and enable OTA).

    The 5.20 example the check is done after the PING was completed successfully - so connectivity is working and it can immediately calls OtaArchive_Commit().

    In the new example,  calling "SlNetConn_getStatus(true, &status);" and checking that status==SLNETCONN_STATUS_CONNECTED_INTERNET (or even status==SLNETCONN_STATUS_CONNECTED_IP in case of local OTA) will prove that we were able to connect (at least) to the local network to enable OTA. OTA_IF_commit() should called in such case. 

     

  • Hi Kobi,

    I'm using the local OTA example.

    Does the veryfing step is mandatory, ie, is it necessary to perform a new succesfull connection in order to use OT_IF_Commit() ?

    Regards,

  • not mandatory, just recommended

  • Hi Kobi,

    Once again we managed to succeed thanks your help. Keep going on !

    I've set the progress bar to work and accept the final OTA update in our custom program.

    we're even embedding another program as a user file in the tar file to flash another microcontroller with it !