Dialog Semiconductor DA1468 Series, DA14683 User Manual

Company Confidential
User Manual
DA1468x Mesh SDK
UM-B-098
Abstract
This document provides basic guidelines for developers and kit users to get familiar with the DA1468x Mesh SDK and to modify or create a BLE Mesh application based on it.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Contents
Abstract ................................................................................................................................................ 1
Contents ............................................................................................................................................... 2
Figures .................................................................................................................................................. 3
1 Terms and Definitions ................................................................................................................... 5
2 References ..................................................................................................................................... 5
3 Introduction.................................................................................................................................... 7
4 Features and Highlights ............................................................................................................... 7
5 Getting Started: Running the Demo Application ....................................................................... 8
5.1 Description ............................................................................................................................ 8
5.2 Connecting Hardware and Powering On .............................................................................. 9
5.3 Button and LED Usage ......................................................................................................... 9
5.3.1 Buttons and Switches ............................................................................................ 9
5.3.2 LEDs ...................................................................................................................... 9
5.4 Mesh SDK Demo Examples Bring up ................................................................................. 10
5.4.1 Mobile Application Instructions ............................................................................ 10
5.5 Various SDK Example Demonstrations .............................................................................. 19
5.5.1 Generic ON/OFF Model Demonstration .............................................................. 19
5.5.2 Generic Level Model Demonstration ................................................................... 19
5.5.3 Light HSL Model Demonstration .......................................................................... 19
5.5.4 Generic ON/OFF Model with Multiple Elements Demonstration ......................... 19
5.5.5 Vendor Specific Model Demonstration ................................................................ 20
5.5.6 Provisioner Example Demonstration ................................................................... 20
5.5.7 Proxy Example Demonstration ............................................................................ 20
5.5.8 Relay Example Demonstration ............................................................................ 21
5.5.9 Friend and Low Power Node Example Demonstration ....................................... 21
5.5.10 SW Upgrade Over The Air (SUOTA) Support ..................................................... 22
5.5.11 Microbus Devices Example Demonstration ......................................................... 22
6 Development Environment Setup .............................................................................................. 24
6.1 Installing the Environment ................................................................................................... 24
6.2 Importing and Building the BLE Mesh Project .................................................................... 24
6.2.1 Build project for DA14681 .................................................................................... 25
6.3 Flashing New Software into the SDK .................................................................................. 25
6.4 Modify the Bluetooth Address and Mesh Device UUID ...................................................... 27
6.5 Specify the Role of a Device ............................................................................................... 27
6.6 Debugging the Application .................................................................................................. 27
6.7 Obtaining Logging Information ............................................................................................ 29
6.7.1 UART Logging Window ....................................................................................... 29
6.8 Developing on Linux Host OS ............................................................................................. 29
6.9 Developing on MacOS ........................................................................................................ 30
6.10 Understanding Serial Terminal Options .............................................................................. 30
6.10.1 Reset the Accessory ............................................................................................ 31
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.10.2 Reset to Factory Default State ............................................................................ 32
6.10.3 Enabling or Disabling Mesh Features (Proxy/Relay/Friendship) ......................... 32
6.10.4 Security Keys Dump Function ............................................................................. 32
6.10.5 Monitor FreeRTOS Heap Usage and Task Stack Usage .................................... 33
6.10.6 Change Log Level ................................................................................................ 33
6.10.7 Change Default TTL Value Used when Sending Messages ............................... 33
6.10.8 Change Maximum BLE RF Range to around Two Meters .................................. 33
6.10.9 Commands Related to Friendship and Low Power Node ................................... 34
6.10.10 Modify the Subscription Address List of a Server Model ..................................... 34
6.10.11 Modify the Publish Address of a Client Model ..................................................... 35
6.10.12 Change Client Model State using the UART Console ......................................... 35
6.10.13 Change Provisioning Bearer ................................................................................ 36
6.10.14 Scan for Unprovisioned Devices ......................................................................... 36
6.10.15 Start Provision for Selected Device ..................................................................... 36
6.10.16 Start Configuration for Selected Node ................................................................. 36
6.11 Using the SEGGER SystemView ........................................................................................ 37
7 Software Architecture ................................................................................................................. 40
7.1 BLE Mesh Specification ...................................................................................................... 40
7.2 DA14683 Mesh SW Architecture ........................................................................................ 40
7.2.1 Overview .............................................................................................................. 40
7.2.2 Mesh DK SW Architecture ................................................................................... 41
7.2.2.1 Folder and File Structure ................................................................. 42
7.2.2.2 The user_<onoff/level/hsl>_<server/client>_example Files .. 42
7.2.2.3 The appl_proxy.c File .................................................................... 43
7.2.2.4 The appl_provision.c file .............................................................. 43
7.2.2.5 The appl_conf.c file ....................................................................... 43
7.2.2.6 The demo_hw.c file ........................................................................... 43
7.2.2.7 The appl_storage.c file .................................................................. 43
7.2.2.8 The mesh_console.c file .................................................................. 44
Revision History ................................................................................................................................ 45
Figures
Figure 1: DA14683 USB Development Kit ............................................................................................ 8
Figure 2: DA1468x PRO Development Kit, Motherboard and Daughterboard ..................................... 8
Figure 3: DA1468x Basic Development Kit ........................................................................................... 9
Figure 4: Start Dialog's BLE Mesh App ............................................................................................... 11
Figure 5: Create A Group in the Mesh Tab ......................................................................................... 11
Figure 6: Name the Group ................................................................................................................... 12
Figure 7: Power the Board Programmed as a Light ............................................................................ 12
Figure 8: Provision a new device ........................................................................................................ 13
Figure 9: Complete the provisioning process ...................................................................................... 13
Figure 10: Nodes screen ..................................................................................................................... 14
Figure 11: Settings, publish and subscribe configuration screens ...................................................... 14
Figure 12: Select the Nodes Tab ......................................................................................................... 15
Figure 13: Light Node screen .............................................................................................................. 15
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 14: Configuration Tab ............................................................................................................... 16
Figure 15: Nodes screen containing both switch and light node ......................................................... 16
Figure 16: Toggle Light Bulb States by SW1 ...................................................................................... 17
Figure 17: The group screen ............................................................................................................... 17
Figure 18: Red LED on Light Bulb Board Turned on .......................................................................... 18
Figure 19: Microbus 7-Segment Display and Slider Modules ............................................................. 23
Figure 20: Build Configurations of ble_mesh Project in SmartSnippets™ Studio ............................... 24
Figure 21: Build Log of ble_mesh Project in SmartSnippets™ Studio................................................. 25
Figure 22: Writing the generated Image into the flash ........................................................................ 26
Figure 23: Writing the generated Image into the flash: Log Output .................................................... 26
Figure 24: Debug Configurations ........................................................................................................ 27
Figure 25: Eclipse Debug Perspective ................................................................................................ 28
Figure 26: UART Logging Window ...................................................................................................... 29
Figure 27: Verifying the Correct J-Link Version................................................................................... 37
Figure 28: SEGGER SystemView Capture Settings ........................................................................... 38
Figure 29: SEGGER SystemView Trace Capture ............................................................................... 39
Figure 30: SystemView Trace - Task Switching .................................................................................. 41
Figure 31: Mesh DK SW Architecture ................................................................................................. 41
Figure 32: SW Stack and File Location ............................................................................................... 42
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
1 Terms and Definitions
ADV Advertising ATT ATTribute Protocol BLE Bluetooth Low Energy CPU Central Processing Unit DIS Device Information Service DK Development Kit FW Firmware GATT Generic ATTribute Profile GDB GNU Debugger HSL Hue Saturation Level HW Hardware iOS iPhone Operating System (Apple) IDE Integrated Development Environment LED Light Emitting Diode LPN Low Power Node LTK Long Term Key MACOS Macintosh Operating System (Apple) PCB Printed Circuit Board PTS Profile Tuning Suite RF Radio Frequency SDK Software Development Kit SIG (Bluetooth) Special Interest Group SRP Secure Remote Password (protocol) SUOTA Software Upgrade Over the Air SW Software SWD Serial Wire Debug TLL Time-to-Live USB Universal Serial Bus UUID Universally Unique Identifier
2 References
[1] Mesh_Model_Specification v1.0.pdf [2] Mesh Device Properties v1.0.pdf [3] Mesh_v1.0.pdf [4] Mesh Technology Overview.pdf [5] WGS17_Group Updates Main Deck.pdf [6] Dialog-BLE-Mesh-Training.ppt [7] UM-B-060, DA1468x/DA1510x Development kit Pro Hardware, User Manual, Dialog
Semiconductor [8] UM-B-057, SmartSnippets™ Studio User Guide, User Manual, Dialog Semiconductor [9] UM-B-066, DA1468x Development Kit Basic, User Manual, Dialog Semiconductor
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
[10] UM-B-047, DA1468x Getting Started with the Development Kit, User Manual, Dialog
Semiconductor [11] UM-B-056, DA1468x Software Developer's Guide, User Manual, Dialog Semiconductor [12] AN-B-037, DA1468x Power Measurements, Application Note, Dialog Semiconductor [13] UM-B-094, DA14683 USB Kit, User Manual, Dialog Semiconductor [14] UM-B-044, DA1468x Software platform reference, User Manual, Dialog Semiconductor
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
3 Introduction
This document provides basic guidelines for developers and kit users to get familiar with the DA1468x Mesh SDK and to modify or create a BLE Mesh application based on it.
The reference implementation is tested against the latest profile tuning suite (PTS) tool from the Bluetooth Special Interest Group (SIG) and is under certification for BLE Mesh v1.0 specification.
Users are expected to have some basic understanding about the BLE Mesh protocol (http://blog.bluetooth.com/introducing-bluetooth-mesh-networking).
4 Features and Highlights
Supports Bluetooth BLE Mesh v1.0 specification [1]
Provisioning over generic attribute profile (GATT) and advertising (ADV) bearer Support for all Mesh SIG defined models except sensor and time model Support for Vendor Specific Mesh models Support for Relay, Proxy, Friend, and Low Power Node features
Qualified Bluetooth subsystem (QDID)
Tested as part of UnPlugFest UPF53, (Jan 2016), UPF54 (June 2016), UPF55 (Oct 2016),
UPF56 (Jan 2017), UPF57 (June 2016), UPF58 (Oct 2017), UPF59 (Jan 2018), UPF60 (May
2018), UPF61 and UPF62
Single-chip solution with hardware (HW) acceleration for all Mesh security operations
Bluetooth low energy (BLE) 4.2 wireless connectivity
Easy scalable software (SW ) architecture to integrate other smart home protocols in a single
design
User application memory resources:
Application size only limited by size of external Flash memory ~64 kB RAM remaining after existing reference app/BLE stack/Mesh library usage
Compatible with DA1468x Basic, Pro, and USB HW development boards
Debug features: Segger J-Link debugger/RTT/Systemview and print to console
Sample iOS and Android applications demonstrating many of the BLE Mesh features
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
5 Getting Started: Running the Demo Application
5.1 Description
The DA1468x Mesh SDK is compatible with both Pro, Basic and USB DK HW. The HW boards are described at reference documents [7], [13], and [9]. For all Mesh reference applications, the same HW can be used. The DK can be reprogrammed to run a single instance of an application. In order to switch between different applications, these HW boards can be upgraded over JTAG using the development process explained in section 6.2.1.
NOTE
The preferred DK HW to start using the Mesh SDK with is the DA14683 USB development kit. It has a much smaller form factor, is more affordable, and is easier to create and test large Mesh networks with multiple nodes.
Figure 1: DA14683 USB Development Kit
Figure 2: DA1468x PRO Development Kit, Motherboard and Daughterboard
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 3: DA1468x Basic Development Kit
5.2 Connecting Hardware and Powering On
The DK HW boards are pre-assembled and does no need extra rework. There is no need to change any jumper positions to get a functional demo application running.
The DK HW boards are shipped unprogrammed. So to flash the demo image, please first follow the instructions in sections 6.1, 6.2, and 6.2.1. The boards will then be in factory reset state and their node database will be empty (start from un-provisioned state).
The boards are powered via USB. Connect the provided USB cable to laptops, desktops, or power adapters to power the accessories.
The boards should then enter the unprovisioned Beacon advertising mode and be ready to interact with any Mesh enabled provisioner. The default provisioning bearer is GATT.
5.3 Button and LED Usage
The buttons and LEDs that are used in the reference implementation are listed in section 5.3.1 and
5.3.2. This guide assumes that the DA14683 USB DKs are used:
5.3.1 Buttons and Switches
RESET: resets the DA14683 HW.
SW1 short press: toggles Mesh model state (represents the behavior of manually switching ON
or OFF a fan, a lock, a light bulb, or others).
SW1 long press (~5 sec): reset the device to factory state (start from un-provisioned state).
SW2: it is only used in the multiple-element example to represent operation of the second
element
5.3.2 LEDs
D10: it represents Mesh model state (for example, ON: lightbulb is turned on; OFF: lightbulb is
turned off)
D8: it represents the provisioning and configuration state:
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Fast blinking: Device is unprovisioned and waits to be provisioned Slow blinking: Device is provisioned (belongs to a network) but not configured yet (no publish
or subscription address is assigned yet)
Turned off: Device is both provisioned and configured and can interact with other devices in
the network
Its intensity level represents the state of the level server model in the corresponding example Its color represents the hue saturation level (HSL) settings of the HSL server model in the
corresponding example
D9: it is only used in the multiple-element example to represent operation of the second element
5.4 Mesh SDK Demo Examples Bring up
The device can be tested against any iOS or Android smartphone applications which support the Mesh protocol.
Make sure that Dialog's Mesh application, which can be found under DA14683_MESH_vXXX\projects\host_apps\ethermind-mobile directory, is used.
Dialog's USB DK should be programmed with the default ble_mesh application found in the directory DA14683_MESH_vXXX\projects\dk_apps\demos\ble_mesh. The default application code enables provisioning over GATT and expects the devices to be provisioned over GATT.
At least two different nodes need to be programmed. Both should have a unique node ID and different roles (for example, one is a lightbulb and the other is a switch). One of them should get configured as the server of the model and the other one as the client. The available model examples in this release are:
Generic ON/OFF
Generic level
Generic ON/OFF with multiple elements
Light HSL
Vendor specific
For every node after factory reset, a random BLE address and Mesh universally unique identifier (UUID) is assigned to the node. Users do not need to try to assign UUIDS to the nodes like when using the previously released SDKs, for example, programming NVPARAM partition.
NOTE
This release contains support for all the SIG models defined in the Mesh specification v1.0. The examples can be used as a guideline to how models can be initialized and used.
The provisioner example in the release is not meant to be tested with the mobile app. This example demonstrates provisioning over the ADV bearer with the other examples in the SDK, while the mobile app demonstrates provisioning over the GATT bearer. For more information regarding the provisioner example refer to section 5.5.6.
5.4.1 Mobile Application Instructions
The section describes how the mobile app can be used to provision and configure a new device to the network. Any of the SDK examples can be used but new users are recommended to start with the Generic ON/OFF example, which provides a simple demo of how to turn ON/OFF a LED in the server (for example, a lightbulb) side by using a button from the client (for example, a switch) side.
Note 1 The mobile application can provision and configure all the examples in the SDK, but its current version
can only remotely control the generic ON/OFF example.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
1. Download Dialog's BLE Mesh Application from either Apple's App Store or Google Play Store
and start the App (Figure 4).
Figure 4: Start Dialog's BLE Mesh App
2. Select the "CREATE NEW NETWORK" Option. Type the name of the new network, optionally
select an icon for it. The rest options can be left unchanged.
3. Create a group by pressing the "Add New Group" button. In Mesh, a group usually represents
an area in which many Mesh nodes belong and should be controlled and respond together for example a kitchen, living room, bedroom. (Figure 5)
Figure 5: Create A Group in the Mesh Tab
4. Enter a name for the group and press the "CONFIRM" button (Figure 6)
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 6: Name the Group
5. Power the board programmed as a light and make sure it is un-provisioned (factory reset) by
pressing the SW1 for at least 5 sec. (Figure 7)
Figure 7: Power the Board Programmed as a Light
6. Provision a new device by selecting in the side menu the "Unprovisioned devices" tab. (Figure
8)
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 8: Provision a new device
7. Select the device to be provisioned and type the required password to complete the
authentication process. Note that this is device specific, depends on the device configuration and it can be optional. The default password that is used in the SDK is "f00l", ie the word "fool" after replacing the "o" with zero. Once the provisioning process is completed press "GO TO
OVERVIEW" (Figure 9)
Figure 9: Complete the provisioning process
8. Now the Nodes tab contains the new node that was just added. The default names for the
elements and the nodes are used. These can be changed through the settings as shown below. (Figure 10)
Node settings
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 10: Nodes screen
9. Each element name along with publish/subscribe settings can be modified as shown below. For
publish settings, one address can be assigned along with publish period, transmit interval and count. For the subscription list settings, multiple groups can be selected. (Figure 11)
Figure 11: Settings, publish and subscribe configuration screens
10. The node settings screen can be used to set a friendly name for the node (eg Bedroom
Lightbulb), set which mesh features are enabled (er proxy, beacon, friend, relay), or un-provision the node by clicking on the trashcan icon. (Figure 12)
Element settings
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 12: Select the Nodes Tab
11. The configured node is shown at the below figure. Note that if an element contains a model
server element (eg Generic ONOFF server), the application can control its state by sending a ON/OFF message directly to its unicast address (Figure 13).
Figure 13: Light Node screen
12. Another node can be added by repeating steps 5-11. The following figure displays the screens
after a switch node is added. Note that the switch is a Generic ON/OFF client, it does not contain a state therefore unlike the lightbulb case, the application does not contain a control element switch any state (Figure 14)
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 14: Configuration Tab
13. The nodes screen now should contain the two different nodes. The vendor and the first element
address of each node is also displayed (Figure 15).
Figure 15: Nodes screen containing both switch and light node
14. At this point, since both nodes are subscribed to the same group, the user can toggle the state of
light bulbs by using SW1 on the switch board (Figure 16)
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 16: Toggle Light Bulb States by SW1
15. The group screen contains all the created groups for this network. For each group, for every node
element that is subscribed, there is the corresponding control element. For example, for the Generic ON/OFF model servers there is an ON/OFF switch, for the Generic Level model servers there is a slider. In this specific example, the corresponding ONOFF switch will control all the lightbulbs which are subscribed to this group. Note that the group address is used as the destination address in the corresponding messages. (Figure 17).
Figure 17: The group screen
16. The red LED on all light bulb boards is turned on (Figure 18).
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 18: Red LED on Light Bulb Board Turned on
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
5.5 Various SDK Example Demonstrations
5.5.1 Generic ON/OFF Model Demonstration
The instructions described in section 5.4.1 should result in a complete demo set up between a server (the lightbulb) and a client (the switch). After the setup, pressing the switch SW1 should toggle the lightbulb D10 LED.
It is possible to extend the network with more nodes of the same model. For example, by following the same instructions multiple lightbulbs can be added to the same group and be toggled at the same time by a single switch. A different demo can be setup by creating two different groups in the mobile application (refer to step 2 to 6 in section 5.4.1), for example, "Office" and "Kitchen". Then two different switches can be configured to control two different groups of lights at the same network.
5.5.2 Generic Level Model Demonstration
The same instructions as in section 5.4.1 can be applied to provision and configure two client/server nodes with the generic level model enabled. Compared to the generic ON/OFF model, the only difference in this example is that the mobile application does not support the control of the level server from the smartphone (see Note 1). Users can still use the SW1 button from the client side to control the intensity of the D8 LED of the level server. Alternatively, controlling the intensity of D8 can be done by the UART console (refer to section 6.10.12).
Similar to the generic ON/OFF model, multiple groups of nodes can be created. For example, multiple clients can control multiple server nodes at the same or different groups.
5.5.3 Light HSL Model Demonstration
The same instructions as in section 5.4.1 can be applied to provision and configure two client/server nodes with the light HSL model enabled. Compared to the generic ON/OFF model, the only difference in this example is that the mobile application does not support the control of the HSL server state values from the smartphone (see Note 1). Users can still use the SW1 button from the client side to control the color of the D8 LED of the HSL server by cycling through a set of predefined colors. Alternatively, controlling the color of D8 can be done by the UART console (refer to section
6.10.12)
Similar to the generic ON/OFF model, multiple groups of nodes can be created. For example, multiple clients can control multiple server nodes at the same or different groups.
5.5.4 Generic ON/OFF Model with Multiple Elements Demonstration
The same instructions as in section 5.4.1 can be applied to provision and configure two client/server nodes with the "generic ON/OFF multiple elements" enabled. Compared to the generic ON/OFF model, the only difference in this example is that the mobile application does not support the configuration and control of the second element (see Note 1). This has to be done manually using the UART console.
At the client side, users need to enter:
publish set 1 49454
At the server side, users need to enter:
subscribe add 1 49454
Now toggling the switch SW2 from the client side should toggle the D9 LED which represents the second element from server side.
Note that another demo setup could be to add the same address in the first element of the server.
subscribe add 0 49454
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Now LED D9 responds to both SW1/SW2 toggling, but D10 only to SW2. For more information regarding these commands, refer to sections 6.10.10 and 6.10.11.
5.5.5 Vendor Specific Model Demonstration
The example "vendor specific model" defines a custom model that represents two states in the same model. The first is an ON/OFF state and the second is a level state. Compared to the generic ON/OFF model and generic level model, the vendor specific model defines two different states in a single model. Moreover, this setup is also different from defining two separate elements, one as a generic ON/OFF element and the other one as a generic level element, in the same model.
The same instructions as in section 5.4.1 can be applied to provision and configure two client/server nodes with the vendor specific model enabled. Compared to the generic ON/OFF model, the only difference in this example is that the mobile application does not support the control of the ON/OFF and level server from the smartphone (see Note 1). Users can still use the SW1 and SW2 switches from the client side to control the ON/OFF state of D9 and intensity of the D8 LED at the level server.
5.5.6 Provisioner Example Demonstration
The target of this example is to demonstrate the provisioning and configuration of a new node to the network by using a different node that has the role of a provisioner and a configuration client. In this demo smartphones are not needed at all. A provisioner node and a smartphone create two completely different networks (network/device keys), therefore the nodes that are provisioned with one network cannot communicate with the other.
Another big difference between a provisioner node and a smartphone is that a provisioner node does the provisioning over the ADV bearer while a smartphone does the provisioning over the GATT layer. All the examples in the code are configured to do provisioning over the GATT layer by default. Therefore, in order to test the provisioner example, users have to change the bearer to ADV bearer by executing:
Shell> bearer adv
NOTE
Due to a known bug in the SDK which is supposed to be fixed at the next release, only one node at a time can be provisioned and configured successfully. Before adding a new node to the network, users need to reset both the provisioner and the new node to factory reset state. After a new node is added, it can communicate with the other nodes.
5.5.7 Proxy Example Demonstration
The proxy feature in a node enables it to connect with a smartphone over GATT and enables smartphone Apps capable of being connected to Mesh to communicate and control Mesh nodes in the network.
The proxy functionality can be enabled in two ways:
through the mobile application during provisioning and configuring a node. Refer to step 13 of
section 5.4.1
by manually enabling the feature at the UART console of a node. Refer to section 6.10.3
After enabling the proxy feature, follow the steps Error! Reference source not found. to 14 described in section 5.4.1.
NOTE
The mobile applications with the version up to V0.0.3 only support the control over the ON/OFF example.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
5.5.8 Relay Example Demonstration
The relay feature in a node enables it to scan for packets in the network and repeat them to neighbor nodes. In this way the range within which a BLE Mesh node can transmit packets to another node is extended based on the number of hops allowed (Time-To-Live, TTL, value).
There are three different ways to enable the relay feature in a node:
through the mobile application during provisioning and configuring a node. Refer to step 13 of
section 5.4.1
by manually enabling this feature at the UART console of a node. Refer to section 6.10.3
by setting the TTL value, which has direct impact on the BLE Mesh packet propagation. Refer to
section 6.10.7
Once this feature is enabled, there is no further action needed from the application side. The node transparently repeats the packets in the network according to the rules defined at the Mesh specification.
One useful UART command to test this feature is the lowrange command (refer to section 6.10.8). This command lowers the radio frequency range of a node down to ~2 meters until the next node reset. So, to make the demonstration and testing of the relay feature easier, place the nodes ~2 meters apart.
There are two ways to test this feature:
By powering ON/OFF with a middle node acting as a relay
In this way three nodes are placed in a row spaced ~2 meters apart (node A, B, C). Only node B has the relay feature enabled. Node A and B are generic ON/OFF switches and Node C is a generic ON/OFF lightbulb. All nodes have publish and subscription addresses in the group. Node A should be able to toggle Node C only if Node B is powered on, otherwise the messages from Node A will never reach Node C.
By modifying the TTL value of the smartphone application messages
In this way three nodes are placed in a row spaced ~2 meters apart (node A, B, C). Only node B has the relay feature enabled. Only Node A has the proxy feature enabled. Node A and B are generic ON/OFF switches and Node C is a generic ON/OFF lightbulb. All nodes have publish and subscription addresses in the same group. The smartphone application can connect to Node A and is able by default to control Node C because the used default TTL value is 0x7F. It is possible to define a smaller TTL value at the Mesh tab of the mobile application. By using a TTL value of 1 makes the relay Node B drop the packet, thus preventing the message from reaching Node C.
5.5.9 Friend and Low Power Node Example Demonstration
The friend feature allows a node, called Friend Node, to temporarily cache messages that are destined to another node called Low Power Node (LPN). This feature allows the LPN to turn off its radio and get into sleep. Once it wakes up, it polls the Friend Node for the messages cached during its sleep.
This test scenario can be reproduced with the following steps:
1. Start with three DKs that are factory reset.
2. Flash two of them with generic ON/OFF server binary files and the other one with the ON/OFF
client.
3. Provision and configure the DKs over the smartphone so all of them belong to the same group.
For simplicity, do not enable the relay and proxy feature in the nodes.
4. Now toggling the switch should toggle the two lightbulbs.
5. Let's call one lightbulb "Friend Lightbulb" and the other lightbulb "LPN Lightbulb".
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6. At the console of the Friend Lightbulb, type "feature friend enable".
7. At the console of the LPN Lightbulb, type "feature friend enable" and "feature lpn enable".
8. Confirm step 4 is still working. As long as the features are enabled but not yet activated, this step
is expected to work.
9. At the console of the switch type "publishaddr 32". Note that 32 is the decimal unicast address
of the LPN Lightbulb. It may be different in other examples. To find out the correct address type "dumpkeys" in the mesh console of the LPN Lightbulb.
10. At this point toggling the switch should only toggle the LPN-Lightbulb. This is expected since the
publish address of the switch is not the group address any more but the unicast address of the LPN Lightbulb.
11. In LPN-Lightbulb console type "friend setup". This command establishes friendship with the
Friend Lightbulb.
12. Press the switch button ONCE. At this point the LPN-Lightbulb will not receive the command. The
Friend-Lightbulb has cached the packet.
13. At the console of LPN-Lightbulb, type "friend poll". Now the LPN Lightbulb will poll its friend
and receive and process the command.
14. Repeat steps 12 and 13 as many times as needed.
15. If the lightbulbs are reset, the friendship will be lost. Go back to step 11. Repeating the steps 12
and 13 will re-enable the demo.
5.5.10 SW Upgrade Over The Air (SUOTA) Support
There are two ways in a Mesh network to do a SUOTA update.
The first one is over the ADV bearer by using the Mesh protocol and infrastructure. This mode is
still under definition and development by SIG and will be included in full detail at the next specification release.
The second option is through the GATT bearer per device using Dialog's SUOTA GATT service
and Android/iOS mobile application. This method does not use any of the Mesh functionality but is able to upgrade any node in the network over the air by directly connecting with a smartphone and using Dialog's SUOTA mobile application. This process is the same as any other applications in the DA1468x SDK. At the device side it is required to enable the dg_configSUOTA_SUPPORT in custom_config_qspi.h and use the ble_suota_loader project along with the suota_initial_flash_jtag script to program both the bootloader and the application image into the flash.
For more details refer to [11].
5.5.11 Microbus Devices Example Demonstration
The DA14683 USB kit supports MikroBUS™ modules. These modules allow an easy way to interface with real sensors and actuators and provide a reference implementation that is closer to what a real product looks like.
The two microbus modules that are used with the generic level example are the Slider Click Board and the 7 segment display module. The level client model uses the slider to set a value, while the level server model displays this value to reflect its state. This SW functionality is enabled in the code by defining the DEVICE_DISPLAY_7SEG and DEVICE_SLIDER defines in custom_config_qspi.h.
For more details regarding the HW support and the PCB mounting, refer to [13].
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 19: Microbus 7-Segment Display and Slider Modules
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6 Development Environment Setup
This section describes how to set up the development environment of the DA1568x Mesh DK.
6.1 Installing the Environment
1. Unzip the BLE Mesh release zip file (for example, DA14683_MESH_v_0.8) into a known location on
your drive.
NOTE
Choose a path name without spaces in it.
Choose a path name that does not exceed 128 characters (due to a known issue in the ARM GCC linker).
2. All software development is based on SmartSnippets™ Studio. Please refer to [8] for its user
manual. Follow the setup instructions and get familiar with the environment.
3. In the development kit path text field, enter the location of the release unzipped at step 1. The
development kit for Mesh is "DA1468x Development Kit Pro".
4. Select "IDE" from tools. The regular Eclipse environment view should now appear.
6.2 Importing and Building the BLE Mesh Project
1. To import the required projects, follow the steps below:
a. In SmartSnippets™ Studio, select File > Import. b. Select General > Existing Projects into Workspace > Next > Select root directory. c. Browse to the location of the release. d. Deselect all projects. e. From the project list select only the ble_mesh and the scripts projects. f. Click Finish.
2. Select a configuration and build the ble_mesh project (Figure 20).
3. A successful build for the ble_mesh project will give a result shown in Figure 21.
Figure 20: Build Configurations of ble_mesh Project in SmartSnippets™ Studio
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 21: Build Log of ble_mesh Project in SmartSnippets™ Studio
6.2.1 Build project for DA14681
By default, the bl_mesh project is configured to build for the DA14683 chip. To enable support for DA14681, follow the steps below:
a. In SmartSnippets™ Studio, select "ble_mesh" project > C/C++ Build > Build Variables. b. Set IC_REV = A c. Set IC_STEP = E d. Select "ble_mesh" project > C/C++ Build > Settings > Tool Settings > Cross ARM C Linker >
Libraries > Library search path.
e. Update ble_stack paths to the following:
"${workspace_loc:/ble_stack/DA14681-01-Release}" "../../../../../black_orca_sdk/sdk/interfaces/ble_stack//DA14681-01-Release" "../../../../../sdk/interfaces/ble_stack//DA14681-01-Release"
f. Select "ble_mesh" project > C/C++ General > Paths and Symbols > Libraries. g. Update ble_stack_library to: "ble_stack_da14681_01". h. Select "ble_mesh" project > C/C++ General > Paths and Symbols > References. i. Update ble_stack build to "DA14681-01-Release"
6.3 Flashing New Software into the SDK
1. To write the image generated after the bl_mesh project is imported and built into the Flash
memory (Figure 22), in SmartSnippets™ Studio run the external script program_qspi_jtag_win.
2. If asked for product ID option, select the default one, "DA14683", in the command prompt.
3. If scripts are not shown, select "Organize Favorites" > "Add" > "Select All".
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 22: Writing the generated Image into the flash
NOTE
Make sure to first click on the ble_mesh project before triggering the programming script described in section
6.2, because it will flash the last build configuration that has been compiled successfully based on the
selected project.
4. Successful programming of the DA1468x DK should look like Figure 23.
Figure 23: Writing the generated Image into the flash: Log Output
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.4 Modify the Bluetooth Address and Mesh Device UUID
Starting from the release of Mesh SDK v0.10, the Bluetooth address and Mesh UUID address are randomly assigned after every factory reset. Users need to take no corresponding actions (for example, program the NVPARAM section). For more details, refer to the functions in the code appl_get_random_bd_address and appl_prov_device_set_uuid.
6.5 Specify the Role of a Device
Starting from the release of Mesh SDK v0.12, the role of a device, for example, being a light bulb or a switch, is defined directly by the corresponding build configuration (Figure 20). Users need to take no corresponding actions (for example, program the NVPARAM section).
6.6 Debugging the Application
In order to invoke the debugger, start the QSPI debug configuration (Figure 24). The ATTACH debug configuration is used only to attach a debugger to an application that is already running. If no scripts are shown, select "Organize Favorites" > "Add" > "Select All".
Figure 24: Debug Configurations
Now the Eclipse debug perspective should appear (Figure 25).
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 25: Eclipse Debug Perspective
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.7 Obtaining Logging Information
6.7.1 UART Logging Window
Use your favorite UART terminal client (such as Putty, RealTerm, Minicom, or others) to connect to the first COM port assigned to the development board with the following settings:
Baudrate: 115200 Bits: 8 Parity: None Stop Bits: 1
Figure 26: UART Logging Window
NOTE
When using the DA1468x basic development board, make sure to choose the option "Virtual Com Port" by the following steps:
1. Open the J-Link configurator.
2. Right click on the connected J-Link device.
3. Select Configure.
4. Choose the option "Virtual COM-Port".
6.8 Developing on Linux Host OS
Please refer to [8] and [10] for how to install and use the development environment in Linux.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.9 Developing on MacOS
The SmartSnippets™ Studio integrated development environment (IDE) starting from version v1.5 supports MacOS.
Use the corresponding Mac scripts to program or erase the flash, for example, program_qspi_jtag_mac or program_qspi_nvparam_mac.
NOTE
SmartSnippets™ Toolbox does not support MacOS
If the tool fails to detect and trigger the J-Link executables, users can manually enable the GDB server
from a MacOS terminal by setting: JLinkGDBServer –if swd –device Cortex-M0 –select
To select a specific J-Link device when many DKs are connected, set JLinkGDBServer –if swd –device
Cortex-M0 –select usb=480043835
6.10 Understanding Serial Terminal Options
The default ble_mesh project application implements a serial terminal that makes the controlling of the accessory easier. It contains useful commands for factory resetting the accessory, viewing memory statistics, enabling/disabling mesh features, and others. It can be also easily extended to include other useful functionality defined by users.
By default, an empty screen should pop up. By pressing the Enter key, the shell will pop up.
Type “help” to see the available commands.
help
> help - Display help
> reset <factory> - Device reset
> loglevel <none/error/trace/info/all> - Set runtime log level to: none/error/trace/info/all
> heapstat <reset> - Print current heap usage or reset MinimumEverFreeBytesRemaining
> stackstat - Print FreeRTOS stack usage or reset MinimumEverFreeBytesRemaining
> dumpkeys - Dump security keys - useful for BLE sniffer configuration
> bearer <adv/gatt> - Set provisioning bearer: PB-ADV/PB-GATT (Get Prov-Bearer if no param)
> feature <relay/proxy/friend/lpn> <enable/disable>- Enable/disable a Mesh feature <relay/proxy/friend/lpn>
> friend <setup/poll> - Establish friendship or poll for messages
> scan - Scan for unprovisioned devices
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
> provision <dev_item> - Start provision for selected device (dev_item=0 if no param)
> configure <uaddr value in decimal> - Start configuration for (last/selected) device (last provisioned device if no param)
> subscribe <add/remove/get> <element> <address value in decimal>- Add/remove/get subscription (applies only to server models)
> publish <set/get> <element> <address value in decimal>- Set or read publish address (applies only to client models)
> onoff <element> <0/1> - Set the Generic OnOff state of an element
> level <level> - Set Level of the element (range 0-9)
> hsl <hue saturation lightness> - Set HSL of the element
> ttl <ttl value in decimal> - Set the TTL value
> lowrange - Changes BLE RF parameters to reduce radio range to ~2 meters. Useful when running repeater tests.
Shell>
6.10.1 Reset the Accessory
Type "reset" to reboot the accessory device. This is equivalent to just pressing the reset button (RESET) on the motherboard. You should now see all boot-up messages:
reset Shell> Initializing Mesh SDK Done.
Enable Prov Serv returned with 0x0000
Enable Proxy Serv returned with 0x0000
BLE Address: 80:EA:CA:80:45:01 Mesh UUID: 45:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF
Start Observing...
--- Configure as CLIENT (eg Switch) --­In Model Server - Foundation Models
Config Model Server Registration Status: 0x0000
In Model Server - Foundation Mdels
Config Model Server Registration Status: 0x0000
Health Server Initialized. Model Handle: 0x0001
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
In Generic OnOff Model Client
Generic Onoff Client Initialized. Model Handle: 0x0002
Device Provisioned! Our UNICAST address is: 0x36 Publish Address: C001
PROXY: DISABLED RELAY: DISABLED FRIEND: DISABLED LPN: DISABLED SEC_BCN: DISABLED
6.10.2 Reset to Factory Default State
Device settings can be factory reset by typing "reset factory". All the internal secure storage is cleared, including the previously established mesh network keys, and the device is rebooted. The device gets a new Bluetooth address and Mesh UUID. The device gets into provisioning mode.
reset factory Clearing Storage Shell>
6.10.3 Enabling or Disabling Mesh Features (Proxy/Relay/Friendship)
Users can enable/disable certain Mesh features from the command line interface, including:
Proxy
Relay
Friendship
Low Power Node
Example:
feature proxy enable
feature relay disable
The device needs to be rebooted before the changes take effect.
NOTE
The node needs to be provisioned for this command to take effect.
6.10.4 Security Keys Dump Function
All internal BLE Mesh security keys can be printed out by typing dumpkeys”. This information can be entered in BLE sniffer tools to decrypt and decode Mesh packet activity over the air.
Shell> dumpkeys Primary Unicast Address: 0x0036 Device Key[0x00]: 96 54 C0 CB 71 39 0C 36 66 1E 6B 32 FC F4 D9 5B Net Key[0x00]: 9E A9 79 C3 15 F6 F6 D2 3D 5E 55 80 9F 52 9F E8 App Key[0x00]: D2 D3 8D F5 80 E9 40 0E FB 1D 0D 61 A1 CA AB F2 Shell>
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.10.5 Monitor FreeRTOS Heap Usage and Task Stack Usage
FreeRTOS heap usage and task stack usage can be monitored by typing "heapstat" and "stackstat", respectively. The value of xMinimumEverFreeBytes represents the peak memory load.
heapstat Shell> xFreeBytesRemaining: 23976 xMinimumEverFreeBytesRemaining: 22360
stackstat Shell> TaskName: app_ xMinEverFreeBytesRemaining: 3048 TotalSize: 3768 TaskName: IDLE xMinEverFreeBytesRemaining: 184 TotalSize: 280 TaskName: Tmr xMinEverFreeBytesRemaining: 152 TotalSize: 264 TaskName: hsec xMinEverFreeBytesRemaining: 5156 TotalSize: 5944 TaskName: bleA xMinEverFreeBytesRemaining: 516 TotalSize: 856 TaskName: bleM xMinEverFreeBytesRemaining: 428 TotalSize: 592
6.10.6 Change Log Level
The log level UART output can be changed in runtime in order to provide more useful information for debugging. Valid options are: none, error, trace, info, and all.
Shell> loglevel all
6.10.7 Change Default TTL Value Used when Sending Messages
The TTL value defines what the maximum number of hops for each message is when it is transmitted through the network. The default TTL value that is used when sending messages from a node can be locally changed using the “ttl” command. Valid values are in the range of from one to 127. The default value used in the code is 127 (0x7F).
Shell> ttl 8
Setting TTL – 8
6.10.8 Change Maximum BLE RF Range to around Two Meters
For testing reasons, especially when testing the relay function in a large network, it useful to temporarily reduce the maximum distance in which a node can send messages in order to enforce the relay nodes of the network to retransmit the packets to their neighbors.
Normally in a typical network, it is required to place the nodes at least 10 to 20 meters apart to get the edge nodes out of range. It is more practical to configure the nodes to receive messages within only two meters, so relay function can be easily tested in a typical room. Reducing the maximum BLE RF can be done by using the "lowrange" command.
Shell> lowrange
BLE radio range reduced to ~2 meters
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.10.9 Commands Related to Friendship and Low Power Node
A friendship can be established between two Mesh nodes when a low power node wants to get into sleep mode, turn off its radio, and have another node in the network, called friend node, to cache messages for it. There are two commands that the LPN needs to send in order to control this operation. The first is the "friend setup" that is used to establish the friendship and the other one is the "friend poll" that is used by the LPN after waking up to poll messages from the friend node. Note that these are commands that need to be sent by the LPN. The friend node needs to just enable its friendship feature and the operation is transparently handled by the Mesh library.
Refer to section 6.10.3 regarding how to enable this feature. For more information refer to section
5.5.9.
6.10.10 Modify the Subscription Address List of a Server Model
Any node in the network that has a server mode role enabled can be configured to listen to certain group or unicast addresses. This is done by the mobile application during the configuration stage (refer to step Error! Reference source not found. in section 5.4.1). However, it is possible to view and change this subscription list locally at the UART console. This is done by using the “subscribe
command with either “add” “remove” “get” operation and the element number that this command is
referring. For all examples in the SDK the total number of elements is 1 (and has the “0” address”) while for the multiple elements example there are two elements (addressed as “0” and “1”).
For example, in order to get the current subscription address list of the Generic ON/OFF example, type:
lsmodels
Element: 0 Model(SIG) ID: 0x1000 (Generic OnOff server)
subscribe get 0 0x1000 Subscription Address List Read Successfully Entries: 1 Entry[0]: 0xC001
In order to add a new subscription address type:
Shell> subscribe add 0 0x1000 0xC002 Subscription Address is set Successfully. Model_handle: 0x0002 addr: 0xC002
The new subscription address list is now:
Shell> subscribe get 0 0x1000 Subscription Address List Read Successfully Entries: 2 Entry[0]: 0xC001 Entry[2]: 0xC002 Shell>
As an example, an existing address can be removed as:
Shell> subscribe remove 0 0x1000 0xC001 Subscription Address is remove Successfully - 0xC001 Shell>
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.10.11 Modify the Publish Address of a Client Model
Any node in the network that has a client mode role enabled can be configured to publish to a certain group or unicast addresses. This is done by the mobile application during the configuration stage (refer to step Error! Reference source not found. in section 5.4.1). However, it is possible to view and change this subscription list locally at the UART console by using the "publish" command with either "set" or "get" operation and the element number that this command refers to. For all examples in the SDK the total number of elements is 1 (and has the "0" address”), while for the multiple elements example there are two elements (addressed as "0" and "1").
Reading the publish address:
lsmodels
Element: 0 Model(SIG) ID: 0x1000 (Generic OnOff server)
Shell> publish get 0 Publish Address is read Successfully. Publish Address: 0x0000
Modifying the publish address:
Shell> publish set 0 49153 Publish Address is set Successfully. handle: 2 addr: 0xC001 Shell>
6.10.12 Change Client Model State using the UART Console
In all client model examples of the SDK (for example, ON/OFF, Level, and HSL), users need a way to trigger a value change from the client side. For example, for the ON/OFF client the SW1 button is pressed to trigger the toggling of the corresponding state. For the other examples there is not an intuitive way to change the client model state by using the DK HW. Therefore, certain UART commands are added for all client model examples. In a real product, the same code should be called at the corresponding call-back HW sensor routines.
The UART commands are "onoff", "level", and "hsl" for each example. For the level client, the following command sets the level value to three at the server side and the intensity of the D8 LED is adjusted accordingly.
Shell> level 3 Client level set: 3 [NET Tx] Pkt. SRC:0x002B, DST:0xC001, IVI:0x00, SEQ:0x00000802, CTL:0x00, TTL:0x7F, Len: 13, is_relay:0x00 Shell>
For HSL client the following sample values can be used:
RED: hsl 0 65535 32767
GREEN: hsl 21845 65535 32767
BLUE: hsl 43690 65535 32767
OFF: hsl 0 0 0
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6.10.13 Change Provisioning Bearer
Users have the option to select the provisioning bearer PB-ADV or PB-GATT with UART commands:
Shell> bearer adv
or
Shell> bearer gatt
The device is automatically rebooted for the change to take effect. The current state of the provisioning bearer can be checked by using the command "Shell> bearer".
NOTE
This command is not available for the Provisioner example.
6.10.14 Scan for Unprovisioned Devices
Users have the option to scan for unprovisioned devices by set scan command. The current list of unprovisioned devices will be printed in serial terminal:
Type: "scan" to scan for unprovision devices
Type: "provision" to provision previously scanned device
Type: "configure" to configure previously provisioned device
Shell> scan
Setting SCAN for unprovisioned devices: retval - 0x0000
Shell> scanned devices: device, nr: 0 UUID : [DB5D850D32E6060708090A0B0C0D0E0F]
Scanning can also be started by pressing SW1 button on the DA14683 USB DK.
NOTE
This command is only available for the provisioner example.
6.10.15 Start Provision for Selected Device
Users can trigger the provisioning process with the following command:
Shell> provision <dev_item>
If no parameter is given, the first scanned device will be provisioned. The provisioning process can be also started by pressing SW1 button on the DA14683 USB DK. In
this case, the first scanned device will be automatically provisioned.
NOTE
This command is only available for the provisioner example.
6.10.16 Start Configuration for Selected Node
Users can start the configuration of a selected node with the command:
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Shell> configure <uaddr value in decimal>
If no parameter is given, the last provisioned device will be configured. Node configuration can be also started by pressing SW1 button on the DA14683 USB DK. In this
case, the last provisioned node will be configured.
NOTE
This command is only available for the provisioner example.
6.11 Using the SEGGER SystemView
SEGGER SystemView is a real-time recording and visualization tool to help users gain a deep understanding of the run-time behavior of an application. It provides cycle-accurate profiling, continuous real-time recording, and FreeRTOS tracing.
To enable SystemView support, compile the code with the dg_configSYSTEMVIEW define as follows:
1. In file custom_config_qspi.h (located under folder /ble_mesh/config/ in the workspace)
change the define to #define dg_configSYSTEMVIEW (1)
2. Recompile the project and upgrade the Flash memory with the new image
3. Reset the board (press button K2)
4. Install both SystemView package V2.30 and Software and documentation pack for Windows
V5.10i (which includes the J-Link driver) from https://www.segger.com/jlink-software.html a. Modify your environment accordingly to use the latest J-Link version b. Make sure that Windows -> Preferences -> Run/Debug -> SEGGER J-Link points to the
latest version (Figure 27)
Figure 27: Verifying the Correct J-Link Version
5. Invoke the debugger by starting the Release_QSPI debug configuration. Do NOT press the RUN
button (‘play’ icon) yet. The CPU is halted
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
6. Open SEGGER SystemView and press "Start Recording"
7. Define the following capture settings (Figure 28) and then press OK:
Connection to J-Link: USB Target Device: CORTEX-M0 Target Interface & Speed: SWD @ 8000 kHz RTT Control Block Detection: enter the address of _SEGGER_RTT (from the binary MAP
file)
Figure 28: SEGGER SystemView Capture Settings
8. Go back to Eclipse and unhalt the CPU by pressing the RUN button (‘play’ icon). SystemView
now captures all events from the very beginning.
NOTE
The RTT Client window does not display any logging information. All logging information now appears in the SystemView terminal window and the log is correlated with the trace timeline.
9. Press "Stop Recording" in SystemView. All events to be captured are now triggered and ready
for inspection.
NOTE
All interrupt service routines should be displayed with their names like CRYPTO_IRQ, BLE_IRQ, or I2C_IRQ. If
some are shown as IRQ#, it is because SystemView does not have a buffer large enough to show all IRQ names. To find out which IRQ corresponds to a certain interrupt, refer to the
SEGGER_SYSVIEW_SendSysDesc function calls found in file dk\middleware\RTT\Config\SEGGER_SYSVIEW_Config_FreeRTOS.c. For example, IRQ#33 corresponds to WKUP_GPIO_Handler.
Depending on the interrupt service routine activity, the RTT buffer may overflow. Monitor the
dropped/overflow counter in SystemView window for any missed events. The overflow of RTT buffer is quite rare and is usually observed during I2C or SPI activity.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 29: SEGGER SystemView Trace Capture
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
7 Software Architecture
7.1 BLE Mesh Specification
The first version of the Bluetooth Mesh specification was released on 17th July 2017 and is described in references [1], [2], and [3].
A brief overview of the Mesh architecture can be found in references [4] and [6]. Before diving into the actual SW implementation, users are expected to have a good understanding
of the main features and architecture principles in the Bluetooth Mesh Specification.
7.2 DA14683 Mesh SW Architecture
This section describes the software architecture of the DA1468x Mesh SDK application. Users are expected to be familiar with the [14], which describes the overall SW architecture for the DA1468x family. The DA1468x Mesh SDK application is built on top of this architecture. It is also recommended to first go through references [10] and [11].
7.2.1 Overview
The DA1468x Mesh SDK application runs on top of FreeRTOS and it includes seven tasks:
System Init task: Performs basic system initialization at start-up and terminates itself
Idle task: Runs when no other task runs. Places the ARM CPU in low power consumption mode
Timer task: FreeRTOS internal task used to keep track of FreeRTOS SW timer activity
BLE Adapter task: Defined from the SDK to keep track of lower layer BLE events and talk
directly to BLE hardware
BLE Manager task: Defined from the SDK to present a user-friendly BLE API to the user
application
BLE Mesh core task: Handles all Mesh related BLE activity (processing related to
Advertise/Scanning/Proxy/and others)
Mesh Application task: Implements actual application functionality (initialization, model
instances, GPIO/LED handling, and so on)
The FreeRTOS switches between these tasks, depending on the priorities and ongoing activity. In a typical Mesh application, the BLE Adapter task is active most of the time, handling advertising events and BLE connections, passing data, and triggering the BLE manager to pass data to the Mesh application task when needed. The Mesh Application task either handles certain events by itself or passes the data to the BLE Mesh Core task for further processing. All tasks pass data to each other through the FreeRTOS message queues.
The trace in Figure 30 indicates that the BLE Adapter task has the highest priority and the scheduler switches to this task for every BLE advertising event or to keep an active BLE connection alive.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Figure 30: SystemView Trace - Task Switching
7.2.2 Mesh DK SW Architecture
The overall Mesh DK SW architecture is represented in Figure 31. A typical Mesh application is divided into two parts:
The Mesh SDK layer, which consists of the following:
Standard DA1468x SDK functionality based on its last GA release (v1.0.10) BLE Adapter and Manager tasks BLE Mesh core task Mesh Platform Abstraction Layer
The Application User layer, which contains:
All user specific code Mesh core call-back implementation functions External HW handling (GPIOs and LEDs) Any HW sensor interfaces Etc.
Figure 31: Mesh DK SW Architecture
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
7.2.2.1 Folder and File Structure
The folder and file structure of a typical Mesh application is shown in Figure 32. The main function is located in main_sample_device.c and is responsible for system initialization, including FreeRTOS and the underlying DA14683 SDK chip configuration. This function eventually creates a new FreeRTOS thread with the actual user application function (user_application_main_task). This function is located inside the user_*_example.c files under the user_application folder.
Figure 32: SW Stack and File Location
7.2.2.2 The user_<onoff/level/hsl>_<server/client>_example Files
These files contain the implementation of the actual mesh application. Each example initializes the Mesh library core implementation (appl_mesh_init) and creates the instances of the corresponding models (create_node, register_element, and register_models)
The provision_and_configuration and is_device_configured functions detect whether the device is not provisioned or configured and call the corresponding core API to enable provisioning.
This file also contains the implementation of the application callback functions needed for every model (level_set_cb and level_get_cb) and the implementation of the user specific notification processing function process_notifications. In this example the button toggling functionality (BUTTON1_PROCESS_NOTIFY) and factory reset functionality (BUTTON_FACTORY_RESET_NOTIFY) is demonstrated.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
7.2.2.3 The appl_proxy.c File
It contains the functionality related to the mesh proxy feature. Note that proxy functionality is a mesh core internal implementation, so normally users should not need to modify anything from this file except calling the appl_proxy_start_adv function to enable this feature.
7.2.2.4 The appl_provision.c file
This file handles all the application-related functionality regarding the provisioning process. The function appl_prov_start triggers the provisioning process and the function prov_callback processes all the provisioning related events from the mesh core.
The most important parameters defined here are:
UI_PROV_OUTPUT_OOB_ACTIONS/UI_PROV_INPUT_OOB_ACTIONS: the supported provisioner
authentication method
UI_DISPLAY_AUTH_NUMERIC: the authentication numeric value (if enabled)
prov_capab: the actual structure that defines the provisioning capabilities of the device
lprov_device: the Mesh UUID and URI information contained in the unprovisioned Mesh
beacon.
prov_data: the network key and unicast addresses that are used when the device acts as a
provisioner.
7.2.2.5 The appl_conf.c file
This file contains the implementation of the application related functions to configure client model instances.
The register_config_model_client function creates the instance
The config_client_cb function processes the events.
The function client_appkey_add creates application keys
The function client_model_app_bind binds the application keys with the given model instances.
The function set_publish_address and set_subscription_address sets the publish and the
subscription address of the device under configuration.
7.2.2.6 The demo_hw.c file
This file contains all the HW specific handling functions. All the LED, button, GPIO, and Microbus module function implementations are located in this file.
7.2.2.7 The appl_storage.c file
This file contains a framework for users to store application specific data in flash. Both the mesh library and the user application share a common partition in flash (NVMS_GENERIC_PART). Users can define new locations inside this partition to store data by adding new entries inside the
appl_storage_keys.h file. As the first step, the corresponding variable is defined in appl_storage_keys.h:
enum storage { STORAGE_MS_PS_RECORD_BD_ADDR = APPL_STORAGE_CAT(APPL_STORAGE_USER_DATA_CAT), STORAGE_MS_PS_RECORD_AVAILABLE_UNICAST_ADDR, };
Then this variable is accessed using the corresponding APIs:
appl_storage_get_item(STORAGE_MS_PS_RECORD_BD_ADDR, &val, &len)
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
appl_storage_put_item(STORAGE_MS_PS_RECORD_BD_ADDR, addr->addr, 6, true);
7.2.2.8 The mesh_console.c file
This file contains a user-friendly implementation to create UART console triggered commands. The console_commands array can be extended with a new command in the following format:
The command name
The minimum number of arguments
The maximum number of arguments
The actual C function
The text to be displayed when the menu is shown
The list of possible arguments
For example, the command to enable/disable various mesh features is defined as:
{"feature", 0, 2, cmd_enable_feature, "Enable/disable a Mesh feature <relay/proxy/friend/lpn>", "<relay/proxy/friend/lpn> <enable/disable>"}
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Revision History
Revision
Date
Description
1.2
1-April-2019
Update section 5.4.1 to reflect latest Mobile App changes Update section 6.10 to reflect latest UART console command
changes
1.1
12-Nov-2018
Update section 6.2 to handle build instructions for DA14861 Update section 6.10 to add new terminal commands included in the
latest examples
1.0
17-Sep-2018
Initial version.
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
Status Definitions
Status
Definition
DRAFT
The content of this document is under review and subject to formal approval, which may result in modifications or additions.
APPROVED or unmarked
The content of this document has been approved for publication.
Disclaimer
Information in this document is believed to be accurate and reliable. However, Dialog Semiconductor does not give any representations or warranties, expressed or implied, as to the accuracy or completeness of such information. Dialog Semiconductor furthermore takes no responsibility whatsoever for the content in this document if provided by any information source outside of Dialog Semiconductor.
Dialog Semiconductor reserves the right to change without notice the information published in this document, including without limitation the specification and the design of the related semiconductor products, software and applications.
Applications, software, and semiconductor products described in this document are for illustrative purposes only. Dialog Semiconductor makes no representation or warranty that such applications, software and semiconductor products will be suitable for the specified use without further testing or modification. Unless otherwise agreed in writing, such testing or modification is the sole responsibility of the customer and Dialog Semiconductor excludes all liability in this respect.
Customer notes that nothing in this document may be construed as a license for customer to use the Dialog Semiconductor products, software and applications referred to in this document. Such license must be separately sought by customer with Dialog Semiconductor.
All use of Dialog Semiconductor products, software and applications referred to in this document are subject to Dialog Semiconductor’s Standard
Terms and Conditions of Sale, available on the company website (www.dialog-semiconductor.com) unless otherwise stated.
Dialog and the Dialog logo are trademarks of Dialog Semiconductor plc or its subsidiaries. All other product or service names are the property of their respective owners.
© 2019 Dialog Semiconductor. All rights reserved.
Contacting Dialog Semiconductor
United Kingdom (Headquarters)
Dialog Semiconductor (UK) LTD
Phone: +44 1793 757700
Germany
Dialog Semiconductor GmbH
Phone: +49 7021 805-0
The Netherlands
Dialog Semiconductor B.V.
Phone: +31 73 640 8822
North America
Dialog Semiconductor Inc.
Phone: +1 408 845 8500
Japan
Dialog Semiconductor K. K.
Phone: +81 3 5769 5100
Taiwan
Dialog Semiconductor Taiwan
Phone: +886 281 786 222
Hong Kong
Dialog Semiconductor Hong Kong
Phone: +852 2607 4271
Korea
Dialog Semiconductor Korea
Phone: +82 2 3469 8200
China (Shenzhen)
Dialog Semiconductor China
Phone: +86 755 2981 3669
China (Shanghai)
Dialog Semiconductor China
Phone: +86 21 5424 9058
Email:
Web site:
UM-B-098
DA1468x Mesh SDK
Company Confidential
User Manual
1-April-2019
CFR0012
© 2019 Dialog Semiconductor
enquiry@diasemi.com
www.dialog-semiconductor.com
Loading...