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 Bundle not in the right state error

Part Number: CC3220SF
Other Parts Discussed in Thread: TEST2

Hi,

I download a container, pass it through the OtaArchive_Process() function. This goes through parsing the tar file, successful verification of signature, creating the files in filesystem/saving them etc. _SaveOtaVersionFile(&pOtaArchive->OtaVersionFile) is also executed successfully where the bundle state is updated. The archive status is OtaArchiveState_CompletePendingTesting. However, when I do a OtaArchive_Commit, the function returns an error -10282. What could be the cause ?

The tar file just has a test.txt (with 20 bytes of data) and is signed by the dummy certs in SDK.

Code snippet .looks like this (based on https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/973463/launchxl-cc3235sf-local-ota-is-there-a-place-i-can-point-the-ota-code-to-a-file-the-user-has-uploaded-i-e-bypass-state-machine/3596060#3596060)

unproc  = 4096;

   while(unproc > 0 && ARCHIVE_STATUS_DOWNLOAD_DONE != status) {
    if ((unproc + proc) <= dataLen )
    {
        status = OtaArchive_Process(&otaArchiveBuf, &data[proc], (short int)unproc, &tmp);
        unproc = unproc - tmp;
        proc   = proc + tmp;
        DIAG_XL_LOG_INFO("OtaArchive_Process %d bytes proccessed, %d bytes unproccessed \n\r", proc, unproc);
        // error
        if (status != 0) break;
    }}

    if (status == ARCHIVE_STATUS_DOWNLOAD_DONE) {
      // here restart SoC
      sl_Stop(200);
      MAP_PRCMHibernateIntervalSet(330);
      MAP_PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);
      MAP_PRCMHibernateEnter();
    }
On power up
if (OtaArchive_GetPendingCommit()) {
  if (OtaArchive_Commit()) {
  }
}

Thanks,

  • So just to verify that i understand correctly...

    You got the ARCHIVE_STATUS_DOWNLOAD_DONE from the OtaArchive_Process (and then called the sl_Stop() before the MCU reset).

    After the MCU reset - you checked the OtaArchive_GetPendingCommit() (which returned TRUE) and then called OtaArchive_Commit().

    And the last call failed?

    Please enable the ota archive logs and send the terminal log.

  • Hi Kobi, Calling OtaArchive_GetPendingCommit() for the first time returns pending commit. If I can call

    OtaArchive_GetPendingCommit() for the second time without committing the image, I get no pending commit. Is it intended ?

    Thanks!
  • Maybe calling the OtaArchive_GetPendingCommit() changes the internal status - i will need to double check.

    Why do you need to call it twice? You can store the return code instead of calling the API again.

  • Hi Kobi, Was just curious to know :) I store the return value from the API now and use it. I store the return value from API that the commit is pending and when I call the OtaArchive_Commit() function, -10282 is returned. The OTA container has only txt files, but both are marked as fail safe

    Logs from ota archive

    [OtaArchive_Init] OTA archive version = OTA_ARCHIVE_2.0.0.4
    [OtaArchive_RunParse] set state=OtaArchiveState_ParseHdr
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] filetype=5, directory=20230227123742_CC3220SF_ota-test-bacon/
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] filetype=5, directory=20230227123742_CC3220SF_ota-test-bacon/0/
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] filetype=5, directory=20230227123742_CC3220SF_ota-test-bacon/1/
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] filetype=5, directory=20230227123742_CC3220SF_ota-test-bacon/2/
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] FileType=0, FileName=ota.cmd, FileSize=455
    [_BundleCmdFile_Parse] bundle cmd file=test.txt, sig_len=0, SHA_256_Digets=0afb3ba9fe89cf73c2303f2c6a8c45562ccc644cb72d525f3d5d39403b8fe35b, cert=, secured=0, bundle=1
    [_BundleCmdFile_Parse] bundle cmd file=test2.txt, sig_len=0, SHA_256_Digets=0afb3ba9fe89cf73c2303f2c6a8c45562ccc644cb72d525f3d5d39403b8fe35b, cert=, secured=0, bundle=1
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] skip block align RecvBufLen=1082, SkipAlignSize=58
    [OtaArchive_RunParseTar] FileType=0, FileName=ota.sign, FileSize=72
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] FileType=0, FileName=test.txt, FileSize=19
    [OtaArchive_RunParseTar] Create/Open for write file test.txt
    [OtaArchive_RunParseTar] Write size 19 to file test.txt total 19.
    Hash verification succeeded.
    Total archive file bytes 4627.
    OtaArchive_RunParseTar: 1 files that are mentioned in the ota.cmd were saved
    [OtaArchive_RunParseTar] Downloading File Completed - Size=19
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] skip block align RecvBufLen=3565, SkipAlignSize=493
    [OtaArchive_RunParseTar] FileType=0, FileName=test2.txt, FileSize=19
    [OtaArchive_RunParseTar] Create/Open for write file test2.txt
    [OtaArchive_RunParseTar] Write size 19 to file test2.txt total 19.
    Hash verification succeeded.
    Total archive file bytes 5651.
    OtaArchive_RunParseTar: 2 files that are mentioned in the ota.cmd were saved
    [OtaArchive_RunParseTar] Downloading File Completed - Size=19
    [OtaArchive_RunParseTar] parsing archive file header
    [OtaArchive_RunParseTar] skip block align RecvBufLen=2541, SkipAlignSize=493
    [OtaArchive_RunParseTar] End of archive...
    [_SaveOtaVersionFile] save version file also in the bundle, version=20230227123742
    =============================================================================== =====
    Firmware project using TI uC
    =============================================================================== =====
    [SlWifiConnEventHandler] POWERED_UP MAC address: 40:6:a0:97:37:94[WLAN EVENT] STA Connected to the AP: mynetwork , BSSID: 2c:3a:fd:b5:df:e9
    [NETAPP EVENT] IP acquired by the device
    [SlNetConnEventHandler] I/F 1 - CONNECTED (MAC LEVEL)!
    [SlNetConnEventHandler] I/F 1 - CONNECTED (IP LEVEL)!
    [SlNetConnEventHandler] I/F 1 - CONNECTED (INTERNET LEVEL)!
    [OtaArchive_Commit] ERROR sl_FsCtl, Status=-10282

  • Are you resetting the MCU or just the NWP?

  • I am resetting the uC itself.

  • Hi Kobi, Another interesting observation is - if I call OtaArchive_Commit() without checking for a pending commit, it is successful. If I check for a pending commit and then call OtaArchive_Commit(), an error -10282 is returned

  • I heard you found that AWS code is already calling OtaArchive_Commit().

    I've aligned with Roger on your new issue so hopefully it is solved today.