Skip to content

Nanostack configuration options added #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions docs/tutorials/using_apis/mesh/quick_start_build.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
### Build time configuration of the stack
### Build time configuration of the Nanostack

To minimize the size of the produced stack, Nanostack defines a set of build options.
The build time configuration of Nanostack uses the Mbed configuration system. The application needs to create an `mbed_app.json` configuration file if you want to use settings other than default settings. You can also minimize the size of the produced stack by using different build options.

#### Build options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The below table shows binary size in Mbed OS 5.5. Because we're going into 5.8, should we update the table, or is it OK as is?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just mention something like ->
The binary sizes in the table are just for showing the difference between different builds.


This table demonstrate the difference in binary size between builds:

Option Name | Features supported | Binary size in Mbed OS 5.5
------------| -------------------|------------------------------------
`ethernet_host` | Only Ethernet host support, no mesh networking. | 108 kB
Expand Down Expand Up @@ -33,7 +35,7 @@ Select the device role:
- Mesh network. A router. (default)
- Star network. A non-routing device. Also known as a host, or sleepy host.

Modify your `mbed_app.json` file to tell which Nanostack configuration to choose and which configrations to use on [Mbed Mesh API](/docs/v5.6/reference/mesh.html).
Modify your `mbed_app.json` file to direct which Nanostack configuration to choose. The [Mbed Mesh API](https://github.com/ARMmbed/mbed-os/blob/master/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json) lists all configurations (6LoWPAN and Thread).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't like to link to GitHub. Ideally, the code for the mesh API would be fixed and merged, and we'd link to the generated Doxygen for it.


An example of the `mbed_app.json` file:

Expand Down Expand Up @@ -74,3 +76,48 @@ Then you may optionally choose to select the non-routing mode for those networks
|Mesh router (default) | `thread_router` | `MESH_DEVICE_TYPE_THREAD_ROUTER` |
|Non-routing device | `thread_end_device` | `MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE` |

##### Configuration parameters for 6LoWPAN-ND and Thread
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a PR to move configuration content to the configuration section: #366

Could you please update that PR with this content in the format of the other sections?

Copy link
Author

@kseverinkangas-zg kseverinkangas-zg Feb 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be ok, need to have a link pointing to the configuration page. Though I like the current table format, for me it is more readable.


All 6LoWPAN and Thread configuration options are described below.
Make sure that all your devices use the same network configuration (both nodes and border router)

```

**Configurable parameters in the `mbed-mesh-api` section**

| Parameter name | Value | Description |
| --------------- | ------------- | ----------- |
| `heap-size` | number [0-0xfffe] | Nanostack's internal heap size |

**Thread related configuration parameters**

| Parameter name | Value | Description |
| --------------- | ------------- | ----------- |
| `thread-pskd` | string [6-255 chars] | Human-scaled commissioning credentials. |
| `thread-use-static-link-config` | boolean | True: Use the below link config, False: Use commissioning, ignore the below link config. |
| `thread-device-type` | enum from `mesh_device_type_t` | Supported device operating modes:<br> `MESH_DEVICE_TYPE_THREAD_ROUTER`<br> `MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE`<br> `MESH_DEVICE_TYPE_THREAD_MINIMAL_END_DEVICE` |
| `thread-config-channel-mask` | number [0-0x07fff800] | Channel mask, 0x07fff800 is used for Thread networks (2.4GHz). |
| `thread-config-channel-page` | number [0]| Channel page, 0 for 2,4 GHz radio. |
| `thread-config-channel` | number [11-26] | RF channel to use. |
| `thread-config-panid` | number [0-0xFFFF] | Network identifier. |
| `thread-config-network-name` | string [1-16] |
| `thread-config-commissioning-dataset-timestamp` | [0-0xFFFFFFFFFFFFFFFF] | [48 bit timestamp seconds]-[15 bit timestamp ticks]-[U bit] |
| `thread-config-extended-panid` | byte array [8] | Extended PAN ID. |
| `thread-master-key` | byte array [16]| Network master key. |
| `thread-config-ml-prefix` | byte array [8] | Mesh local prefix. |
| `thread-config-pskc` | byte array [16] | Pre-Shared Key for the Commissioner. |
| `thread-security-policy` | number [0-0xFF] | Commissioning security policy bits. |

**6LoWPAN related configuration parameters**

| Parameter name | Type | Description |
| --------------- | ---------| ----------- |
| `6lowpan-nd-channel-mask` | number [0-0x07fff800] | Channel mask, bit-mask of channels to use. |
| `6lowpan-nd-channel-page` | number [0, 2] | 0 for 2,4 GHz and 2 for sub-GHz radios. |
| `6lowpan-nd-channel` | number [0-26] | RF channel to use when `channel_mask` is not defined. |
| `6lowpan-nd-panid-filter` | number [0-0xffff] | Beacon PAN ID filter, 0xffff means no filtering. |
| `6lowpan-nd-security-mode` | "NONE" or "PSK" | To use either no security, or Pre shared network key. |
| `6lowpan-nd-psk-key-id` | number | PSK key ID when PSK is enabled. |
| `6lowpan-nd-psk-key` | byte array [16] | Pre-Shared network key. |
| `6lowpan-nd-sec-level` | number [1-7] | Network security level. Use default `5`. |
| `6lowpan-nd-device-type` | "NET_6LOWPAN_ROUTER" or "NET_6LOWPAN_HOST" | Device mode. Router is routing packets from other device, creating a mesh network. |
4 changes: 4 additions & 0 deletions docs/tutorials/using_apis/mesh/thread_commissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ To get the MAC address for your end device, connect the node to the Thread netwo

For example, in the **mesh-minimal** application, place this `printf("MAC address = %s\n", mesh.get_mac_address());` after `printf("connected. IP = %s\n", mesh.get_ip_address());`

It is also possible to use the Mesh API (ThreadInterface.h) to set values for these parameters.

There are four additional (optional) query parameters you can put into this field:

- `vn` Vendor name.
Expand All @@ -55,6 +57,8 @@ Once you have completed the details, proceed to generate the QR code for your en

#### Using the Thread commissioning application

When building a Thread example application, do not change any of the PSKc related parameters (network name, extended PAN ID or PSKc). PSKc has been precalculated for the application. The nanostack has no capability to generate PSKc on runtime.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no one has it is not limitation of nanostack but universe. only the one who knows the actual password can calculate those values

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe better to remove this sentence -> The nanostack has no capability to generate PSKc on runtime. Should it be also here mentioned that we have used the "Thread Network" as a passwd?

Copy link

@mikter mikter Feb 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that is the most important information for the user. "

"Thread Network" is the network password that is required by commissioning application"

Something like that


You can use the [Thread Android application](https://play.google.com/store/apps/details?id=org.threadgroup.commissioner) for commissioning. Download and install this on your Android device, turn on Wi-Fi and start the app. Then follow these steps after ensuring all the requirements listed above are satisfied:

1. Set up a connection to the Wi-Fi access point to which the Thread border router is connected. When connected, the application lists your Thread border router(s).
Expand Down
5 changes: 4 additions & 1 deletion docs/tutorials/using_apis/mesh/thread_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Nanostack provides a set of C API headers with more functionalities. The [nanost
- `thread_diagcop_lib.h` for building and parsing the Thread diagnostics protocol TLV messages.
- `thread_meshcop_lib.h` for building and parsing the Thread mesh commissioning protocol TLV messages.
- `thread_net_config_api.h` for making neighbour discovery (ND) data requests.
- `net_polling_api.h` for configuring the Thread node's sleep mode and polling interval.

#### Thread devices you can build on Mbed OS

Expand All @@ -55,7 +56,7 @@ The Mbed OS Mesh API allows you to define 3 types of devices:

In addition the Nanostack API allows you to define the Full end device (FED) device type.

In most cases, the REED, MED and SED configurations are enough to build a network. In a SED device, the radio is switched off during the sleep times. To take the full advantage of the SED configuration, the application developer must implement the sleep procedures in the device.
In most cases, the REED, MED and SED configurations are enough to build a network. You can configure the SED device to use sleep mode, in which case the radio is switched off between the polling times. To take the full advantage of the SED configuration, the application developer must implement the sleep procedures in the device.

For an end device or a router example, see [mesh minimal example](https://github.com/ARMmbed/mbed-os-example-mesh-minimal).

Expand Down Expand Up @@ -122,6 +123,8 @@ The Thread network name and the extended PAN ID are received in the scanning pha

After the authentication phase, the commissioner requests the Thread network leader to petition the commissioner to become an authorized commissioner. Here, the border router works as an arbitrator in the middle.

The Thread specification describes the PSKc generation.

Now, the Thread network is ready to accept new joiner devices.

1. The commissioner application scans the QR code, which is PSKd (Pre-Shared Key for device) + EUI64, from the device's label and informs the Thread network that this device is accepted to the network.
Expand Down