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.

CC3220S: Cannot manage to get all the data from Github repository through the CC3220S using the SimpleLink Cloud-OTA example.

Part Number: CC3220S

Hi,

I am using the CC3220S LaunchXL development board with the SimpleLink 32xx SDK 3_10_00_04:

I have configured the code as per requirements and it is as follows:

#define OTA_SERVER_TYPE OTA_SERVER_GITHUB

/* OTA server info */
/* --------------- */

#define OTA_VENDOR_DIR ""

#if OTA_SERVER_TYPE == OTA_SERVER_GITHUB

/* Github server info */
#define OTA_SERVER_NAME "api.github.com"
#define OTA_SERVER_IP_ADDRESS 0x00000000
#define OTA_SERVER_SECURED 1

/* Github vendor info */
#define OTA_VENDOR_ROOT_DIR "/repos/Noel-Altro/OTA_test" //"/repos/<user account>/<user directory>"
#define OTA_VENDOR_TOKEN "02d75cd51e0d4b5ea3c**********5cc9d0158ea"

#define OTA_SERVER_ROOT_CA_CERT "digcert_high_assurance_ca.cer"
#define OTA_SERVER_AUTH_IGNORE_DATA_TIME_ERRORs
#define OTA_SERVER_AUTH_DISABLE_CERT_STORE

I have managed to connect to the server via this code but I am getting only Partial data, not the entire amount.

The following is the debug output:

HandlePingComplete: OTA Command arrived
OtaInit: statistics = 0, 0, 0
OtaInit: call Ota_init
OTA_init: sizeof CdnClient=576, sizeof OtaArchive=4956
OTA_init: sizeof OtaLib_t=7736, sizeof OTA_memBlock=7800
OTA_init: OTA lib version = OTA_LIB_2.0.0.7
OtaArchive_Init: OTA archive version = OTA_ARCHIVE_2.0.0.4
OtaConfig: call OTA_set EXTLIB_OTA_SET_OPT_SERVER_INFO,ServerName=api.github.com
OtaConfig: call OTA_set EXTLIB_OTA_SET_OPT_VENDOR_ID, VendorDir=
OTA_run: call CdnClient_ConnectServer OTA server=api.github.com
CdnClient_ConnectServer: HttpClient_Connect api.github.com
HttpClient_Connect: IP_ADDR=140.82.113.6
2019/07/08 19:37:21: HttpClient_Connect: WARNING Socket Connect, status=-468, Ignored...
OTA_run: CdnClient_ReqOtaDir, VendorDir=
CdnGithub_SendReqDir: uri=/repos/Noel-Altro/OTA_test/contents/
len is: 674
After recvAppend pRespBuf is: ub.com/Noel-Altro/OTA_test/blob/master/20190708185357_CC3220S_OTA_test_July19.tar","git_url":"api.github.com/.../20190708185357_CC3220S_OTA_test_July19.tar
the entire JSON pRespBuf is: [{"name":"20190708185357_CC3220S_OTA_test_July19.tar","path":"20190708185357_CC3220S_OTA_test_July19.tar","sha":"c314ec682c79d92bafe1317e10772deaf34e9d0e","size":215040,"url":"https://api.github.com/repos/Noel-Altro/OTA_test/contents/20190708185357_CC3220S_OTA_test_July19.tar?ref=master","html_url":"https://github.com/Noel-Altro/OTA_test/blob/master/20190708185357_CC3220S_OTA_test_July19.tar","git_url":"https://api.github.com/repos/Noel-Altro/OTA_test/git/blobs/c314ec682c79d92bafe1317e10772deaf34e9d0e","download_url":"https://raw.githubusercontent.com/Noel-Altro/OTA_test/master/20190708185357_CC3220S_OTA_test_July19.tar","type":"file","_links":{"self":"https://api.github.com/repos/Noel-Altro/OTA_test/contents/20190708185357_CC3220S_OTA_test_July19.tar?ref=master","git":"https://api.github.com/repos/Noel-Altro/OTA_test/git/blobs/c314ec682c79d92bafe1317e10772deaf34e9d0e","html":"https://github.com/Noel-Altro/OTA_test/blob/master/20190708185357_CC3220S_OTA_test_July19.tar"}}]
[OtaJson_getMetadataFileName] Error: -101 , Couldn't get the data
OTA_run: ERROR CdnClient_ReqOtaDir, Status=-101

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

the actual JSON response is as follows which we traced through postman

[
{
"name": "20190708185357_CC3220S_OTA_test_July19.tar",
"path": "20190708185357_CC3220S_OTA_test_July19.tar",
"sha": "c314ec682c79d92bafe1317e10772deaf34e9d0e",
"size": 215040,
"url": "https://api.github.com/repos/Noel-Altro/OTA_test/contents/20190708185357_CC3220S_OTA_test_July19.tar?ref=master",
"html_url": "https://github.com/Noel-Altro/OTA_test/blob/master/20190708185357_CC3220S_OTA_test_July19.tar",
"git_url": "https://api.github.com/repos/Noel-Altro/OTA_test/git/blobs/c314ec682c79d92bafe1317e10772deaf34e9d0e",
"download_url": "https://raw.githubusercontent.com/Noel-Altro/OTA_test/master/20190708185357_CC3220S_OTA_test_July19.tar",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/Noel-Altro/OTA_test/contents/20190708185357_CC3220S_OTA_test_July19.tar?ref=master",
"git": "https://api.github.com/repos/Noel-Altro/OTA_test/git/blobs/c314ec682c79d92bafe1317e10772deaf34e9d0e",
"html": "https://github.com/Noel-Altro/OTA_test/blob/master/20190708185357_CC3220S_OTA_test_July19.tar"
}
}
]

Could you look into it and let me know what the issue can be. 

Thank you ,

Noel.

  • Hi,

    Thanks for the reply, it solved my issue.

    But I have faced another issue further on, which when I tweaked the code solved the issue.

    Initially I had uploaded the .tar file onto a public repository on github which worked flawlessly after doing the recommended correction through your previous reply.

    But when I changed the github  repository to private, I faced the issue of HTTP ERROR 404. Using Postman I tried querying the issue using the token provided by github, I was successful and noticed that the HTTP request sent by it included a Authentication parameter.

    So I made the required changes onto the code in the CdnGithub.c file as follows and it worked.

    #define OTA_SERVER_REST_HDR             "User-Agent: Altro\r\nAuthorization: Bearer "

    I wanted to know if there is a provision to overcome my issue in the SDK itself rather than tweaking it the way I have done.

    Noel.

  • Hi Noel,

    Thanks for the info. This looks like the right way to handle this.

    We'll check this internally and probably update the SDK.

    Currently, I can't commit to the exact date.

    Thanks,

    Kobi