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.

CC3235MODSF: SimpleLinkFatalErrorEventHandler error reported while trying OtaArchive library

Part Number: CC3235MODSF
    OtaArchive_init(&gOtaArcive);

    UART_PRINT( "[ota] calling HttpClient_Connect...");
    otaSockId = HttpClient_Connect("", SERVER_IP_ADDR, 8000, false, false);
    UART_PRINT( "%d \r\n", otaSockId);


    status = HttpClient_SendReq(otaSockId, (uint8_t*)otaBuffer, "GET", "serverNameTest", " /ota.tar", "", "hdrName", "hdrVal");
    UART_PRINT( "[ota] HttpClient_SendReq=%d \r\n", status);

    bytesReceived = HttpClient_RecvSkipHdr(otaSockId, (uint8_t*)otaBuffer, OTA_BUFF_SIZE, &contentLen);
    UART_PRINT( "[ota] HttpClient_RecvSkipHdr byteReceived=%d contentLen=%d\r\n", bytesReceived, contentLen);

    bytesReceived = 0;
    bytesProcessed = 0;

    while( contentLen > 0 )
    {
        bytesReceived = HttpClient_RecvAppend(otaSockId, (uint8_t*)otaBuffer, OTA_BUFF_SIZE, bytesReceived, bytesProcessed);
        UART_PRINT( "[ota] HttpClient_RecvAppend byteReceived=%d \r\n", bytesReceived);

        status = OtaArchive_process(&gOtaArcive, (uint8_t*)otaBuffer, bytesReceived, &bytesProcessed);
        UART_PRINT( "[ota] OtaArchive_process=%d preocessed=%d contLen=%d\r\n", status, bytesProcessed, contentLen);

        usleep(100ul * 1000ul);

        contentLen -= bytesReceived;
    }

Calling this code to fetch a local file from a python temporary webserver (file download tested with chrome and firefox). Results in the following log:

OtaArchive_Init: OTA archive version = OTA_ARCHIVE_2.0.0.4
[ota] calling HttpClient_Connect...HttpClient_Connect: IP_ADDR=10.0.0.100
0
[ota] HttpClient_SendReq=62
[ota] HttpClient_RecvSkipHdr byteReceived=0 contentLen=235520
[ota] HttpClient_RecvAppend byteReceived=1440
OtaArchive_RunParse: set state=ARCHIVE_STATE_PARSE_HDR
[ota] OtaArchive_process=0 preocessed=0 contLen=235520
[wifi] SimpleLinkFatalErrorEventHandler 2
HttpClient_RecvAppend: ERROR HttpClient_Recv, status=-2005
[ota] HttpClient_RecvAppend byteReceived=-2005
OtaArchive_RunParseTar: parsing archive file header
[ota] OtaArchive_process=2 preocessed=0 contLen=234080
HttpClient_RecvAppend: ERROR RecvLen=-2005, RecvOffset=0
[ota] HttpClient_RecvAppend byteReceived=-20311
OtaArchive_RunParseTar: parsing archive file header
[ota] OtaArchive_process=2 preocessed=0 contLen=236085
HttpClient_RecvAppend: ERROR RecvLen=-20311, RecvOffset=0
[ota] HttpClient_RecvAppend byteReceived=-20311
OtaArchive_RunParseTar: parsing archive file header
[ota] OtaArchive_process=2 preocessed=0 contLen=256396
HttpClient_RecvAppend: ERROR RecvLen=-20311, RecvOffset=0
[ota] HttpClient_RecvAppend byteReceived=-20311

Why do I get "SL_DEVICE_EVENT_FATAL_SYNC_LOSS" ?

  • Hi,

    The sync loss event will get triggered whenever there is an unexpected data on the host interface (SPI between host and NWP). It can be caused by 

    You code seems ok (it is not trivial to find the issue), but the functions you call are internal and are supposed to be called within the library context. Please use the "ota" reference code to debug such issue if you prefer to take this approach.

    One thing i noticed, is that the first call to RecvAppend return with 1440 bytes, that are not processed in the first call to OtaArchive_Process() and immediately you call RecvAppend again (from offset 0). This may cause the issue and anyway is wrong as you overrides the otaBuffer, before its original content was processed.

    In such case you should call OtaArchive_Process() twice (or more) until the entire content (1440B) is processed, before the next call to RecvAppend.

    Check the handling in Ota_run().

    Br,

    Kobi