Skip navigation
Home > All Places > WICED Smart Bluetooth > WICED Smart Bluetooth Forums > Blog > 2015 > May
2015
kwang

SOTAFU for Android and iOS

Posted by kwang May 27, 2015
RevisionChange DescriptionDate
1.0Initial Draft - VR09/30/14 - 8:45PM
2.0Android and iOS Implementation05/27/15 - 5:00PM

 

 

The SDK 2.1.1 provides a Secure OTA Firmware update.RSA.JPG

 

Wiced smart memory partition

 

Address.JPG

 

Verification.JPG

 

 

 

Flowchart of the SOTAFU

 

 

Flowchart.JPG

 

FOR ANDROID

 

Download Sample App )for Side-loading onto Android Device)

Version 1.00  for Android 4.3 MR2  Jellybean or higher (Android API level 18 or higher)

Installation instructions: (apk file and source code included in post)

     1.  If you previously installed WicedSmartOta.apk, please make sure to remove it

          adb uninstall com.broadcom.app.wicedsmart.ota

     2.   Download the .apk file to a computer with adb installed

     3.   Connect your android device to your computer

     4.   From command line, type "adb install -r WicedSmartOta.apk"

 

How to Use the OTA Sample Application

     1.  Prerequisites for OTA Upgrade

         To perform OTA update the following conditions must be met

          a. The update firmware must be signed with the same private/public key that the firmware

               running in the target WICED SMART tag

          b. The update firmware must have the same ApplicationId as the firmware running in the

               target WICED SMART tag

          c. The update firmware's MajorVersionNumber must be equal or greater than the

              MajorVersionNumber of the firmware running in the target WICED SMART tag

           If any of these preconditions are not satisfied, OTA upgrade will fail.

 

     2.  Updating the WICED SMART tag firmware via OTA

          The WICED SMART OTA App provides an OTA service to allow one to upgrade the

          firmware of a connected WICED SMART tag.  To use the OTA firmware update service:

          a.  Make a local directory on the phone/tablet: /sdcard/broadcom/wicedsmart

               adb shell mkdir -p /sdcard/broadcom/wicedmart

          b.  Copy the wiced sense signed binary file to the /sdcard/broadcom/wicedsmart folder,

               making sure the firmware has the extension ota.bin.signed

               adb push XXXXXXXXX.ota.bin.signed /sdcard/broadcom/wicedsmart/

          c.  Turn on the WICED SMART tag

          d.  Using the WICED SMART OTA application, Search for the WICED SMART tag and

               select that device

          e.  Connect to the tag by clicking on the connect button in the action bar.

          f.   Verify the tag's running firmware version info by connecting to the tag and viewing the

               firmware's version info from the "Get sensor Info": menu option. This should upgrade

               the background of the application with the firmware info

1.png5.png

          g.  Go to the Upper right corner of the menu bar, and select "Check for software updates"

          h.  If you have more than one version of the firmware software in the

               /sdcard/broadcom/wicedsense directory, you will be prompted to select the file to

               upload to the WICED SMART tag. Otherwise, the OTA update service will automatically

               begin uploading the single firmware file embedded in the sample WICED SMART OTA

               App. (Bottom Left Image)

3.png4.png

          i.   Wait for the OTA Service to finish uplaoding and verify the firmware.

               (Top Right Image)

          j.   Close and reopen the WICED SMART OTA app

          k.  Reconnect to the WICED SMART tag and get the running firmware's version info to

               verify the firmware has been updated

 

 

OTA Implementation Instructions

 

     1. The OTA code is an included set of Objective C APIs and optional UI components that can

          be included into an app.

     2. The OTA code resides in the folder WicedSmartOtaHelper

          •    OtaManager manages the OTA upgrade process

          •    OtaCallback is a delegate object you will implement and register with OtaManager to

               receive "callback  events" that give the state/status of the OTA upgrade.

     3. Typical use case for implementing OTA Update using the OtaManager class

               •    Create an instance of OtaManager.

               •    Create an instance of your class that implements the delegate OtaCallback.

               •    Call OtaManager's addCallback method to register your callback.

               •    Read the OTA binary and obtain a NSData byte array for your binary.

               •    Call the OtaManager startUpdate method, passing it the byte array - Implement the

                    OtaCallback methods to receive callback events on the OTA transfer state.

               •    Call the OtaManager about method to abort the upgrade if needed.

 

The above basic API code will allow a user to design and implement an app with custom UI components to manage OTA upgrades.  However, a default UI implementation is provided.

OtaUIHelper provides a default UI wrapper around OtaManager.

 

The basic use case for OtaUIHelper is:

     •    Add the OTA binary that is signed with your private key into the folder fwupdate with

          the name ****.ota.bin.signed

     •    Modify the OtaFirmwareUpdateInfo.m configuration class that is in the fwupdate folder,

          specifying the name of your binary.

     •    Create an instance of OtaUiHelper

     •    Implement an instance of OtaHelperDelegate to receive callback events about when the

          OTA process starts, stops, or terminates unexpectedly.

     •    Register the OtaHelperDelegate instance with OtaUiHelper by setting its delegate

          property.

     •    Call startUpdate API method.

 

 

FOR iOS (iOS 7 or higher)

 

OTA Implementation Instructions

 

(Source code is attached in post)

     1. The OTA code is an included set of Objective C APIs and optional UI components that

          can be included into an app.

     2. The OTA code resides in the folder WicedSmartOtaHelper

          •    OtaManager manages the OTA upgrade process

          •    OtaCallback is a delegate object you will implement and register with OtaManager to

               receive "callback events" that give the state/status of the OTA upgrade.

     3. Typical use case for implementing OTA Update using the OtaManager class

          •    Create an instance of OtaManager.

          •    Create an instance of your class that implements the delegate OtaCallback.

          •    Call OtaManager's addCallback method to register your callback.

          •    Read the OTA binary and obtain a NSData byte array for your binary.

          •    Call the OtaManager startUpdate method, passing it the byte array - Implement the

               OtaCallback methods to receive callback events on the OTA transfer state.

          •    Call the OtaManager about method to abort the upgrade if needed.

The above basic API code will allow a user to design and implement an app with custom UI components to manage OTA upgrades.  However, a default UI implementation is provided.

OtaUIHelper provides a default UI wrapper around OtaManager.

The basic use case for OtaUIHelper is:

     •    Add the OTA binary that is signed with your private key into the folder fwupdate with the

          name ****.ota.bin.signed

     •    Modify the OtaFirmwareUpdateInfo.m configuration class that is in the fwupdate folder,

          specifying the name of your binary.

     •    Create an instance of OtaUiHelper

     •    Implement an instance of OtaHelperDelegate to receive callback events about when the

          OTA process starts, stops, or terminates unexpectedly.

     •    Register the OtaHelperDelegate instance with OtaUiHelper by setting its delegate

          property.

     •    Call startUpdate API method.

 

 

Thanks,

 

JT

In this demo, we will see how to load the SmartBridge web application and connect with the WICED Sense kit to display sensor data.

 

  1. Downloads and Installations
    • Download the es-WiFi demo software and drivers from:

                    www.inventeksys.com/wp-content/uploads/Inventek_Systems_eS-WiFiDemo_v1.4_b2.zip

                         **** DO NOT CHANGE THE LOCATION OF THE WIFI DEMO SOFTWARE ON YOUR PC FROM THE ORIGINAL LOCATION GIVEN                 

 

                    Install it in the platforms folder:  ...\WICED\WICED-SDK-3.1.2\WICED-SDK\platforms

    • Upon installation, you should see the patches in the platforms folder:

                    ISM_Platforms.PNG

 

     2. Running the ISM GUI

                    Note: If an error or problem occurs for any step throughout the connection process, it is important to unplug the ISM340USB stick, plug it back in and start from the beginning of this tutorial.

    • In order to run the ISM GUI go to the following folder: ..\Inventek Systems\eS-WiFi\demo and open the es-WiFI.application
    • plugin the ISM340 USB stick into the PC and identify which COMPORT it is
    • In the es-WiFi demo GUI, go to Menu > Install Drivers
    • Once installation is complete, you should see this screen:

                                  

 

    • Go to device manager, click on the correct COM port and change the following settings
      • Baud Rate/BPS: 115200
      • Parity: None
      • Data Width: 8
      • Stop Bits: 1
      • Flow Control: None

 

    • We shall now open the Com Ports: To do so go to Setup > Serial Port > Configure/Open
    • You should see the following screen:

 

              

 

    • Verify that the correct settings are in place as listed above and press OK to open the COM port.

 

     3. Setting up the SmartBridge Web Application

               Note***: Before we begin, it is important to note that every command has to be typed into the command line box. After you type in a command and press send, it will always take you to the main window. It is important to go navigate back to the command line to ensure a much smoother process.

 

    • Type in your SSID into the command line box and press send. Once you press send, the program will ask you if the SSID listed above is correct, type in and enter "y" or "n' accordingly.
    • Once past this step, type in the correct password. Once again it will ask you if the password that shows on the screen is correct. Give the appropriate response.
    • Once your password is entered, enter your security type and press "y". It will automatically generate an IPv4 address for the SmartBridge web application.

                   

    • Copy and Paste the given IPv4 address into the internet browser of your choosing. You have now connected to the BT SmartBridge application

 

     4. Connecting to the WICED SENSE

    • We shall connect the ISM-43340 USB stick with the WICED Sense Kit
    • We have programmed wiced_sense.c onto the Kit to display all sensor information
    • Wake up the WICED Sense Kit and press Rescan on the web application
    • You should see the name: WICED Sense Kit along with an address. Connect with the Kit by pressing the "connect" button right next to the address of the Kit
    • Once connected, the WICED Sense Kit will show up on the Connection Pairings List. You have now connected the ISM340 with the WICED Sense Kit.

              

 

 

    • In order to view the GATT profile, we will press the "Details" button. Once pressed,  the screen should look like this:

                   

 

 

We have now completed the Inventek ISM340 SmartBridge Application Demo. For further questions, please refer to the community forums.

This blog is designed to demonstrate how to add and remove peripheral devices from the White List using hello_sensor and hello_client.

We will use 2 TAG03 boards, but you can use 2 or more.

 

We will show you how to clear the white list and how to enable the white list and add a mac address to it as well as have advertisements sent only to the device which has been added to the white list.

 

 

1. Update hello_sensor

     Attached is the modified hello_sensor.c file that should be downloaded to replace the existing hello_sensor.c file.

 

2. Change the makefile name of hello_sensor and download it. The new makefile should be as follows:

  hello_sensor-BCM920736TAG_Q32 BT_DEVICE_ADDRESS=112233445567 UART=COMxx download

 

3. Change the makefile name of hello_client and download it. The new makefile should be as follows:

hello_client-BCM920736TAG_Q32 BT_DEVICE_ADDRESS=112233445566 UART=COMxx download

 

** Note: xx is the COM port number designated to your specific TAG03 board.

 

4. Open HCI traces for the board with hello_sensor programmed on it (board 'B') to observe the white list enable/disable and start/stop advertisement. (For more information on how to use traces, please check the Quick Start Guide)

 

5. Modify the client_addr array in the hello_sensor.c file to contain the mac address of hello_client as follows:

 

     ***NOTE: The client address (board B) should be the first address in the array.

 

6.  Hold SW1 on the hello_client board (board 'A') for 6 seconds. While holding SW1 on board 'A', press SW1 on board 'B'. The following trace should pop up on the console, with the mac address of the client listed:

We can see that board 'B' is added to the white list for board 'A' and can now send notifications,etc.

 

Here are the steps required to delete an address from the white list:

 

  1. change the address on hello_client to be random:

          hello_client-BCM920736TAG_Q32 BT_DEVICE_ADDRESS=random UART=COMxx download

 

    2. Open HCI traces, and hold SW1 on hello_client board (board 'A') for 6 seconds. While holding SW1 on board 'A', press SW1 on board 'B'. You will see that board 'B' does not connect to board 'A'. This is  because the white list of board 'A' does not include board 'B'. As a result, there will be no exchange of advertisements with board 'B'.

 

 

 

Fore more information on how to proceed, here is a chart:

 

Filter Blog

By date:
By tag: