5. How to build
The Serial port service consists of two parts: - Server (peripheral device or just device) - Client (central or host device) This section describes the way how to build the corresponding projects for a device or a host with different compilation options during the build and the way to run them when the debugger is used. Aside from the debugger, the program can run with SmartSnippets or be burned into the flash. These procedures will be described in other sections.
5.1. To Build a SPS Device Application
5.1.1. Keil uVision (ARMCC)
The following are the steps to build the SPS applications for target:
Extract the SPS application zip file.
Use Keil uVision to open projects:
\target_apps\dsps\dsps_device\Keil_5\dsps_device.uvprojx
- Select the desired target:
Choose dsps_531 for the DA14531 chipset.
Choose dsps_535 for the DA14535 chipset.
Choose dsps_585 for the DA14585 chipset.
To use the default compilation options, just press
F7
to build the project.
Note
To change any of the compilation switches, please follow the instructions described in (Section 5.1.4.1).
After a successful build, a
.hex
file is produced in the directory for either DA14531-DA14535 or DA14585 respectively:\target_apps\dsps\dsps_device\Keil_5\out_531\
\target_apps\dsps\dsps_device\Keil_5\out_585\
\target_apps\dsps\dsps_device\Keil_5\out_535\
Configure the debugger:
Press
Alt
+F7
In the Debug tab, click the Settings button.
Select the appropriate SN and then in the Port field SW.
Click Apply in order to save.
Click OK to exit.
Start the debugging session by pressing
Ctrl
+F5
, run the program by pressingF5
. Now the device is in the Connectable state, and any Central device is able to detect it and connect to it.Stop the debugger session by pressing
Ctrl
+F5
.
5.1.2. SmartSnippetsStudio (GCC)
Import the project
Extract the SPS application zip file.
Open SmartSnippetsStudio, and then click File > Import
In the Import dialog, expand General and then double click Existing Projects into Workspace
In the Import Projects dialog, click Browse, and then select your workspace directory.
Click Select All button or select individual projects (i.e. sps_device), and then click Finish.
- Build the project
To select the active build configuration, click Project > Build Configurations > Set Active and choose the configuration that corresponds to the required chipset.
To build the project, click Project > Build Project (Ctrl+B).
- Run/debug the project
To run the project, click Run > Debug Configurations…
In the Debug Configurations dialog, expand SmartBond “SmartSnippets SDK” via J-Link GDB Server, and then click the corresponding RAM_DA145[xx] configuration.
In the Main tab, ensure that fields Project and C/C++ Application are configured properly, and click Debug.
5.1.3. e2 Studio (LLVM)
- Import the project
Extract the SPS application zip file.
Open e2 Studio, and then click File > Import
In the Import dialog, expand General and then double click Dialog SDK Project
In the Import Projects dialog, click Browse, and then select your workspace directory.
Click Select All button or select individual projects (i.e. sps_device), and then click Finish.
- Build the project
To select the active build configuration, click Project > Build Configurations > Set Active and choose the configuration that corresponds to the required chipset.
To build the project, click Project > Build Project (Ctrl+B).
- Run/debug the project
To run the project, click Run > Debug Configurations…
In the Debug Configurations dialog, double click Renesas GDB Hardware Debugging to create a new debug configuration.
In the Main tab, ensure that fields Project and C/C++ Application are configured properly, and click Debug.
5.1.4. IAR Embedded Workbench (IAR)
- Import the project
Extract the SPS application zip file.
Open IAR Embedded Workbench, and then click File > Open Workspace.
In the Open Workspace dialog, navigate to the IAR SPS project folder, select the
sps_device.eww
project file, and then click Open.
- Build the project
To select the active build configuration, click Project > Edit Configurations…
In the Configurations for “sps_device” dialog, select the configuration that corresponds to the required chipset, and then click OK.
To build the project, click Project > Make F7.
- Run/debug the project
To run the project, click Project > Download and Debug Ctrl+D.
5.1.4.1. Compilation Switches for SPS Device Application
Before the SPS device application is compiled, the user can modify the following configuration options:
definitions in user_profiles_config.h
In user_profiles_config.h
, there are four profiles defined by default:
CFG_PRF_SPSS: Profile of SPS server, needs to be defined.
CFG_PRF_REMOTE_CONFIG: Profile for remote configuration. If undefined, the functionality of Remote Configuration is disabled.
CFG_PRF_SUOTAR: Profile for Software update over the air. If defined, it can be also used to update the device’s Configuration Image.
CFG_PRF_DISS: Profile for Device Information Service. If defined, Device Information Service is supported.
definitions in da145xx_config_advanced.h
In da1458x_config_advanced.h
there are the following defines:
CFG_NVDS_TAG_BD_ADDRESS: Changes the BD address of the SPS peripheral device. This BD address is used only if no other BD address is defined in OTP.
CFG_USE_HEAP_LOG and CFG_BLE_FLOW_CONTROL, As detailed in BLE Flow Control , the BLE FLOW Control is based on the current heap usage. Undefining these definitions, there is the risk that during data exchange the available heap will exhaust and it is possible that the system hangs. It is not recommended to undefine these definitions.
CFG_BLE_METRICS: If defined, the user gets statistics about the BLE traffic.
MSG_HEAP_SZ: Change the heap size that is available for messages. Needs to be defined. The maximum sizes are used for the DA14531 ,DA14535 and the DA14585 by default. It is not recommended to make changes to this parameter, as it may have serious impact on the overall SPS functionality.
CFG_CONFIG_STORAGE: Profile for Configuration storage. If defined, parameters from a valid configuration image in the flash will be applied and, also, the configuration parameters can be updated, if Remote Configuration Service is enabled.
CFG_EXTERNAL_WAKEUP: Enables the functionality of wakeup from the external processor that is running the host application. This is done with the use of a gpio_ext_wakeup GPIO. The selected GPIO can be included in the Configuration Image of the flash and can be configured by the Remote Configuration Service.
CFG_WAKEUP_EXT_PROCESSOR: Enables the functionality of waking up the external processor that runs the host application. This is done with the use of a gpio_wakeup_ext_host GPIO. The selected GPIO can be included in the Configuration Image of the flash and can be configured by the Remote Configuration Service.
USE_DLE: If it is undefined the device sends and receives packets without DLE support. By default, it is enabled, for higher throughput performance.
definitions in da145xx_config_basic.h
In da14xx_config_basic.h
there are the following defines:
CFG_DEVELOPMENT_DEBUG: If enabled, there is more debug information available and in combination with definition of CFG_PRINTF you can have print messages on UART2 console.
CFG_PRINTF: Enables logs that will be printed in the UART2 console regarding connect, disconnect and metrics.
CFG_MAX_CONNECTIONS: The maximum concurrent connections supported by the application. Needs to be defined to 1, to optimize the memory utilization.
DA1453x limitation
In order to enable some of the above-mentioned definitions for the DA14531 you need to disable first one of the profiles defined in user_profiles_config.h
, due to the limited memory area.
5.2. Build the SPS Host Application
5.2.1. Keil uVision (ARMCC)
The following are the steps to build the SPS applications for host:
Extract the SPS application zip file.
Use Keil uVision to open projects
\target_apps\dsps\dsps_host\Keil_5\dsps_host.uvprojx
- Select the desired target:
Choose dsps_531 for the DA14531 chipset.
Choose dsps_535 for the DA14535 chipset.
Choose dsps_585 for the DA14585 chipset.
Before the host app is built, you can configure the desired peer to which the host wants to connect to in the following way: In file
user_sps_host_config.c
go to theuser_central_conf struct
and fill in the memberpeer_addr_0
the BD address of the desired SPS device. (i.e.peer_addr_0 = {0xCD, 0x00, 0x00, 0xCA, 0xEA, 0x80}
) .
Note
The default BD address in the SPS device project is set in da145xx_config_advanced.h
with the definition CFG_NVDS_TAG_BD_ADDRESS
.
To use the default compilation options just press
F7
to build the project. To change any compilation switches, please follow the instructions described in this section.After a successful build, a
dsps_host_5xx.hex
file is produced in the directory for either DA14531-DA14535 or DA14585 respectively:\target_apps\dsps\dsps_device\Keil_5\out_531\
\target_apps\dsps\dsps_device\Keil_5\out_585\
\target_apps\dsps\dsps_device\Keil_5\out_535\
- Configure the debugger:
Press
Alt
+F7
.In the Debug tab, click the Settings button.
Select the appropriate SN and then in the Port field select SW.
Click Apply to save.
Click OK to exit.
- Start the debugging session:
Press
Ctrl
+F5
.Press
F5
to run the program. Now the host starts to scan and when the desired peer is in Connectable state it will connect to it automatically. Without setting a desired peer in Step 5, the host will connect to any available SPS device that is in Connectable state.
Press again
Ctrl
+F5
to stop the debugger session.
5.2.2. SmartSnippetsStudio (GCC)
- Import the project
Extract the SPS application zip file.
Open SmartSnippetsStudio, and then click File > Import
In the Import dialog, expand General and then double click Existing Projects into Workspace
In the Import Projects dialog, click Browse, and then select your workspace directory.
Click Select All button or select individual projects (i.e. sps_host), and then click Finish.
- Build the project
To select the active build configuration, click Project > Build Configurations > Set Active and choose the configuration that corresponds to the required chipset.
To build the project, click Project > Build Project (Ctrl+B).
- Run/debug the project
To run the project, click Run > Debug Configurations…
In the Debug Configurations dialog, expand SmartBond “SmartSnippets SDK” via J-Link GDB Server, and then click the corresponding RAM_DA145[xx] configuration.
In the Main tab, ensure that fields Project and C/C++ Application are configured properly, and click Debug.
5.2.3. e2 Studio (LLVM)
- Import the project
Extract the SPS application zip file.
Open e2 Studio, and then click File > Import
In the Import dialog, expand General and then double click Dialog SDK Project
In the Import Projects dialog, click Browse, and then select your workspace directory.
Click Select All button or select individual projects (i.e. sps_host), and then click Finish.
- Build the project
To select the active build configuration, click Project > Build Configurations > Set Active and choose the configuration that corresponds to the required chipset.
To build the project, click Project > Build Project (Ctrl+B).
- Run/debug the project
To run the project, click Run > Debug Configurations…
In the Debug Configurations dialog, double click Renesas GDB Hardware Debugging to create a new debug configuration.
In the Main tab, ensure that fields Project and C/C++ Application are configured properly, and click Debug.
5.2.4. IAR Embedded Workbench (IAR)
- Import the project
Extract the SPS application zip file.
Open IAR Embedded Workbench, and then click File > Open Workspace.
In the Open Workspace dialog, navigate to the IAR SPS project folder, select the
sps_host.eww
project file, and then click Open.
- Build the project
To select the active build configuration, click Project > Edit Configurations…
In the Configurations for “sps_host” dialog, select the configuration that corresponds to the required chipset, and then click OK.
To build the project, click Project > Make F7.
- Run/debug the project
To run the project, click Project > Download and Debug Ctrl+D.
5.2.5. Compilation Switches for SPS Host Device Application
Before the SPS host application is compiled, the user has the ability to modify the following configuration options:
definitions in user_profiles_config.h
In user_profiles_config.h
, there is one profile defined by default:
CFG_PRF_SPSC: Profile of SPS client, needs to be defined.
definitions in da145xx_config_advanced.h
In da145xx_config_advanced.h
there are the following defines:
CFG_NVDS_TAG_BD_ADDRESS: Changes the BD address of the SPS central device. This BD address is used only if no other BD address is defined in OTP.
CFG_LOG_HEAP_USAGE and CFG_BLE_FLOW_CONTROL are definitions both used for the DA14531 chipset and have to be undefined for the DA14585 chipset. This is described in section 4.2.3. The BLE FLOW Control for the DA14531 is based on the current heap usage. If you undefine these definitions, there is the risk that during data exchange the available heap will exhaust and the possibility that the system will hang. It is not recommended to undefine these definitions.
CFG_BLE_METRICS: If defined, the user gets statistics about the BLE traffic.
MSG_HEAP_SZ: Changes the heap size that is available for messages, needs to be defined. The maximum sizes are used by default for the DA14531,DA14535 and the DA14585. It is not recommended to make changes to this parameter, as it may have serious impact on the overall SPS functionality.
CFG_CONFIG_STORAGE: Profile for Configuration storage. If defined, the parameters from a valid configuration image in the flash will be applied.
CFG_EXTERNAL_WAKEUP: Enables the functionality of wakeup from the external processor that is running the host application. This is done with the usage of a gpio_ext_wakeup GPIO. The selected GPIO can be included in the Configuration Image of the flash and configured with this define.
- CFG_WAKEUP_EXT_PROCESSOR: Enables the functionality to wake up the
gpio_wakeup_ext_host
GPIO. The selected GPIO can be included in the Configuration Image of the flash and configured with this define.
USE_DLE: If undefined, the device sends and receives packets without DLE support. By default, this define is enabled, for higher throughput performance.
definitions in da145xx_config_basic.h
In da145xx_config_basic.h there are the following defines:
CFG_DEVELOPMENT_DEBUG: If enabled, there is more debug information available and in combination with the definition of CFG_PRINTF you can get print messages on the UART2 console.
CFG_PRINTF: Enables logs about connect, disconnect and metrics information that will be printed in the UART2 console.
USE_DLE: If undefined, the device sends and receives packets without DLE support. By default this define is enabled, for higher throughput performance.
CFG_MAX_CONNECTIONS: The maximum concurrent connections supported by the application. Needs to be defined to 1. Although, in the configuration structure
user_central_conf
there are 8 different addresses, the host can connect only to 1 , starting from the memberpeer_addr_0
.
DA1453x limitation
In order to enable the above definitions for DA14531 you first need to disable one of the profiles defined in
user_profiles_config.h
.