8. Build a DA14585/586 Application

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

It provides step-by-step instructions for loading the example as a project in the Keil environment, setting it up and building it, and finally executing it via the debug environment on any of the DA14585/586 devices.

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

The DA14585/586 Software Development Kit (SDK) includes examples running on the Pro and the Basic Development Kits. The examples are provided with preconfigured KEIL projects.

The SDK zip archive is downloaded from the customer support web page.

More details are provided in the DA14585 & DA14586 Software Developer’s Guide (UM-B-080).

8.1. The Blinky Peripheral Example Application

Blinky is a simple application which demonstrates basic initialization of DA14585/586 and LED blinking. After downloading the SDK, the blinky source code example can be found in the directory called peripheral_examples.

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

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

../_images/blinky_path.jpg

Figure 21 Blinky Project directory

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

../_images/blinky_project.jpg

Figure 22 Blinky Project Keil Workspace

  1. Click on the Target Options button, then click on the Device tab. The dialog should look like this.

../_images/blinky_option.jpg

Figure 23 Blinky Project Options

  1. Click on Linker. Scatter files (.sct) are used for selecting memory areas.

../_images/blinky_scatter.jpg

Figure 24 Blinky Project Scatter File

  1. Click on Debug and ensure J-LINK/J-TRACE Cortex is selected and that the Initialization File is set correctly to .sysram.ini.

../_images/blinky_linker.jpg

Figure 25 Blinky Project: Debug Option

  1. Click on Settings and check that the SW Device has been detected correctly.

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

  2. Build the project by pressing F7 key, or clicking the Build button, see Figure 27.

../_images/blinky_built.jpg

Figure 27 Blinky Project: Project Building

  1. Make sure you have a UART connection between your PC and the motherboard, as shown in Figure 12. Check the COM number on your PC.

  2. Open Tera Term, choose the COM port from step 9, and click OK.

  3. Select Setup > Serial Port to configure the port as shown in Table 1.

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

../_images/blinky_debug.jpg

Figure 28 Blinky Project: Start Debug Session

  1. If a non-licensed version of Keil is used, the following dialog is displayed. Click OK.

../_images/blinky_popup.jpg

Figure 29 Keil Lite Pop Up Window

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

../_images/blinky_run.jpg

Figure 30 Blinky Project: Code Execution

When the blinky message is displayed on your UART terminal screen and the green LED is blinking you have successfully programmed and started the blinky program on DA14585/586 Demo board.

../_images/blinky_blinky.jpg

Figure 31 Blinky Project: Blinky message on COM28 terminal

8.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). See the Bluetooth SIG for more details.

  1. Open the folder containing 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.uvproj to open the project in Keil.

../_images/barebone_path.jpg

Figure 32 Barebone BLE Project directory

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 and so the only jumpers required are those for the debugger interface as noted in Table 3.

  1. Use the Android application BLE Scanner to scan for, and connect to, the DIALOG-BRBN app, see Figure 34.

../_images/barebone_scan.png

Figure 34 Barebone BLE: Interacting with BLE Application

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

Note

In this example, we used an Android application but you can also use the LightBlue iOS application to connect an iPad/iPod/iPhone device to the application.

8.3. Troubleshooting

  • If you can’t see any blinky messages in your UART terminal and the LED is not blinking,

    check the UART and LED jumper configuration, see Table 2. You can also make sure that the hardware configuration is set for Basic Development Kit, see Figure 36 in Appendix A.

Table 2 Blinky Example UART and LED Jumper Configuration

GPIO

Function

Jumper

P0_4

UART2 TX

Connect J4.11 - J4.12

P0_5

UART2 RX

Connect J4.13 - J4.14

P1_0

LED

Connect J9.1 – J9.2

  • If you can’t start a debug session, check the SWD debugger jumper configuration, see Table 3.

Table 3 Blinky Example SWD Debugger Jumper Configuration

JTAG

Function

Jumper

TMS

SWD IO

Connect J4.25 - J4.26

TCK

SWD CLK

Connect J4.27 - J4.28

Note

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

8.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 DA14585/586:

  • Codeless Tutorial: To quick start your IoT application and learn more about AT commands.