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.

RTOS/CC3220MODA: Cloud OTA using Github clone

Genius 3100 points
Part Number: CC3220MODA

Tool/software: TI-RTOS

Team,

I have been trying to do cloud OTA using a custom server, which accepts and responds to API requests similar to Github (Request Directory and Request file content). Hence I have modified the CdnGithub.c to perform OTA. I have made respective changed to the other files as well (otauser.h, CdnClient.c and CdnGithub.h)

From the code I understand that the ReqDir API just uses the size and download_url values, hence my API responds with those two keys alone as mentioned below.

[
    {
        "size": 235520,
        "download_url": "https://services.com/ota/file/20171229191200_CC3200_OTA_clouota2.tar"
    }
]

The other change is that I am using the same vendor token for securing the download URL link. However the process fails with the below errors. I tried to debug, however did not understand the root cause.

CdnGithub_SendReqDir: uri=/ota/
OTA_run: ERROR CdnClient_ReqOtaDir, Status=-1

_OtaCheckConsecutiveErrors: ConsecutiveOtaErrors=1/5, return only WARNNING
OtaRunStep: WARNING Ota_run, Status=20004, continue for next OTA retry

OTA_run: call CdnClient_ConnectServer OTA server=services.com
CdnClient_ConnectServer: HttpClient_Connect services.com
HttpClient_Connect: IP_ADDR=13.126.94.18
OTA_run: CdnClient_ReqOtaDir, VendorDir=file
CdnGithub_SendReqDir: uri=/ota/
OTA_run: ERROR CdnClient_ReqOtaDir, Status=-1

_OtaCheckConsecutiveErrors: ConsecutiveOtaErrors=2/5, return only WARNNING
OtaRunStep: WARNING Ota_run, Status=20004, continue for next OTA retry

OTA_run: call CdnClient_ConnectServer OTA server=services.com
CdnClient_ConnectServer: HttpClient_Connect services.com
HttpClient_Connect: IP_ADDR=13.126.94.18
OTA_run: CdnClient_ReqOtaDir, VendorDir=file
CdnGithub_SendReqDir: uri=/ota/
OTA_run: ERROR CdnClient_ReqOtaDir, Status=-1

_OtaCheckConsecutiveErrors: ConsecutiveOtaErrors=3/5, return only WARNNING
OtaRunStep: WARNING Ota_run, Status=20004, continue for next OTA retry

OTA_run: call CdnClient_ConnectServer OTA server=services.com
CdnClient_ConnectServer: HttpClient_Connect services.com
HttpClient_Connect: IP_ADDR=13.232.146.208
OTA_run: CdnClient_ReqOtaDir, VendorDir=file
CdnGithub_SendReqDir: uri=/ota/
OTA_run: ERROR CdnClient_ReqOtaDir, Status=-1

_OtaCheckConsecutiveErrors: ConsecutiveOtaErrors=4/5, return only WARNNING
OtaRunStep: WARNING Ota_run, Status=20004, continue for next OTA retry

OTA_run: call CdnClient_ConnectServer OTA server=services.com
CdnClient_ConnectServer: HttpClient_Connect services.com
HttpClient_Connect: IP_ADDR=13.126.94.18
OTA_run: CdnClient_ReqOtaDir, VendorDir=file
CdnGithub_SendReqDir: uri=/ota/
OTA_run: ERROR CdnClient_ReqOtaDir, Status=-1

_OtaCheckConsecutiveErrors: ConsecutiveOtaErrors=5/5, MAX_CONSECUTIVE_OTA_ERRORS!!! 

OtaRunStep: FATAL ERROR from Ota_run -21003 !!!!!!!!!!!!!!!!!!!!!!!!!!!

I am using the latest SDK from TI i.e simplelink_cc32xx_sdk_2_40_01_01 and have success using the dropbox API for OTA.

Regards,

Zac

  • Hi Zac,

    It's interesting that the HTTP connect succeeds but the SendReqDir fails with a -1 error. Assuming this is coming from sl_Send(), this is a generic unspecified socket error, typically on a socket that is not actually connected to a remote server.

    Do you get any socket error messages from the async event handler?
    Have you tried putting the uri passed in SendReqDir as /ota/file/?

    Regards,
    Michael
  • Hi Michael,

    I did debug the code and found that the request string is formed correctly (get request on services.com/ota/file). Are there any other dependencies with Github sample that can cause this ?

    Regards,

    Zac

  • Hi Michael,

    During debug I found the below logs.

    HttpClient_RecvAppend: ERROR HttpClient_Recv, status=-20312
    len is: -20312
    After recvAppend pRespBuf is: 
    the entire JSON pRespBuf is: 73
    [{"size":235520,"download_url":"https://services.com/ota/file/20171229191200_CC3200_OTA_clouota2.tar"}]
    0
    
    
    Error: -102  , Couldn't parse the received Json file 
    CdnDropbox_ParseRespDir: ERROR OtaJson_init, retVal=-102
    OTA_run: ERROR CdnClient_ReqOtaDir, Status=-102
    
    _OtaCheckConsecutiveErrors: ConsecutiveOtaErrors=2/5, return only WARNNING
    OtaRunStep: WARNING Ota_run, Status=20004, continue for next OTA retry

    The length returned seems to be -20312. Should the response contain any specific header or additional data in the response json ?

    Regards,

    Zac

  • Hi Michael,

    Looking at it further, I found that the response length is found from the header 'Content-Length' which is neither present in our API nor in the github API (checked the response using POSTMAN). Changing that logic to the one used in Dropbox implementation solved the issue.
    Does it mean that the Github implementation is not tested ? It would be really helpful if you can check and fix the issue if present.

    Regards,
    Zac
  • Hi Zac,

    I'm glad that you figured out the fix for your error, and really appreciate you sharing it with the forum.

    Testing the cloud_ota example with Github, it looks like Github does send the content-length header. You can verify this on the CC3220 by printing out the header data in pBuf as you parse through it in HttpClient_RecvSkipHdr() of OtaHttpClient.c.

    Let me know if you need any more help with the OTA library, or if you have further questions on this topic.

    Regards,
    Michael