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.

CC3220SF: OTA APIs showing all successful but expected firmware/bin file not executing

Part Number: CC3220SF

Tool/software:

OTA APIs showing Successful response. No error from Library. 

 Hash verification succeeded.
    Total archive file bytes 527132.
OtaArchive_RunParseTar: 2 files that are mentioned in the ota.cmd were saved
OtaArchive_RunParseTar: Downloading File Completed - Size=521500
OtaArchive_RunParseTar: parsing archive file header
OtaArchive_RunParseTar: skip block align  RecvBufLen=571, SkipAlignSize=228

substring => 

+QIRD: 1097


BufLen = 1097, tempHTTPRxBuff = 

OtaArchive_RunParseTar: parsing archive file header
OtaArchive_RunParseTar: End of archive...
_SaveOtaVersionFile: save version file also in the bundle, version=20250408142802
OTA_run: ---- Download file completed /STRTD1/20250408142802_CC3220SF_ota.tar
\

HttpClient_SendReq, pHttpReqBuf=>
POST /ota/api/DeviceStats/OTAStatus HTTP/1.1
Host: apps.orxa.io
Authorization: 
Content-Type: application/json
Content-Length:  159

{ "deviceId": "STRTD1", "InstallSuccess": 1, "oTA": "{Type: 3, status : Success, error: 3}", "oTALogs": "{  start counter: 536887296,  access errors: 60209 }"}



strlen((const char *)pHttpReqBuf) =>302


BufLen = 535, tempHTTPRxBuff = 
HTTP/1.1 200 OK
Server: nginx/1.26.3
Date: Tue, 08 Apr 2025 09:27:32 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 309
Connection: keep-alive
Expires: -1
Pragma: no-cache
Cache-Control: no-cache

[{"ProductId":65,"DeviceId":"STRTD1","PowerOnTime":null,"ResetCause":null,"Hardware":null,"SDCard":null,"Firmware":null,"OTA":"{Type: 3, status : Success, error: 3}","OTALogs":"{  start counter: 536887296,  access errors: 60209 }","CreatedBy":"OTAStatus","CreatedOn":"2025-04-08T14:57:32","InstallSuccess":1}]hÉ 
OtaRunStep: status from Ota_run: Download done, status = 104




OtaImageTestingAndReset: download done
OtaImageTestingAndReset: call sl_Stop to move the bundle totesting state
OtaImageTestingAndReset: reset the platform to test the newimage...

But the updated firmware is not executing, it has not changed, confirmed/checked many times.

  • Hi,

    Are those printouts (like OtaImageTestingAndReset:) are something you added or should appear on the code?

    In any case, once the download completes, the application is responsible to test the new downloaded image and commit it if it passes some testing you define (like connecting to an AP, pinging to a server, etc).

    Have you done so?

    Regards,

    Shlomi

  • How to test the downloaded image?
    It does not run the downloaded image in the first place.

  • ///*****************************************************************************
    // *  @ Description   : This function moves the image to testing state and resets the MCU.
    // *
    // *  @ Arguments     : None
    // *
    // *  @ Return value  : None
    // *
    //*****************************************************************************/
    int32_t OtaImageTestingAndReset()
    {
        int32_t retVal;
    
        OTA_DBG_PRINT("\n\n\n\n");
        OTA_DBG_PRINT("OtaImageTestingAndReset: download done\r\n");
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: call sl_Stop to move the bundle to"
            "testing state\r\n");
        sl_Stop(SL_STOP_TIMEOUT);
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: reset the platform to test the new"
            "image...\r\n");
        Platform_Reset();
    
        /* if we reach here, the platform does not support self reset */
        /* reset the NWP in order to test the new image */
        OTA_DBG_PRINT("\n");
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: platform does not support self reset\r\n");
        OTA_DBG_PRINT(
            "OtaImageTestingAndReset: reset the NWP to test the new image\r\n");
        OTA_DBG_PRINT("\n");
        retVal = InitSimplelink(ROLE_STA);
        /* The sl_Stop/Start will produce event APP_EVENT_STARTED */
        return(retVal);
    }
    
    void Platform_Reset()
    {
    #ifdef __MSP432P401R__
        MAP_ResetCtl_initiateSoftReset();
    #elif (CC32XX == 1)
    //#else
        /* Reset the MCU in order to test the bundle */
        MAP_PRCMHibernateCycleTrigger();
    //    PRCMMCUReset(TRUE); // comment on 23/12/2024
    #endif
    }

    Those are the prints. Code for the following you can see in attached code snippet. (Note: SL_STOP_TIMEOUT = 250)

    Below is the commit code which checks the isPendingCommit flag

    /*****************************************************************************
     *  @ Description   : This function checks if there is new image available for
     *                    commit and if new image is found it will commit the new
     *                    image and after restart the MCU will always start with new image.
     *
     *  @ Arguments     : None
     *
     *  @ Return value  : (0) on success and (-1) on error
     *
    *****************************************************************************/
    
    int32_t OtaCheckAndDoCommit()
    {
        int32_t isPendingCommit;
        int32_t isPendingCommit_len;
        int32_t Status;
    
        /* At this stage we have fully connected to the network (IPv4_Acquired) */
        /* If the MCU image is under test, the ImageCommit process will
        commit the new image and might reset the MCU */
        Status =
            OTA_get(EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT,
                    (int32_t *)&isPendingCommit_len,
                    (uint8_t *)&isPendingCommit);
        if(Status < 0)
        {
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: OTA_get ERROR on "
                "EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT, Status = %d\r\n",
                Status);
            return(-1);
        }
        else
        {
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: "
                "Status = %d\r\n",
                Status);
        }
    
        /* commit now because 1. the state is PENDING_COMMIT 2. there was successful
        wlan connection */
        if(isPendingCommit)
        {
            Status = OTA_set(EXTLIB_OTA_SET_OPT_IMAGE_COMMIT, 0, NULL, 0);
            if(Status < 0)
            {
                OTA_DBG_PRINT(
                    "OtaCheckDoCommit: OTA_set ERROR on "
                    "EXTLIB_OTA_SET_OPT_IMAGE_COMMIT, Status = %d\r\n",
                    Status);
                return(-1);
            }
            OTA_DBG_PRINT("\r\n");
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: OTA success, new image commited and "
                "currently run\n");
            OTA_DBG_PRINT("\r\n");
            memset(cErrorMessageBuffer, 0, sizeof(cErrorMessageBuffer));
            sprintf(cErrorMessageBuffer,"\r\n%d\t%s: OTA successful\r\n",__LINE__,__FUNCTION__);
            ERROR_LOG(cErrorMessageBuffer,MSG_RUNTIME);
            mb_BIT_status[0] = mb_BIT_status[0] | (1 << OTA_COMIT_DONE);
            /* Stop the commit WDT */
            Platform_CommitWdtStop();
        }
        else
        {
            mb_BIT_status[0] = mb_BIT_status[0] & ~(1 << OTA_COMIT_DONE);
            OTA_DBG_PRINT(
                "OtaCheckDoCommit: "
                "isPendingCommit = %d\r\n",
                isPendingCommit);
        }
        return(0);
    }
    
    void Platform_CommitWdtStop()
    {
    #ifdef CC32XX
        PowerCC32XX_reset(PowerCC32XX_PERIPH_WDT);
    #endif
    }

    isPendingCommit flag = 0 when this failure scenario is happening.

  • the code looks OK,

    So just to clarify, after the OTA procedure ends, you don't even get the application running?

    or is the old application is running?

  • old application is running.

  • I see.

    What is included in the OTA image?

    I assume the application code for a start but maybe other files as well?

    what I would test before we digging is to add a new user file to the image and apply the OTA.

    Then, check if the new file exists on the filesystem.

    I want to rule out the mcuimg.

    Regards,

    Shlomi

  • Observation: I called a function to check the list of files in flash memory. Both before and after the reset.

    Before reset: ota.dat file was present with commit pending flag set; After reset: ota.dat file is not present

    Remedy: Thinking that the flag is not been set properly, i implemented a delay just before Platform_Reset().

    As a result, the ota.dat file was found present after the reset with the commit pending flag set. The OTA was working.

    [Note: I used sl_FsGetFileList() function which lists the file in flash and also shows the flags present]

  • So with this mitigation it works?

    Shlomi

  • thanks for the update.