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 OTA DropBox DataStores Deprecated

Other Parts Discussed in Thread: CC3200

Hi,

  I was attempting to insert OTA Update functionality into the get_weather app before adding the code to my application.  I followed the directions in the CC3200 Over-The-Air (OTA) Update Application Note.  Section 3.2.1 says to create an account... done.  Go to http://www.dropbox.com/developers/apps/create, and select DropBox API... done.  

The instructions then say to choose "Files and DataStores"  This option is not available on the page.  Searching on the web for DropBox and DataStores shows that the DataStores API has been deprecated as of April 23, 2015.  Is there an alternative method, and sample code to show working OTA update?

Thanks,

Vic

  • Hi Vic,

    Thanks for notifying this.

    While creating the new dropbox developer app you should use below option
    Dropbox API->App Folder

    We will update the documents accordingly.

    Regards,
    Ankur
  • Hi Ankur,

    Thank you. I completed the task at www.dropbox.com, and wanted to add the code to the get_weather application. It states in the doc that there is an embedded .zip (Edits_for_OTA.zip )file that contains the code to add. When I click on the file, it is only an image, and not a zip file. Do you know where I can get this file?

    Thanks,

    Vic
  • HI Vic,

    The zip file is not available but all the required code is listed in subsequent table. Please follow the instructions mentioned in table.

    Regards,
    Ankur
  • Hi Ankur,

    That is not a great answer. The table is an image, and not text. There is no ability to cut and paste this code. I am going to need to type all of this in by hand which will take a long time, and be prone to error. Can you please see that this is fixed for the next person?

    Thanks,

    Vic
  • Vic,

    I agree this is not a good way and we have already taken a note for the same. We will update the doc for the same.

    Regards,
    Ankur
  • This should at least go here:

    **PRO TIP: Double click inside code blocks to highlight all code.**

    Include Section (To be added after osi.h)

    #include "flc_api.h"
    #include "ota_api.h"

    Global/Define Section

    #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 "<access_token>"
    #define LOG_SERVER_NAME "api-content.dropbox.com"
    #define OTA_SERVER_REST_FILES_PUT "/1/files_put/auto/"
    #define OTA_VENDOR_STRING "VId_PId_VerId"
    
    static OtaOptServerInfo_t g_otaOptServerInfo;
    static void *pvOtaApp;

    Function Prototypes

    int OTAServerInfoSet(void **pvOtaApp, char *vendorStr);
    static void RebootMCU();

    Local Variables (To be added to GetWeatherTask() Function

    long OptionLen;
    unsigned char OptionVal;
    int SetCommitInt;
    unsigned char ucVendorStr[20];

    OTA Initialization (To be added to GetWeatherTask() function after GPIO_IF_LedOn(MCU_GREEN_LED_GPIO) function call)

    //
    // Initialize OTA
    //
    pvOtaApp = sl_extLib_OtaInit(RUN_MODE_NONE_OS | RUN_MODE_BLOCKING,0);
    
    strcpy((char *)ucVendorStr, OTA_VENDOR_STRING);
    
    OTAServerInfoSet(&pvOtaApp, (char *)ucVendorStr);

    OTA main construct/logic (To be added to GetWeatherTask() function after lRetVal = Network_IF_GetHostIP((char*)g_ServerAddress, &ulDestinationIP);)

        //
        // Check if this image is booted in test mode
        //
    
        sl_extLib_OtaGet(pvOtaApp, EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT, &OptionLen, (_u8 *)&OptionVal);
    
        UART_PRINT("EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT? %d \n\r", OptionVal);
    
        if (OptionVal == true)	{
        	UART_PRINT("OTA: PENDING COMMIT & WLAN OK ==> PERFORM COMMIT \n\r");
    
        	SetCommitInt = OTA_ACTION_IMAGE_COMMITED;
        	sl_extLib_OtaSet(pvOtaApp, EXTLIB_OTA_SET_OPT_IMAGE_COMMIT, sizeof(int), (_u8 *)&SetCommitInt);
        }
        else	{
        	UART_PRINT("Starting OTA\n\r");
        	lRetVal = 0;
    
        	while (!lRetVal)	{
        		lRetVal = sl_extLib_OtaRun(pvOtaApp);
        	}
    
        	UART_PRINT("OTA run = %d\n\r", lRetVal);
        	if (lRetVal < 0)	{
        		UART_PRINT("OTA: Error with OTA server\n\r");
        	}
        	else if (lRetVal == RUN_STAT_NO_UPDATES)	{
        		UART_PRINT("OTA: RUN_STAT_NO_UPDATES\n\r");
        	}
        	else if (lRetVal && RUN_STAT_DOWNLOAD_DONE)	{
        		// Set OTA File for testing
    
        		lRetVal = sl_extLib_OtaSet(pvOtaApp, EXTLIB_OTA_SET_OPT_IMAGE_TEST, sizeof(int), (_u8 *)&SetCommitInt);
    
        		UART_PRINT("OTA: NEW IMAGE DOWNLOAD COMPLETE\n\r");
    
        		UART_PRINT("Rebooting...\n\r");
        		RebootMCU();
        	}
    
        }

    Banner Display (Replace “DisplayBanner(APP_NAME);” with the new code)

    DisplayBanner(OTA_VENDOR_STRING);

    New Functions (Added at the end of “main.c”)

    //****************************************************************************
    //
    //! Sets the OTA server info and vendor ID
    //!
    //! \param pvOtaApp pointer to OtaApp handler
    //! \param ucVendorStr vendor string
    //! \param pfnOTACallBack is  pointer to callback function
    //!
    //! This function sets the OTA server info and vendor ID.
    //!
    //! \return None.
    //
    //****************************************************************************
    int OTAServerInfoSet(void **pvOtaApp, char *vendorStr)
    {
    
    	unsigned char macAddressLen = SL_MAC_ADDR_LEN;
    
        //
        // Set OTA server info
        //
        g_otaOptServerInfo.ip_address = OTA_SERVER_IP_ADDRESS;
        g_otaOptServerInfo.secured_connection = OTA_SERVER_SECURED;
        strcpy((char *)g_otaOptServerInfo.server_domain, OTA_SERVER_NAME);
        strcpy((char *)g_otaOptServerInfo.rest_update_chk, OTA_SERVER_REST_UPDATE_CHK);
        strcpy((char *)g_otaOptServerInfo.rest_rsrc_metadata, OTA_SERVER_REST_RSRC_METADATA);
        strcpy((char *)g_otaOptServerInfo.rest_hdr, OTA_SERVER_REST_HDR);
        strcpy((char *)g_otaOptServerInfo.rest_hdr_val, OTA_SERVER_REST_HDR_VAL);
        strcpy((char *)g_otaOptServerInfo.log_server_name, LOG_SERVER_NAME);
        strcpy((char *)g_otaOptServerInfo.rest_files_put, OTA_SERVER_REST_FILES_PUT);
        sl_NetCfgGet(SL_MAC_ADDRESS_GET, NULL, &macAddressLen, (_u8 *)g_otaOptServerInfo.log_mac_address);
    
        //
        // Set OTA server Info
        //
        sl_extLib_OtaSet(*pvOtaApp, EXTLIB_OTA_SET_OPT_SERVER_INFO,
                         sizeof(g_otaOptServerInfo), (_u8 *)&g_otaOptServerInfo);
    
        //
        // Set vendor ID.
        //
        sl_extLib_OtaSet(*pvOtaApp, EXTLIB_OTA_SET_OPT_VENDOR_ID, strlen(vendorStr),
                         (_u8 *)vendorStr);
    
        //
        // Return ok status
        //
        return RUN_STAT_OK;
    }
    
    //****************************************************************************
    //
    //! Reboot the MCU by requesting hibernate for a short duration
    //!
    //! \return None
    //
    //****************************************************************************
    static void RebootMCU()
    {
    
      //
      // Configure hibernate RTC wakeup
      //
      PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);
    
      //
      // Delay loop
      //
      MAP_UtilsDelay(8000000);
    
      //
      // Set wake up time
      //
      PRCMHibernateIntervalSet(330);
    
      //
      // Request hibernate
      //
      PRCMHibernateEnter();
    
      //
      // Control should never reach here
      //
      while(1)
      {
    
      }
    }

     

     

     

  • Hi craig
    this was really useful
    thanks again
    av