
# USB CDC and SMSD SUOTA loader

---


## Example description

This application allows to enable the SMSD on boot and allow to update the
application Firmware when a file called UPDATE.DAT is dropped on the SMSD
storage.

After dropping the UPDATE.DAT file on the mass storage partition, pressing the
reset button will trigger an update of the firmware image and boot on the newly
programmed image.



## HW and SW configuration


* **Hardware configuration**

	- This example runs on The DA14681 Bluetooth Smart SoC devices.
	- The Pro Development Kit (ProDK) is needed for this example.
	- The **ProDK mainboard** is combined with the **daughter-board**.
	- Connect the ProDK to the host PC over the standard mini-USB cable connector marked as USB-DBG.

* **Software configuration**

	- This example requires:
    * Smartsnippets Studio 1.6.3.
    * SDK1.0.12
	- **SEGGER’s J-Link** tools should be downloaded and installed.


## How to run the example

### Initial Setup

Connect USB2(dbg) to your computer.

- Import the project into your workspace
- Compile the project for the development Kit.
- Program it in the QSPI flash

Use your favorite terminal to the serial port (FTDI lower index port) with the following paramters

    - baudrate: 115200
    - data: 8 bits
    - stop: 1 bit
    - parity: None
    - flow  control: none

After programming the device press the Reset button (K2). You should see the
device entering a loop indicating:

    Checking update image...
    No valid image, rebooting

Now plug the USB1(chg) to your computer. The device should now indicate:

    Newstate 18 attached
    ready
    USB is active
    Newstate 1c attached
    ready
    addressed
    Newstate 1e attached
    ready
    addressed
    configured
    USB is active
    USB is active

![screenshot1|width=50%](assets/markdown-img-paste-20180601110858312.png "test title")

### Build and Program a new Image

For this example we will use the *pxp_reporter* as active firmware image.
You can pick up anything, the requirement is to choose a SUOTA enabled
application.

- Import pxp_reporter in your workspace
- Select DA14681-01-Release_QSPI_SUOTA build Configuration
- Compile the project

This will generate the bin file for the application. It is now required
to add the SUOTA header to this file in order to make it boot-able by the
SUOTA loader. The steps to build a SUOTA image are described in
[UM-B-056 section 13.1.5](https://support.dialog-semiconductor.com/resource/um-b-056-user-manual-da1468x-software-developers-guide-html).

Once the image is created, rename it UPDATE.DAT. as shown in the picture below


![screenshot2](assets/copy_image.png)

You can now unplug the USB1(chg). This will trigger a check of the image presence
perform the software upgrade and boot on the new image

![unplg usb](assets/markdown-img-paste-2018060115220681.png)

Taking your favorite Bluetooth low energy scanner you should be able to find
a proximity reporter in the area

![pxp_rep](assets/IMG_0610.PNG)



## Known Limitations


- There are No known limitations for this example. But you can check and refer to the following application note for
[known hardware limitations](https://support.dialog-semiconductor.com/system/files/resources/DA1458x-KnownLimitations_2018_02_06.pdf "known hardware limitations").
- Dialog Software [Forum link](https://support.dialog-semiconductor.com/forums/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software"Forum link").
- you can Refer also for the Troubleshooting section in the DA1585x Getting Started with the Development Kit UM-B-049.


## License


**************************************************************************************

 Copyright (c) 2018 Dialog Semiconductor. All rights reserved.

 This software ("Software") is an unofficial release and is owned by Dialog Semiconductor. By using this Software
 you agree that Dialog Semiconductor retains all intellectual property and proprietary
 rights in and to this Software and any use, reproduction, disclosure or distribution
 of the Software without express written permission or a license agreement from Dialog
 Semiconductor is strictly prohibited. This Software is solely for use on or in
 conjunction with Dialog Semiconductor products.

 EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES OR AS
 REQUIRED BY LAW, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. EXCEPT AS OTHERWISE PROVIDED
 IN A LICENSE AGREEMENT BETWEEN THE PARTIES OR BY LAW, IN NO EVENT SHALL DIALOG
 SEMICONDUCTOR BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR
 CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE SOFTWARE.

**************************************************************************************
