9. Build a DA14531 Application

This section explains how the user can build, program, and run a simple software application on the ProDev Kit development board.

It provides step-by-step instructions to load the example as a project in the Keil environment, set up and build the project, and finally execute the project via the debug environment on the DA14531 device.

Make sure that you have all required tools installed as described in Section Section 7 and Section Section 8.

The DA14531 Software Development Kit (SDK) includes examples that run on the Pro Development Kits. The examples are provided with preconfigured KEIL projects.

Note

9.1. The Blinky Peripheral Example Application

Blinky is a simple application that demonstrates the basic initialization of DA14531 DA14585/586 and LED blinking. It will proof that the hardware is correctly connected to the PC and that power is applied. After the SDK is downloaded, the blinky source code example is in the directory called peripheral_examples.

  1. Open the folder that has the SDK files. Figure 17 shows the folder with the extracted SDK zip file.

  2. In <sdk_root_directory>\projects\target_apps\peripheral_examples\blinky\Keil_5, double-click blinky.uvprojx to open the project in Keil.

../_images/blinky_path.jpg

Figure 17 Blinky Project Directory

The development environment should look like Figure 18 when the project is opened with Keil:

../_images/blinky_project.jpg

Figure 18 Blinky Project Keil Workspace

  1. Click on the Target Options button, and then click on the Device tab. The dialog window should look like Figure 19.

../_images/blinky_option.jpg

Figure 19 Blinky Project Options

  1. Click on the Linker tab. Scatter files (.sct) are used to select memory areas.

../_images/blinky_scatter.jpg

Figure 20 Blinky Project Scatter File

  1. Click on the Debug tab. Make sure that J-LINK/J-TRACE Cortex is selected and that the Initialization File is correctly set to DA14531.ini.

../_images/blinky_linker.jpg

Figure 21 Blinky Project: Debug Option

  1. Click on the Settings button (in the top right of the “Debug” tab) and check that the SW Device is detected correctly.

The Serial Number (SN) should match the sticker on the bottom of the Motherboard.

  1. Click OK to save the settings in both windows. All settings are now saved and you can continue to build the example.

  2. Press the F7 key to build the project, or click the Build button. See Figure 23.

../_images/blinky_built.jpg

Figure 23 Blinky Project: Project Building

  1. Make sure that you have a UART connection between your PC and the motherboard, as shown in Figure 10. Find out what the COM port number is on your PC.

  2. Open Tera Term, select the COM port that is the same as that found in step 9, and click OK.

  3. In Tera Term, select Setup > Serial Port to configure the port as shown in Table 2.

  4. In Keil, select Debug > Start/Stop Debug Session.

../_images/blinky_debug.jpg

Figure 24 Blinky Project: Start Debug Session

  1. If a non-licensed version of Keil is used, then the dialog window in Figure 25 shows. Click OK.

../_images/blinky_popup.jpg

Figure 25 Keil Lite Pop Up Window

  1. Press F5 or click the Run button to start code execution.

../_images/blinky_run.jpg

Figure 26 Blinky Project: Code Execution

When the blinky message is displayed on your UART terminal screen (see Table 3 for Jumper configuration and Figure 28 for the connection on the motherboard) and the orange LED is blinking, you have successfully programmed and started the blinky program on the DA14531 Demo Board. Use the same default jumper configuration as shown in Figure 5.

Table 3 Blinky Example UART and LED Jumper Configuration

GPIO

Function

Jumper

P0_6

UART2 TX (2 Wires)

Connect J1.17 - J2.27

P0_5

UART2 TX (Single Wire)

Connect J1.19 – J1.20 Connect J10.1 – J1.15 Connect J10.2 – J1.17

P0_9

LED

Connect J8.3 – J8.4

Note

On the FCGQFN24 package, P0_5 is assigned to a single wire UART signal RxTx. To enable this on DA14531 PRO-Development kit, three additional jumpers need to be added. See Figure 27.

../_images/singlewire.svg

Figure 27 UART2 Single Wire Jumper Configuration

../_images/2wire.svg

Figure 28 UART2 Two Wires Jumper Configuration

../_images/blinky_blinky.jpg

Figure 29 Blinky Project: Blinky Message on COM28 Terminal

Note

The whole application is placed/executed in RAM.

Note

SPI Flash (U8: See Figure 7) can also be used to download an image file (.hex or .bin). For SPI flash programming steps with SmartSnippets Toolbox, see UM-B-083: Section 19: SPI Flash Programmer. For an SPI flash programming Keil example you can follow the SPI Flash Memory Example. Figure 3 shows the jumper settings for J1 when an SPI configuration (default) is used for the DA14531.

Note

The SmartSnippets™ Toolbox can be used to download code and erase flash via JTAG using the default Jumpers configurations as shown in Table 4 and Figure 30. Use of the 2 wires UART to download code in SPI flash is also possible. Please see the pin connection settings in Figure 31.

Table 4 Default Configuration Settings for SPI

Function

Signal

MOSI J1:3-4 (Default)

P0_0

FCS J1:7-8 (Default)

P0_1

MISO J1:9-10 (Default)

P0_3

SCK J1:5-6 (Default)

P0_4

../_images/j1_default.svg

Figure 30 SPI Flash Programing Through JTAG: Default Pins Configurations

../_images/uartspi.svg

Figure 31 SPI Flash Programing Through UART: Pins Configurations

Warning

  • To burn the SPI flash using SST over UART you will need to interface the DA14531 with pins other than the default, since the SPI default pins are multiplexed with the default UART pins. For this reason, modify the pin configuration to that shown in Figure 31.

  • Burning the flash via UART is also possible via single wire UART on P05.

9.2. The Barebone BLE Example Application

The Barebone BLE example application demonstrates basic BLE procedures such as advertising, connection, updating connection parameters, and implementation of the Device Information Service Server (DISS). For further reading see the Bluetooth SIG.

  1. Open the folder with the SDK files. This is the folder where you extracted the SDK zip file.

  2. In <sdk_root_directory>\projects\target_apps\ble_examples\ble_app_barebone\Keil_5, double-click ble_app_barebone.uvprojx to open the project in Keil.

../_images/barebone_path.jpg

Figure 32 Barebone BLE Project Directory

Note

The <sdk_root_directory>\projects\target_apps\ble_examples\ble_app_all_in_one is only supported in DA14585/86.

Figure 33 shows the Keil project layout.

../_images/barebone_keil.jpg

Figure 33 Barebone BLE: Keil Project Layout

  1. To execute the code and run the example, repeat steps 3 to 14 in The Blinky Peripheral Example Application.

The barebone application does not use the UART ( steps 9, 10, and 11 from Blinky can be skipped) and so the only jumpers required are those for the debugger interface as mentioned in Table 5.

  1. Use the SmartBond app to scan for, and connect to, the DIALOG-BRBN app, see Figure 34.

../_images/barebone_scan.jpg

Figure 34 Using the SmartBond app to connect to the BLE Application

Your BLE application is now running and advertising with the default advertiser string: “DIALOG-BRBN”.

Note

When you change the advertising name of your device and you leave the BD address the same, it will not show the update on your iPhone/iPad and not to connect to it anymore, it is easy to make your device forget about it. Follow some easy steps mentioned in the Apple Support Communities and your iPhone will not remember the Bluetooth device. If you change your mind, then you can pair the device as though it were new.

Warning

When multiple devices use the same BD address in the same room test (close enough so both can be detected by the user’s Bluetooth® explorer tool), it is highly recommended to change the BD address manually or use the static random address (advanced) to avoid any conflict. See Tutorial 1: Advertising contents

9.3. Troubleshooting

  • If you can not see any blinky messages in your UART terminal and the LED is not blinking, check the UART and LED jumper configuration. See Table 3. The DA14531 has two different UART options: either UART2 with 2 wires, or UART2 with 1 wire.

  • If you cannot start a debug session, check the SWD debugger jumper configuration. See Table 5.

Table 5 Blinky Example SWD Debugger Jumper Configuration

JTAG

Function

Jumper

SWDIO

SWD IO

Connect J1.23 - J1.24

SWCLK

SWD CLK

Connect J1.21 - J1.22

  • Due to the limited number of pins on the DA14531, the P0_11 is shared with the SW_Trigger functionality. To get a capture on the SmartSnippets™ toolbox you must either remove J8[1-2] on the motherboard (you will not have SW_trigger functionality in this case), or assign the button to a different GPIO and wire it to J19[2] or J19[4].

  • If you have trouble with the J-link firmware or any issue with SDK operation, see DA1458x/68x Development Kit J-Link Interface Application Note AN-B-052.

Note

If none of these actions resolved the issue, please contact the Dialog Software Forum.

  • When the device is programmed with an application in sleep mode, in order to attach the debugger, use a lower speed in JLink, eg 2000Khz.

9.4. What Next ?

This tutorial does not cover all the topics relevant to software development environments. It describes the first steps necessary to get started with the Pro Development Kit. The following links provide more information on DA14531: