Skip to content

Commit 4e35bcd

Browse files
committed
Merge pull request #92 in SA/ble_examples from feature/ble-tree-structure to simplelink_cc26x2_sdk-2.30
Squashed commit of the following: commit e19926f79accefae6880bd85d523ccaccbda83ce Author: Marie Hernes <[email protected]> Date: Mon May 20 10:34:04 2019 +0200 updated readme with link to app note. commit e0684eb0465342917d7692e6a3b33990df14320f Author: Marie Hernes <[email protected]> Date: Mon May 20 09:52:39 2019 +0200 Add link to IAR files. commit 0afc8011d82cfce3ed48d5e5c717ff987b1c71d2 Author: Marie Hernes <[email protected]> Date: Mon May 20 09:50:40 2019 +0200 Update overview page. commit 97e77295630627d1a0f53db7df2aa805b7c3b3ac Author: Marie Hernes <[email protected]> Date: Thu May 16 12:20:27 2019 +0200 Added some more changes. commit b49ad3d18d217c2a03214edaaac673856ff865fb Author: Marie Hernes <[email protected]> Date: Fri May 10 11:51:22 2019 +0200 Some changes.. commit 4eac74a313aca3f53ed5034f87867dc628911410 Author: Marie Hernes <[email protected]> Date: Wed Mar 27 15:32:29 2019 +0100 Small code changes. commit 1a8a94a8748c36e0f89ff7b588c2798dfd0f215f Author: Marie Hernes <[email protected]> Date: Wed Mar 27 13:51:49 2019 +0100 Change param update message. commit 68a45b98a03bf2068d03a135e1743b553e5a7687 Author: Marie Hernes <[email protected]> Date: Wed Mar 27 13:44:11 2019 +0100 Re-do rows. commit 7da72438667a1a91e2824e8201c6c650f453e2e1 Author: Marie Hernes <[email protected]> Date: Wed Mar 27 13:08:44 2019 +0100 Update tables. commit 78d6813b1fff34bc0ebb81cf4fbf55148347f192 Author: Marie Hernes <[email protected]> Date: Wed Mar 27 12:58:41 2019 +0100 Updates to readme. commit 5015a752a356a9b447843700e36a93160067ccb7 Author: Marie Hernes <[email protected]> Date: Tue Mar 26 14:00:45 2019 +0100 Re-do periodic clock. commit 7daed53d5dba19d2ff97430a7e161beed6da4694 Author: Marie Hernes <[email protected]> Date: Fri Mar 15 14:58:30 2019 +0100 Use ANSI for all configurations. commit 1a9cbb2fa9d76af99b8ac71938ef8d6875bd7f9b Author: Marie Hernes <[email protected]> Date: Fri Mar 15 14:46:00 2019 +0100 Small comment and naming changes. commit 8af641b58917d159c50040b7f63c962c72644368 Author: Marie Hernes <[email protected]> Date: Mon Mar 4 13:11:28 2019 +0100 Small changes. commit 6b4a2b746285c6e3ddf718fce6d58625948cc41e Author: Marie Hernes <[email protected]> Date: Thu Feb 28 13:29:36 2019 +0100 Project builds with no errors in CCS and IAR. commit 6d7af8c167bd26ad9e6c32f695959c8acedd1d31 Author: Marie Hernes <[email protected]> Date: Wed Feb 27 13:21:51 2019 +0100 Project builds for ccs. commit 74bc1d2472cd33bad662b22b2f5babd8c2a5b905 Author: Marie Hernes <[email protected]> Date: Tue Feb 26 13:43:52 2019 +0100 Initial commit.
1 parent 9a29b07 commit 4e35bcd

35 files changed

+13327
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ For examples for other SDK versions and platforms, see table below.
4343
<li><a href="#full-duplex-bidirectional-audio-demo">Full Duplex Bidirectional Audio Demo (Central/Peripheral)</li>
4444
<li><a href="#i2s-echo">I2S Echo</li>
4545
<li><a href="#bluetooth-5-throughput-demo">Bluetooth 5 Throughput Demo</li>
46+
<li><a href="#tree-structure-network">Tree Structure Network</li>
4647
</ul>
4748
</td>
4849
</tr>
@@ -275,6 +276,19 @@ with the Simplelink Starter app.
275276
* [CCS Project Files](examples/rtos/CC26X2R1_LAUNCHXL/ble5apps/throughput_central/tirtos/ccs)
276277
* [Source](examples/rtos/CC26X2R1_LAUNCHXL/ble5apps/throughput_central/src)
277278

279+
### Tree Structure Network
280+
281+
Set up a tree structure network using tiers of star network. This network format
282+
can be used to set up a network with up to 47 devices. The same example is used
283+
for the founding node (grandpa node), the middle nodes (father nodes) and the
284+
children nodes.
285+
286+
* tree_structure_network
287+
* [Documentation](examples/rtos/CC26X2R1_LAUNCHXL/ble5apps/tree_structure_network/readme.md)
288+
* [CCS Project Files](examples/rtos/CC26X2R1_LAUNCHXL/ble5apps/tree_structure_network/tirtos/ccs)
289+
* [IAR Project Files](examples/rtos/CC26X2R1_LAUNCHXL/ble5apps/tree_structure_network/tirtos/iar)
290+
* [Source](examples/rtos/CC26X2R1_LAUNCHXL/ble5apps/tree_structure_network/src)
291+
278292
## References
279293

280294
The following reference pages may be helpful during general Bluetooth Low
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
Introduction
2+
============
3+
4+
The tree_structure_network project demonstrates the capabilities of the Texas
5+
Instruments BLE stack to function in Bluetooth® Low energy Tree Structure
6+
network. Technical aspects of this example are described in the accompanied app
7+
note. Please see: [Bluetooth® Low Energy Tree Structure Network](www.ti.com/lit/swra648)
8+
9+
This example project is capable of functioning as a grandfather
10+
node, a father node and a child node in any combination, while
11+
maintaining several connections (up to the amount of connections defined by
12+
MAX_NUM_BLE_CONNS). The project is capable of connecting to any role in tree
13+
structure network. The role will be defined according to the connection sequence
14+
(e.g. the first nod to connect as a master will become the grandpa node). The
15+
project supports multiple simultaneous GATT discoveries. This project has the
16+
following app build configurations available:
17+
18+
| Build Configuration | Description |
19+
|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
20+
| FlashROM_Release (default) | All TI-RTOS debug features disabled but application-logging to UART remains enabled. The application uses the config file ble_release.cfg and the defines are in <app name>\_FlashROM\_Release.opt. |
21+
| FlashROM_Debug | All TI-RTOS debug features enabled. The application uses the config file ble_debug.cfg and the defines are in <app name>\_FlashROM\_Debug.opt. |
22+
23+
All application configurations use the stack library configuration,
24+
FlashROM_Library. This build configuration will yield additional flash footprint
25+
optimizations by the linker since the application and stack can share contiguous
26+
flash pages. This configuration is further discussed in the Stack Library
27+
Configuration section of the BLE5-Stack User’s Guide provided in the SDK.
28+
29+
Hardware Prerequisites
30+
======================
31+
32+
The default Tree Structure Network board configuration uses the CC26x2R1
33+
LaunchPad development kit. This hardware configuration is shown in the below
34+
image:
35+
36+
![Hardware Configuration](resources/hardware_config.png)
37+
38+
For custom hardware, see the Running the SDK on Custom Boards section of the
39+
BLE5-Stack User’s Guide.
40+
41+
Software Prerequisites
42+
======================
43+
44+
For information on what versions of Code Composer Studio and IAR Embedded
45+
Workbench to use, see the Release Notes file provided in the SDK. For
46+
information on how to import this project into your IDE workspace and build/run
47+
it, please refer to the device’s Platform section in the BLE5-Stack User’s Guide.
48+
49+
Assumptions/Considerations
50+
==========================
51+
52+
Once the connection limit (set with the MAX_NUM_BLE_CONNS preprocessor define)
53+
is reached, the grandfather device and father device won’t be allowed to scan
54+
until there is a disconnection.
55+
56+
By default, the tree_structure_network application is configured to filter and
57+
connect to peripheral devices with the TI Tree Structure Service UUID.
58+
59+
If the project is configured for a large number of connections (via the
60+
MAX_NUM_BLE_CONNS preprocessor define) and also security (pairing/bonding), it
61+
is possible for heap allocation failures to occur which will break the stack.
62+
Therefore, the project should be stress-tested for its intended use case to verify
63+
that there are no heap issues by including the HEAPMGR_METRICS preprocessor
64+
define. See the Debugging section of the BLE5-Stack User’s Guide for more
65+
information on how to do this.
66+
67+
When at least one connection is already formed, in order to allow enough
68+
processing time to scan for a new connection, the minimum possible connection
69+
interval (in milliseconds) that can be used is:
70+
71+
12.5 + 5\*n
72+
73+
where n is the amount of current connections. For example, if there are currently
74+
four connections, all four connections must use a minimum connection interval of
75+
12\*5 + 5\*4 = 32.5 ms in order to allow scanning to occur to establish a new
76+
connection.
77+
78+
Usage
79+
=====
80+
81+
The tree_structure_network project uses the two buttons on the LaunchPad to
82+
accept user input and outputs information through the UART. The UART is only
83+
used for display messages. This document will use a terminal program (Tera Term,
84+
PuTTY, etc.) to serve as the display for the output of the LaunchPad. Note that
85+
any other serial terminal can be used. The following default parameters are used
86+
for the UART peripheral for display:
87+
88+
| UART Param | Default Values |
89+
|--------------|----------------|
90+
| Baud Rate | 115200 |
91+
| Data length | 8 bits |
92+
| Parity | None |
93+
| Stop bits | 1 bit |
94+
| Flow Control | None |
95+
96+
Upon powering on or resetting the device, the user will see the default board
97+
message. (RP address refers to resolvable private address.)
98+
99+
![Power Up](resources/power-up.png)
100+
101+
In certain cases, the user may want to switch from a "menu view" to a "log view"
102+
(i.e. each new message is printed on the next line). In order to achieve this,
103+
open the compiler predefined symbols list (`.opt` file) and set the following
104+
define to zero:
105+
106+
`-DBOARD_DISPLAY_USE_UART_ANSI=0`
107+
108+
Establish the First Connection
109+
==============================
110+
111+
Program all devices that will be a part of the the network with the tree network
112+
structure example project.
113+
114+
Click the right button on the intended grandpa node. The device will discover
115+
other devices. If other devices are discovered, it will connect this device, then
116+
enable the connected device’s notification function, and send the command to turn
117+
on the green LED automatically. (In the image, the grandfather device display is
118+
shown on the left and the father1 device display on the right.)
119+
120+
![Connection Established](resources/connection.png)
121+
122+
Establish the Tree Structure Network
123+
====================================
124+
125+
Now the grandfather board is connected to the the father1 board. Then turn on
126+
the power of father2, click the right button on grandfather board to connect the
127+
father2 board. Then follow the same way to use father1 board to connect the
128+
child1 board, and father2 board to connect the child2 board.
129+
130+
![Network Topology](resources/topology.png)
131+
132+
GAP Role Information
133+
====================
134+
135+
For grandpa node, it is always central role. For children nodes, they are always
136+
peripheral role. For father node, when it is connected by grandpa node, it will
137+
be central role first. And after it connects to children node, it will be
138+
peripheral node. So father node GAP role changes when the connection and is thus
139+
defined as multi-role.
140+
141+
![GAPRoles Topology](resources/gaproles.png)
142+
143+
Grandfather Node Writing
144+
========================
145+
146+
After establishing the tree structure network, the option to write and notify
147+
will now become available. In this option, pressing the left button on the
148+
grandfather board once will enable grandfather node to write data to all father
149+
nodes and children nodes defined in chalVals array. (If the data is intended to
150+
a child node, the father node will forward it automatically.) Note that when the
151+
message is received in each father and child node, their red led will be set or
152+
reset in order according to the message. When this happens the green led will
153+
automatically turn off.
154+
155+
![Message propagation](resources/order1.png)
156+
157+
![Message propagation](resources/order2.png)
158+
159+
![Message propagation](resources/order3.png)
160+
161+
Grandfather node’s operation in tree type network is defined in the charVals
162+
table. See details below.
163+
164+
```
165+
//Char value table length
166+
#define string_index_max 8
167+
168+
//Send char value table
169+
uint8_t charVals[string_index_max][TREENETWORKSERVICE_CHAR1_LEN] = {
170+
{'0', '1', '0', '0', '\0'}, //Father 1 led off
171+
{'0', '1', '1', '0', '\0'}, //Father 1's child 1 led off
172+
{'0', '2', '0', '0', '\0'}, //Father 2 led off
173+
{'0', '2', '1', '0', '\0'}, //Father 2's child 1 led off
174+
{'0', '1', '0', '1', '\0'}, //Father 1 led on
175+
{'0', '1', '1', '1', '\0'}, //Father 1's child 1 led on
176+
{'0', '2', '0', '1', '\0'}, //Father 2 led on
177+
{'0', '2', '1', '1', '\0'} //Father 2's child 1 led on
178+
// Reserved
179+
// Father index
180+
// Father branch elements (child index)
181+
// Led ON/OFF
182+
}; // Should be consistent with those in GattWrite
183+
```
184+
185+
Child Node Notification
186+
=======================
187+
188+
After the network has been established, pressing the left button on a father
189+
board or a child board once will enable the node to send a message that this
190+
happened to the grandpa node (by GATT notification). The following shows the
191+
successful message on the grandpa node of the key pressing message.
192+
193+
![Child node identification](resources/child_node.png)
194+
195+
Data Transmission Flow and Data Format
196+
=============================================================
197+
198+
![Transmission flow](resources/flow.png)
199+
200+
Data packets are sent as GATT write or GATT notification packets. The data format
201+
is given below:
202+
203+
| Array index | 0 | 1 | 2 | 3 |
204+
|-------------|:--------:|:-------------------:|:---------------------:|:----------:|
205+
| Meaning | Reserved | Father branch index | Children branch index | Led status |
19.3 KB
Loading
37.8 KB
Loading
17.5 KB
Loading
10.3 KB
Loading
2.8 MB
Loading
18.8 KB
Loading
19.5 KB
Loading
15.7 KB
Loading

0 commit comments

Comments
 (0)