7. Build a DA14585/586 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 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 5 and Section Section 6.

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.

Warning

To run Blinky or BLE Barebone examples you don’t need to install Dialog SmartSnippets™ Studio tool but it is a part of the full Development Environment.

7.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 15 Blinky Project directory

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

../_images/blinky_project.jpg

Figure 16 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 17 Blinky Project Options

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

../_images/blinky_scatter.jpg

Figure 18 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 19 Blinky Project: Debug Option

  1. Click on Settings (on the right: Debugger) 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 21.

../_images/blinky_built.jpg

Figure 21 Blinky Project: Project Building

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

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

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

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

../_images/blinky_debug.jpg

Figure 22 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 23 Keil Lite Pop Up Window

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

../_images/blinky_run.jpg

Figure 24 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. Use the same Default Jumper configuration as shown in Figure 3.

../_images/blinky_blinky.jpg

Figure 25 Blinky Project: Blinky message on COM28 terminal

Note

The whole application is placed/executed in RAM. For more details about RAM management you can refer to How to change the RAM size Tutorial.

Note

SPI Flash (U8: See Figure 5) can also be used for downloading an image file (a .hex or .bin). for SPI flash programming steps using SmartSnippets Toolbox you can refer to UM-B-083: Section 19: SPI Flash Memory Example and for SPI flash programming Keil example you can refer to UM-B-119: Section 5.8: SPI Flash Programmer. The Figure 26 shows the Jumper setting for the J5 when using SPI configuration for the DA14585/586.

../_images/spiflash.bmp

Figure 26 DA14585/586 J5 Jumper setting for SPI flash programming

Warning

  • For the DA14585/586 P0_5 and P0_6 ports are used for the SPI flash connection.

7.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 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 27 Barebone BLE Project directory

Figure 28 shows the Keil project layout.

../_images/barebone_keil.jpg

Figure 28 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 5.

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

../_images/barebone_scan.png

Figure 29 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.

Note

When you change the advertising name of your device and you don’t want your iPhone/iPad.. to connect to it anymore, it’s easy to make your device forget about it. Follow easy steps mentioned in the Apple Support Communities and your iPhone won’t remember your Bluetooth device. If you change your mind, no worries, you can pair the device as though it were new.

Warning

When multiple device use the same BD address in the same room test, it is highly recommended to changes manually your BD address or use the static random address (advanced) to avoid any conflict, You can refer to Tutorial 1: Advertising contents

7.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 4.

Table 4 Blinky Example UART and LED Jumper Configuration

GPIO

Function

Jumper

P0_4

UART2 TX

Connect J5.11 - J5.12

P0_5

UART2 RX

Connect J5.13 - J5.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 5.

Table 5 Blinky Example SWD Debugger Jumper Configuration

JTAG

Function

Jumper

TMS

SWD IO

Connect J5.25 - J5.26

TCK

SWD CLK

Connect J5.27 - J5.28

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

Note

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

7.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.