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.

CC3200: Update Dropbox API in CC3200 from v1 to v2

Part Number: CC3200



Hi,

I just want to check if someone already port the current cc3200 ota_update sample from dropbox API v1 to API v2.

Dropbox API v1 is already obsolete and some of the v1 API's are not working already.

Warning: API v1 has been deprecated. Learn more.

Looking at the OTA_update sample, it still referring to v1 API.

otaconfig.h

#define OTA_SERVER_NAME                 "api.dropbox.com"
#define OTA_SERVER_IP_ADDRESS           0x00000000
#define OTA_SERVER_SECURED              1
#define OTA_SERVER_REST_UPDATE_CHK      "/1/metadata/auto/" // returns files/folder list
#define OTA_SERVER_REST_RSRC_METADATA   "/1/media/auto"     // returns A url that serves the media directly
#define OTA_SERVER_REST_HDR             "Authorization: Bearer "
#define OTA_SERVER_REST_HDR_VAL         "<dropbox access key>"
#define LOG_SERVER_NAME                 "api-content.dropbox.com"
#define OTA_SERVER_REST_FILES_PUT       "/1/files_put/auto/"
#define OTA_VENDOR_STRING               "Vid00_Pid00_Ver00"


Hope someone can assist or provide some example.

P.S. Is there a way to use this cc3200 OTA using AWS?

Thanks in advance.

BR,

Javer

  • Hi Javer,

    That notice says that API v1 will continue to work until June 2017. We have not yet determined what changes would need to be implemented.

    We do have an AWS example with the CC3200, but I do not believe it implements OTA: processors.wiki.ti.com/.../AWS_IoT_Development
    For further support on this AWS example, please post in the TI-RTOS forum.

    Best regards,
    Sarah
  • Hello Sarah,

    We cannot implement v1 in our design since our design will run for several years and may require several updates.
    API v2 documentation is already available. Hope you can check this out and advise us on the changes.

    Our major concern right now is OTA update, so if you have any example (even not using dropbox) it will be a great help. :)

    Thanks in advance,
    Javer
  • Hi Javer,

    We are working on an example to address this, but we do not currently have a replacement. I can update you once it's available.

    Best regards,
    Sarah
  • Hi Sarah,

    It's good to know that you're already working on the update.
    Do you think it will be available in a week or two? The requirements for this OTA is very crucial for our project right now.

    Hope to hear some good news.


    Thanks,
    Javer
  • Hi,
    Well, as Dropbox deprecated api v1 on 28 September the issue became critical to me. How to define correctly OTA_SERVER_REST_UPDATE_CHK, etc to be compatible with aropbox api v2? Are there any update. I've just seen sources of the ota from SDK1.3.0 seems it should be working with v2 api. But how correctly fill definitions topicsarter asked?

    p.s. I've tried use migration guide from dropbox (www.dropbox.com/.../documentation and replace for example "/1/metadata/auto/" with "/2/files/get_metadata/", etc in accordance with migration guide, but all attempts failed.

    Thanks for any help!
  • Hi Vasiliy B,

    This was implemented in CC3200 SDK v1.3. Please see this thread for more information: e2e.ti.com/.../2130384

    Best regards,
    Sarah
  • Hello Vasiliy B,

    It should be working by default on the latest SDK for cc3200, but still let me know if it doesn't work for you.

    I'm one of the first reported this issue and I think the first one to get the solution from TI experts. :)

    Cheers,

    Javer

  • Hello Sarah and Javer,

    First thank you for your reply!

    My firmware successfully updated via Dropbox Api v1. Since 28 September v1 was deprecated and my firmware on customers’ side could not be updated.

    My actions to fix it:

    SDK 1.3.0

    1. Recompile ota with debug print options:

    1.1 in ‘extlibs_common.h’ uncomment #define DEBUG_PRINT

    1.2 check #define OTA_DROPBOX_V2 is not commented in OtaCommon.h

    2. No changes in firmware in OTA field (below are constants worked fine on v1):

    #define OTA_SERVER_NAME                 "api.dropbox.com"
    #define OTA_SERVER_IP_ADDRESS           0x00000000
    #define OTA_SERVER_SECURED              1
    #define OTA_SERVER_REST_UPDATE_CHK      "/1/metadata/auto/"
    #define OTA_SERVER_REST_RSRC_METADATA   "/1/media/auto"
    #define OTA_SERVER_REST_HDR             "Authorization: Bearer "
    #define OTA_SERVER_REST_HDR_VAL         "my token here"
    #define LOG_SERVER_NAME                 "api-content.dropbox.com"
    #define OTA_SERVER_REST_FILES_PUT       "/1/files_put/auto/"
    #define OTA_VENDOR_STRING               "Vid01_Pid00_Ver0000"

    3. Debug print from UART:

    sl_extLib_OtaRun: call OtaClient_ConnectServer OTA server=api.dropbox.com

    OtaClient_ConnectServer: http_connect_server api.dropbox.com

    Pub Topic: /STATE/F4B85E018CDF/

    Value: statusFirmwareUpdate

    sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=Vid01_Pid00_Ver0000

    OtaClient_UpdateCheck: call http_build_request /1/metadata/auto/

    CdnDropbox_SendReqDir: uri=/2/files/list_folder

    _OtaCleanToIdle: close OTA client and CDN client and back to IDLE

    sl_extLib_OtaRun ERROR: OtaClient_UpdateCheck

    OTA run = -4

    OTA: Error with OTA server

    OTA: Error with OTA server [RUN_STAT_ERROR_RESOURCE_LIST]

    What is wrong?

    The files on dropbox side and folder structure is correct and worked fine before api v1 were deprecated by dropbox. Any suggestions, please

    Thanks,

    Vasiliy

  • Hi Vasiliy B,

    As what I observed you missed to write your dropbox token.
    You should fill the correct token value in your "OTA_SERVER_REST_HDR_VAL ".

    #define OTA_SERVER_REST_HDR_VAL "my token here"

    Let me know your results.

    Regards,
    Javer
  • in my code is real token, I've replaced it with "my token here" just for post here.
  • :) my bad..

    Another thing, please make sure you are using updated servicepack. The new SDK was updated together with the new service pack.

    www.ti.com/.../CC3200SDK

    -- Javer
  • yes, sure already done before new firmware uploaded, below is log from uart when my firmware starts:

    Host Driver Version: 1.0.1.11

    Build Version 2.9.0.0.31.1.4.0.1.1.0.3.37

    Thanks for replies.

  • Can you share the structure (naming) of your app folder in dropbox?
    Seems everything is already set from your side.

    -- Javer
  • yes, sure here it is (just for notice, as I said this all works before dropbox deprecated v1):

  • Please change your OTA_VENDOR_STRING like below.

    #define OTA_VENDOR_STRING "Vid01_Pid00_Ver00"

    Then rename your dropbox folder to "Vid01_Pid00_Ver00_02090000"

    Then try again.

    Let me know the results.

    -- Javer
  • I've already posted the debug log from ota today, and one thing looks suspicious on my view:

    sl_extLib_OtaRun: call OtaClient_ConnectServer OTA server=api.dropbox.com

    OtaClient_ConnectServer: http_connect_server api.dropbox.com

    Pub Topic: /STATE/F4B85E018CDF/

    Value: statusFirmwareUpdate

    sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=Vid01_Pid00_Ver0000

    OtaClient_UpdateCheck: call http_build_request /1/metadata/auto/

    CdnDropbox_SendReqDir: uri=/2/files/list_folder

    _OtaCleanToIdle: close OTA client and CDN client and back to IDLE

    sl_extLib_OtaRun ERROR: OtaClient_UpdateCheck

    OTA run = -4

    OTA: Error with OTA server

    OTA: Error with OTA server [RUN_STAT_ERROR_RESOURCE_LIST]


    the log generated when ota library recompiled with PRINT_DEBUG definition, and if to see on dropbox API /1/metadata/auto used in APIv1, the request generated somewhere inside ota library. At the same time, text (green highlighted) seems related to v2 ( and it is somewhere in ota library too)

    Dropbox migration guide link#mce_temp_url#

  • agh.. the same error:

    firmware:

    Folder structure:

    UART debug:

  • I'm quite convinced that the only item need to correct is the folder name and the OTA_VENDOR_STRING.

    See good logs on my application. Don't bother about the v1 api call, it seems to be a uncleaned debug log.

    sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=Vid00_Pid00_Ver00_02090000

    OtaClient_UpdateCheck: call http_build_request /1/metadata/auto/

    CdnDropbox_SendReqDir: uri=/2/files/list_folder

       metadata file=/Vid00_Pid00_Ver00_02090000/f.bin, size=5

       metadata file=/Vid00_Pid00_Ver00_02090000/f80_sys_mcuimgA.bin, size=207624

    sl_extLib_OtaRun: OtaClient_UpdateCheck, numUpdates=2

     

    -- Javer

  • Thanks a lot for the log! Very interesting difference wth my:

    sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=Vid00_Pid00_Ver00

    OtaClient_UpdateCheck: call http_build_request /1/metadata/auto/

    CdnDropbox_SendReqDir: uri=/2/files/list_folder

    _OtaCleanToIdle: close OTA client and CDN client and back to IDLE

    sl_extLib_OtaRun ERROR: OtaClient_UpdateCheck

    OTA run = -4

    OTA: Error with OTA server

    OTA: Error with OTA server [RUN_STAT_ERROR_RESOURCE_LIST]

    as in your case:  sl_extLib_OtaRun: OtaClient_UpdateCheck, vendorStr=Vid00_Pid00_Ver00_02090000

    at my case #define OTA_VENDOR_STRING               "Vid00_Pid00_Ver00"

    and seems it is the variable should be in log, when I change OTA_VENDOR_STRING to Vid00_Pid00_Ver00_02090000 than i get in log: _ReadStatFile: ERROR in sl_FsOpen, status=-11

    One extra question which compiler do you use? In my case IAR

  • With your logs it seems that you are having problem accessing the dropbox app.

    I'm not sure if you can perform manual curl, but can you try this manually, please share the result.

    curl -X POST api.dropboxapi.com/.../list_folder \
        --header "Authorization: Bearer YOURTOKENHERE" \
        --header "Content-Type: application/json" \
        --data "{\"path\": \"\",\"recursive\": false,\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false,\"include_mounted_folders\": true}"

    Dont forget to change the token.


    -- Javer

  • ok done, here are curl and result:

    curl -X POST api.dropboxapi.com/.../list_folder \
    >     --header "Authorization: Bearer YOURTOKENHERE" \
    >     --header "Content-Type: application/json" \
    >     --data "{\"path\": \"\",\"recursive\": false,\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false,\"include_mounted_folders\": true}"
    <html>
    <head><title>301 Moved Permanently</title></head>
    <body bgcolor="white">
    <center><h1>301 Moved Permanently</h1></center>
    <hr><center>nginx</center>
    </body>
    </html>

  • I'm using Code Composer Studio.
    Please make sure to clean first before building your project.

    -- Javer
  • Please change "YOURTOKENHERE" with your token.
  • yes sure, it is with token, and server response looks strange seems definetely something wrong with access

  • I think we nailed the issue.
    I suggest you generate new access token and try again to perform curl.

    Let me know the result.

    -- Javer
  • Ok, curl worked correct (actually I've just copy-paste your curl and changed only token, as your link is incorrect) below is answer of dropbox on my request. So, seems all is correct in dropbox side

  • Also, one possible reason for the issue.

    I use IAR ARM 7.70 to recompile CC3200SDK_1.3.0\cc3200-sdk\simplelink_extlib\ota

    During compilation, I get an error (no files with definition ltoa):


     

    So, I uncheck "Required prototypes" and compile the library successfully. But to compile the library with my firmware I use ltoa from here (just first I found on github itoa.c): #mce_temp_url# could it be the problem? And where is the itoa.h/c fir IAR version of the project? <stdlib.h> do not satisfy, so I use 3rd party.

    From the other hand when I use original precompiled ota library from the SDK1.3.0 for iar, the same issue continues with dropbox.

    So, at the moment after help from Javer (thanks a lot for waste your time!) I got:

    1. Dropbox requests on curl is as need

    2. After rename folder on dropbox side to "Vid00_Pid00_Ver00_02090000" and assign #define OTA_VENDOR_STRING  "Vid00_Pid00_Ver00" the issue is still here

    3. at the same time Javer's code works and it was compiled in CSS

    So, seems the only difference is compilation IDE? Could TI guys try to compile OTA in IAR and check with current Dropbox api?

    Thanks!