BLE mesh sample application User Manual - YUDEN · 2020. 6. 23. · 18-Jun.2020 Ver.1.0 TAIYOYUDEN...
Transcript of BLE mesh sample application User Manual - YUDEN · 2020. 6. 23. · 18-Jun.2020 Ver.1.0 TAIYOYUDEN...
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
1
TAIYO YUDEN CO., LTD
BLE mesh sample application
BLE mesh sample application
User Manual
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
2
TAIYO YUDEN CO., LTD
BLE mesh sample application
Contents
1. Introduction ......................................................................................... 3
2. Requirement ........................................................................................ 4
2.1. List of preparations .......................................................................... 4
2.2. Install “nrfjprog” ............................................................................. 4
2.3. Install “nRF Mesh” mobile application ................................................. 4
2.4. Writing the sample application ........................................................... 5
3. Sourcecode .......................................................................................... 7
3.1. Build Method .................................................................................. 7
3.2. source code changes ........................................................................ 9
3.2.1. Common Files ........................................................................... 9
3.2.2. Client ..................................................................................... 10
3.2.3. Server .................................................................................... 10
4. Setting up BLE mesh Network (Android) ................................................. 12
5. Stting of BLE mesh Network (iOS) ......................................................... 33
6. Evaluation board operation ................................................................... 47
Change History
Version Date Description
1.00 2020/06/18 First edition
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
3
TAIYO YUDEN CO., LTD
BLE mesh sample application
1. Introduction
This document describes how to use a sample application of BLE mesh using
the Evaluation Board of EBSHSNZWZ. This sample application is an application
that operates the Status of a specific GPIO PIN on the server side by GPIO
operation from the evaluation board on the client side.
The following is a summary diagram of the sample application.
Figure 1 sample application_ summary diagram
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
4
TAIYO YUDEN CO., LTD
BLE mesh sample application
2. Requirement
2.1. List of preparations
・EBSHSNZWZ Evaluation Board 3 unit
・J-Link Lite (J-Link Lite is included in the EBSHSNZWZ Evaluation Kit)
・PC (Windows 10)
・nrfjprog
・nRF Mesh mobile application (Android/iOS)
・ble_mesh_client_nrf52832_sample_application.hex
・ble_mesh_server_nrf52832_sample_application.hex
・s132_nrf52_7.0.1_softdevice.hex
[For debug]
・nRF5 SDK(ver16.0.0)
・nRF5 SDK for Mesh(ver4.0.0)
・set of modified source files
2.2. Install “nrfjprog”
Download "nrfjprog" from the following URL and install it on your PC.
https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-
Command-Line-Tools/Download
2.3. Install “nRF Mesh” mobile application
Install the "nRF Mesh" mobile application from the following URL
https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-
Mesh/GetStarted
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
5
TAIYO YUDEN CO., LTD
BLE mesh sample application
2.4. Writing the sample application
Connect the Evaluation Board and J-Link Lite, and run the command prompt in
the "windows key"-->"windows security tools" folder. Use the "cd" command to
move to the folder where the sample application is stored. Run the following
commands to write each hex file (softdevice, sample application).
■client sample application
・writing softdevice
“nrfjprog -f nrf52 --program s132_nrf52_7.0.1_softdevice.hex --chiperase –verify”
・writing sample application
“nrfjprog -f nrf52 --program ble_mesh_client_nrf52832_sample_application.hex -r”
※The application on the client side should be written to one of the evaluation boards
only.
※Please refer to the "Device Firmware UpdateSample application manual" on the
following URL for detailed information on how to connect the Evaluation Board and
J-Link Lite.
https://www-yuden.co.jp/jp/product/category/module/lineup/eyshsnzwz/
Figure 2: Example of sample application(client) writing
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
6
TAIYO YUDEN CO., LTD
BLE mesh sample application
■server sample application
・writing softdevice
“nrfjprog -f nrf52 --program s132_nrf52_7.0.1_softdevice.hex --chiperase –verify”
・writing sample application
“nrfjprog -f nrf52 --program ble_mesh_server_nrf52832_sample_application.hex -
r”
Figure 3: Example of sample application(server) writing
※The application on the server side can be written to multiple evaluation boards
(e.g., if you have 3 boards, you can write to 2 boards)
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
7
TAIYO YUDEN CO., LTD
BLE mesh sample application
3. Sourcecode
This sample application is made by using "light_switch" of nRF5 SDK for
Mesh(ver4.0.0) and nRF5 SDK(ver16.0.0). In this chapter, we describe the SDK
change source code.
You can download each SDK from the following link.
・nRF5 SDK
https://www.nordicsemi.com/Software-and-tools/Software/nRF5-
SDK/Download
・nRF5 SDK for Mesh
https://www.nordicsemi.com/Software-and-tools/Software/nRF5-SDK-for-
Mesh/Download
3.1. Build Method
This document describes how to build using SES (Segger Embedded Studio).
(Please refer to "SES NRF52 Quickstart Guide 1.01 JP.pdf" of NRF of Segger
Embedded Studio for the installation and setup procedure of SES(Segger
Embedded Studio).
You can download it from the following site.
https://www.yuden.co.jp/wireless_module/login
① Extract the downloaded compressed files of nRF5 SDK and nRF5 SDK
for Mesh to a folder of your choice.
② Open<SDK_ROOT>/example/light_switch/client/
light_switch_client_nrf52832_xxAA_s132_7_0_1.emProject,
<SDK_ROOT>/example/light_switch/client/
light_switch_server_nrf52832_xxAA_s132_7_0_1.emProject of nRF5
SDK for Mesh and launch SES.
③ Open the "Tools" tab "Options".
④ Open the "Building" tab.
⑤ Specify the contents of "Global Macros" to "SDK_ROOT=< folder path
created by unzipping the nRF5 SDK>" and click OK to save the settings.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
8
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 4: Set up Global Macros
⑥ "Build" tab --> "Build
light_switch_client(server)_nrf52832_xxAA_s132_7_0_1" is clicked,
and build is started.
※This work should be done in both client and server emProject files.
※If you want to build with Cmake, please refer to the following URL.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
9
TAIYO YUDEN CO., LTD
BLE mesh sample application
3.2. source code changes
The changes in the source code are described.
3.2.1. Common Files
■pca10040.h (../<nRF5 SDK_root>/components/boards)
・Changed GPIO input layout.
■simple_hal.c (../<nRF5 SDK for Mesh_root>/examples/common/src)
・Added nrf_gpiote.h
・Changed processing to enable GPIO input
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
10
TAIYO YUDEN CO., LTD
BLE mesh sample application
3.2.2. Client
■ sdk_config.h(../<nRF5 SDK for
Mesh_root>/examples/light_switch/client/include)
・The clock setting is changed to use the Evaluation Board of EBSHSNZWZ.
3.2.3. Server
■ sdk_config.h(../<nRF5 SDK for
Mesh_root>/examples/light_switch/client/include)
・The clock setting is changed to use the Evaluation Board of EBSHSNZWZ.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
11
TAIYO YUDEN CO., LTD
BLE mesh sample application
■main.c(../<nRF5 SDK for Mesh_root>/examples/light_switch/server/src)
・Change the Pin placement settings to change the state of GPIO.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
12
TAIYO YUDEN CO., LTD
BLE mesh sample application
4. Setting up BLE mesh Network (Android)
This chapter describes how to configure (provisioning) the BLE mesh Network
using "nRF Mesh" for Android.
① Make sure that the Evaluation Board you wrote in chapter 2 is powered on,
and run the "nRF Mesh" for Android. Press "ADD NODE" at the bottom right of
the screen after startup.
Figure 5 Android nRF mesh 1
② After pressing the button, the screen moves to the screen shown below. First
of all, configure the Client side. After moving, press the "nRF5x Mesh Switch".
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
13
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 6 Android nRF mesh 2
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
14
TAIYO YUDEN CO., LTD
BLE mesh sample application
③ After pressing the button, the display moves to the screen shown below. After
moving, press the "IDENTIFY" button at the bottom right of the screen.
Figure 7 Android nRF mesh 3
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
15
TAIYO YUDEN CO., LTD
BLE mesh sample application
④ After pressing the button, the display moves to the screen shown below. At
this time, if you want to change the name of the device, you can change it to
any name you want after pressing "Name". Then, press "PROVISION" at the
bottom right of the screen.
Figure 8 Android nRF mesh 4
⑤ To move to the OOB Type selection screen after pressing the button, select
"No OOB" and press OK.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
16
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 9 Android nRF mesh 5
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
17
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑥ After pressing the button, provisioning is executed, so wait until the process is
completed. When the process is completed, the following screen will be
displayed. When it is displayed, press "OK".
Figure 10 Android nRF mesh 6
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
18
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑦ Next, the setting of the server side is done. Press the "ADD NODE" button at
the bottom right of the screen in the same way as in ①. Then click on "nRF5x
Mesh Light".
Figure 11 Android nRF mesh 7
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
19
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑧ After pressing the button, the screen moves to the following screen. After
moving, press the "IDENTIFY" button at the bottom right of the screen.
Figure 12 Android nRF mesh 8
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
20
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑨ Moves to the screen as shown below. At this time, if you want to change the
name of the device, you can change it to any name you want after pressing
"Name". Then, press "PROVISION" at the bottom right of the screen.
Figure 13 Android nRF mesh 9
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
21
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑩ Select "No OOB" and click OK, as in the client side.
Figure 14 Android nRF mesh 10
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
22
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑪ Wait for the provisioning to complete after the button is pressed. Because the
following screens are displayed when processing is completed, "OK" is pushed
down when it is displayed.
If you have more than one evaluation board on the server side, complete
provisioning at all evaluation boards by following steps ⑦ to ⑪.
Figure 15 Android nRF mesh 11
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
23
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑫ When all provisioning is complete, the name of the device you just configured
will appear on the Network tab. Next, click on "nRF5x Mesh Switch" to
configure the settings for each Node.
Figure 16 Android nRF mesh 12
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
24
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑬ After pressing the button, the screen moves to the following screen. After
moving, click "Element:0x0003" and click "Generic On Off Client".
Figure 17 Android nRF mesh 13
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
25
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑭ After pressing the button, the display will move to the screen shown below.
After moving, press the BIND KEY button.
Figure 18 Android nRF mesh 14
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
26
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑮ After pressing the button, the screen appears as shown below. After moving,
select "Application Key 1".
Figure 19 Android nRF mesh 15
⑯ After pressing the button, Application Key 1 is registered as shown below.
Then, click SET PUBLICATION.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
27
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 20 Android nRF mesh 16
⑰ After pressing the button, the screen appears as shown below. After moving,
click the "Publish Address" button.
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
28
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 21 Android nRF mesh 17
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
29
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑱ After pressing this button, the screen is moved to the following screen. After
moving, set "All Nodes 0xFFFF" and click OK.
Figure 22 Android nRF mesh 18
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
30
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑲ After pressing the button, it moves to the following screen. Make sure that the
settings are reflected and click "APPLY" on the bottom right.
Figure 23 Android nRF mesh 19
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
31
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑳ Next, go back to the screen of the ⑫ and click on the "nRF5x Mesh Light" to
move to the following screen. After moving, click "Element:0x0005" and click
"Generic On Off Server".
Figure 24 Android nRF mesh 20
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
32
TAIYO YUDEN CO., LTD
BLE mesh sample application
㉑ After pressing the button, it moves to the following screen. After the move,
click on "BIND KEY" and select "Application Key 1" to register the Application Key
as in the client side.
If there are multiple evaluation boards on the server side, follow steps ⑳~to
complete the configuration of all the Nodes.
Figure 25 Android nRF mesh 21
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
33
TAIYO YUDEN CO., LTD
BLE mesh sample application
5. Stting of BLE mesh Network (iOS)
This chapter describes how to configure (provisioning) the BLE mesh Network
using "nRF Mesh" for iOS
① Make sure that the Evaluation Board you wrote in chapter 2 is powered on,
and run "nRF Mesh" for iOS. After launching, open the Network tab and press
the "+" button on the upper right.
Figure 26 iOS nRF mesh 1
② The list of device names is displayed, and then click "nRF5x Mesh Switch".
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
34
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 27 iOS nRF mesh 2
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
35
TAIYO YUDEN CO., LTD
BLE mesh sample application
③ After pressing the button, the display moves to the screen shown below. If you
want to change the name of the device after the move, press the "Name"
button to change it to the desired name. After that, press "Provision" on the
upper right. After pressing the button, the selection screen of OOB Type is
displayed. If you select "No OOB", the provisioning is completed and the name
of the device that has completed the provisioning will be displayed in the
Network tab.
Figure 28 iOS nRF mesh 3
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
36
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 29 iOS nRF mesh 4
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
37
TAIYO YUDEN CO., LTD
BLE mesh sample application
④ Complete the provisioning of "nRF5x Mesh Light" in the same way as ② to ③.
Figure 30 iOS nRF mesh 5
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
38
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑤ Open the Setting tab and click on "Application Keys. After pressing the button,
you will move to the following screen. Press the "+" in the upper right after
moving. After pressing the button, after pressing the button, it moves to the
screen shown in Figure 31. After moving, press the "Done" button in the upper
right.
Figure 31 iOS nRF mesh 6
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
39
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 32 iOS nRF mesh 7
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
40
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑥ Return to the Network tab, click the nRF5x Mesh Switch, and then click the
Application Keys button. After pressing the button, it moves to the following
screen. After moving, press "+" on the upper right to select "App Key 1", then
press "Done" on the upper right to register the Application Key.
After registration is complete, do the same for other devices.
Figure 33 iOS nRF mesh 8
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
41
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 34 iOS nRF mesh 9
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
42
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑦ Return to the Network tab, click on "nRF5x Mesh Light" and then click on
"Element 1". After clicking the button, click Generic OnOff Server and then click
Bind Application. After pressing the button, select "App Key 1" and press
"Done" on the upper right.
After completion, if there are multiple devices on the server side, do the same
setting for the number of devices.
Figure 35 iOS nRF mesh 10
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
43
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 36 iOS nRF mesh 11
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
44
TAIYO YUDEN CO., LTD
BLE mesh sample application
⑧ Go back to the Network tab, click on "nRF5x Mesh Switch", and then click on
"Element 2". After clicking the "Bind Application Key" button, click the "Generic
OnOFF Client" button. After pressing the button, select "App Key 1" and press
"Done" on the upper right. Then, click "Set Publication" and click "App Key 1"
on the following screen. After pressing the button, select "All Nodes" at the
bottom of the screen, return to the "Set Publication" screen, and press "Done"
at the top right.
⑨
Figure 37 iOS nRF mesh 12
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
45
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 38 iOS nRF mesh 13
Figure 39 iOS nRF mesh 14
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
46
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 40 iOS nRF mesh 15
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
47
TAIYO YUDEN CO., LTD
BLE mesh sample application
6. Evaluation board operation
After setting up Chapter 3 or 4, you can switch P.20 of all server-side evaluation
boards from low to high by setting P.04 of the client-side evaluation board to low.
Figure 41 The server side_P.20_low
Figure 42 Client side _GPIO operation_low
18-Jun.2020 Ver.1.0
TAIYO YUDEN CO., LTD.
48
TAIYO YUDEN CO., LTD
BLE mesh sample application
Figure 43 server_P.20_Confirmation
Figure 44 The server side_P.20_high