User guide

In this section we will focus on how to get started with the Social Distancing Tag application and how to get the optimal performance from the hardware available.

Build the application

If you are not familiar with the development on the DA1469x platform, it is strongly recommended to go through the DA1469x Getting Started as this document will guide you through the installation of the development environment as well as writing a first application in the flash.

Once accustomed with the process, the required step to build the SDT application are:

  • Download and unzip the WiRA SDK. It is required to register and sign the SLA in order to be able to download the SDK.

  • Download and unzip the Social Distancing Tag application.

  • Make sure there is no space in the path of the WiRa SDK or the SDT application (it would cause the compiler to fail)

  • Start SmartSnippets Studio and select the workspace to point at the root of the SDK. The means the folder named WiRa_XXX (contains the folder sdk, binaries, utilities…)

  • To be sure the workspace is correctly set, make sure the .metadata folder has been created along the binaries folder in the SDK root.

_images/metadata.png
  • Browse for resources to import the Social Distancing Tag application in the project

_images/browse.png
  • Select the SDT project and finalize the import.

  • Select the IDE view and build the project. Eventually the application is built and the result is visible in the SmartSnippets studio console

_images/build.png
  • Proceed with flashing the application in the SDK as described in the Software build section of the Getting Started guide. Please note it is required to import the python_script project to the access the flash programming tool.

Development kit configuration

At this stage it is assumed the reader has two programmed development kits. The procedure is the same whether the development kit is the pro-kit or a USB-kit although the behavior will differ depending on the selected development kit.

The behavior is described in details later, but the application assumes that the presence of the VBUS power supply means the SDT is in charge and should not perform ranging operations. In order to allow ranging on the USB-kit it is necessary to supply the DA14695 with VBAT and disconnect VBUS.

This can be achieved by disconnecting the jumper on J2 and connecting a jumper between pin 1 and pin 2. on J3

_images/sdt_jumper_setting.png

Crystal trimming

For Wireless ranging operation it is extremely important to perform crystal trimming of the development board in order to achieve a clock accuracy of below 2ppm for the 32 MHz crystal. Dialog provides the Production Line Tool which allows manufactures to perform such operation during the production process. To make it easier during development or evaluation, a procedure designed to achieve optimal performance is described here.

First download the UART_XTAL_TRIM.bin application and store it in the WiRa SDK binaries folder.

Open a terminal, go to the binaries folder and execute:

 > cli_programmer.exe <YOUR_COM_PORT> boot UART_XTAL_TRIM.bin

Press reset(K2 on the USB-kit) when requested.

The crystal Trimming application is now booted and the 32MHz clock is output on port P1_6. This GPIO is available on header connector J4 on the pro-kit and the header J1 pin 1 on the USB-kit

Open your preferred serial terminal application (115200/8-N-1) and press “+” or “-” keys on the keyboard to adjust the frequency.

In order to meet the target accuracy, the frequency should be adjusted to +/- 64Hz after the device has been powered on for at least a couple of minutes and is running at room temperature. It is required to use a frequency counter which can measure such kind of accuracy.

The application output should as shown below

_images/trimming.png

Once the frequency is trimmed as close as possible to 32MHz, it is required to write it in the DA1469x OTP in order to let the application know how to configure the oscillator at the boot. For the rest of this chapter, let’s assume the optimal value is 0x000AFD1F as shown earlier.

First find the first free entry in the OTP configuration script. In the same terminal you used to boot the crystal trimming application, execute:

 > cli_programmer <YOUR_COM_PORT> read_otp 0x300 100

In the example below the first free entry is 0x345 (first line with only 0xFF)

_images/first_free.png

We shall now program the optimal value in the OTP with the following command:

> cli_programmer  <YOUR_COM_PORT> write_otp 0x0345 2 0x50010000 0x000AFD1F

Warning

0x0345 (address) and 0x000AFD1F (trim value) are provided for example. It is required to adapt those value for each device.

Please confirm the success of the operation by repeating the read command. The crystal trim value is now programmed. None of these operation have affected the content of the flash. After a reset, the application will start and it will use the optimal crystal configuration.

Application configuration

The chapter additional features contains information about the application configuration parameters. The application allows, for instance, to configure which RSSI threshold is used for warning zone. In order to update these parameters it is possible to use the cli_programmer in the same way as it is used to store the trim value but this time to store data in the flash.

The base address for the application configuration database is 0xFE100. The parameter danger zone expressed in cm is at the offset 0x12. Moving the threshold of the danger zone from 200cm (default) to 150 cm would consist in issuing the command:

> ./cli_programmer <YOUR_COM_PORT> write_qspi_bytes 0xFE112 0x96 0x00

Please note this parameter is a uint16_t, as a result it is required to write two bytes with the lower byte first.

Operation can be confirmed by reading the content:

> ./cli_programmer <YOUR_COM_PORT> read_qspi 0xFE100 - 0x20

read_qspi

Distance Offset calibration

Antenna implementation will also have significant impact on the accuracy of the wireless ranging. Depending on whether the application is loaded on the pro-kit, USB-kit, or the WiRA Development kit (modified USB-Kit with external antenna), three different antenna configurations will apply. Each configuration will introduce a different static offset in the measurement. It is required to measure and tune the offset to get the best possible performances during SDT operation.

The offset configuration procedure will be described in a future update of this document.

Software udpate over USB

Connect the USB port of the SDT device on the host computer

In a terminal from the /suousb_host execute the following command

> host_usb_updater.exe <COMPORT> <PATH to the new img>

Make sure you use the .img file which is generated at the build time. This contains the image header with the software version. The software version can be edited using the filed in the ble_social_distance_tag/flash_image_sw_version_marking.h