|
1 |
| -<h2 id="mesh-api">Mesh</h2> |
| 1 | +<h2 id="mesh-api">6LoWPAN Mesh</h2> |
2 | 2 |
|
3 | 3 | <span class="images"><span>MeshInterface class hierarchy</span></span>
|
4 | 4 |
|
5 |
| -The Arm Mbed mesh API allows the application to use the IPv6 mesh network topologies through the [nanostack](/docs/development/reference/technology.html#nanostack) networking stack. |
| 5 | +#### 6LoWPAN Mesh Interfaces |
| 6 | + |
| 7 | +The Arm Mbed Mesh API allows the application to use the IPv6 mesh network topologies through the [Nanostack](/docs/v5.7/tutorials/mesh.html#nanostack) networking stack. |
| 8 | + |
| 9 | +Mbed OS provides two types of IPv6 based mesh networks: |
| 10 | + |
| 11 | +- 6LoWPAN_ND, loosely following the Zigbee-IP specification. |
| 12 | +- Thread, following the specification from Thread Group. |
| 13 | + |
| 14 | +Nanostack is the networking stack that provides both of these protocols. For more information on the stack internals, please refer to the [Nanostack documentation](/docs/v5.7/tutorials/mesh.html#nanostack). Application developers use Nanostack through the Mbed Mesh API. |
| 15 | + |
| 16 | +The application can use the `LoWPANNDInterface` or `ThreadInterface` object for connecting to the mesh network. When successfully connected, the application can use the Mbed C++ socket APIs to create a socket to start communication with a remote peer. |
| 17 | + |
| 18 | +##### Supported mesh networking modes |
| 19 | + |
| 20 | +Currently, 6LoWPAN-ND (neighbor discovery) and Thread bootstrap modes are supported. |
| 21 | + |
| 22 | +##### Module configuration |
| 23 | + |
| 24 | +This module supports static configuration via the **Mbed configuration system**. The application needs to create an `mbed_app.json` configuration file if you want to use other than default settings. |
| 25 | + |
| 26 | +An example of the configuration file: |
| 27 | + |
| 28 | +``` |
| 29 | +{ |
| 30 | + "target_overrides": { |
| 31 | + "*": { |
| 32 | + "target.features_add": ["IPV6"], |
| 33 | + "mbed-mesh-api.6lowpan-nd-channel": 12, |
| 34 | + "mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<12)", |
| 35 | + "mbed-mesh-api.heap-size": 10000 |
| 36 | + } |
| 37 | + } |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +**Configurable parameters in the `mbed-mesh-api` section** |
| 42 | + |
| 43 | +| Parameter name | Value | Description | |
| 44 | +| --------------- | ------------- | ----------- | |
| 45 | +| `heap-size` | number [0-0xfffe] | Nanostack's internal heap size | |
| 46 | + |
| 47 | +**Thread related configuration parameters** |
| 48 | + |
| 49 | +| Parameter name | Value | Description | |
| 50 | +| --------------- | ------------- | ----------- | |
| 51 | +| `thread-pskd` | string [6-255 chars] | Human-scaled commissioning credentials. | |
| 52 | +| `thread-use-static-link-config` | boolean | True: Use the below link config, False: Use commissioning, ignore the below link config. | |
| 53 | +| `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` | |
| 54 | +| `thread-config-channel-mask` | number [0-0x07fff800] | Channel mask, 0x07fff800 scans all channels. | |
| 55 | +| `thread-config-channel-page` | number [0]| Channel page, 0 for 2,4 GHz radio. | |
| 56 | +| `thread-config-channel` | number [11-26] | RF channel to use. | |
| 57 | +| `thread-config-panid` | number [0-0xFFFF] | Network identifier. | |
| 58 | +| `thread-config-network-name` | string [1-16] | |
| 59 | +| `thread-config-commissioning-dataset-timestamp` | [0-0xFFFFFFFFFFFFFFFF] | [48 bit timestamp seconds]-[15 bit timestamp ticks]-[U bit] | |
| 60 | +| `thread-config-extended-panid` | byte array [8] | Extended PAN ID. | |
| 61 | +| `thread-master-key` | byte array [16]| Network master key. | |
| 62 | +| `thread-config-ml-prefix` | byte array [8] | Mesh local prefix. | |
| 63 | +| `thread-config-pskc` | byte array [16] | Pre-Shared Key for the Commissioner. | |
| 64 | +| `thread-security-policy` | number [0-0xFF] | Commissioning security policy bits. | |
| 65 | + |
| 66 | +**6LoWPAN related configuration parameters** |
| 67 | + |
| 68 | +| Parameter name | Type | Description | |
| 69 | +| --------------- | ---------| ----------- | |
| 70 | +| `6lowpan-nd-channel-mask` | number [0-0x07fff800] | Channel mask, bit-mask of channels to use. | |
| 71 | +| `6lowpan-nd-channel-page` | number [0, 2] | 0 for 2,4 GHz and 2 for sub-GHz radios. | |
| 72 | +| `6lowpan-nd-channel` | number [0-26] | RF channel to use when `channel_mask` is not defined. | |
| 73 | +| `6lowpan-nd-panid-filter` | number [0-0xffff] | Beacon PAN ID filter, 0xffff means no filtering. | |
| 74 | +| `6lowpan-nd-security-mode` | "NONE" or "PSK" | To use either no security, or Pre shared network key. | |
| 75 | +| `6lowpan-nd-psk-key-id` | number | PSK key ID when PSK is enabled. | |
| 76 | +| `6lowpan-nd-psk-key` | byte array [16] | Pre-Shared network key. | |
| 77 | +| `6lowpan-nd-sec-level` | number [1-7] | Network security level. Use default `5`. | |
| 78 | +| `6lowpan-nd-device-type` | "NET_6LOWPAN_ROUTER" or "NET_6LOWPAN_HOST" | Device mode. Router is routing packets from other device, creating a mesh network. | |
| 79 | + |
| 80 | +**Network connection states** |
| 81 | + |
| 82 | +After the initialization, the network state is `MESH_DISCONNECTED`. After a successful connection, the state changes to `MESH_CONNECTED` and when disconnected from the network the state is changed back to `MESH_DISCONNECTED`. |
| 83 | + |
| 84 | +In case of connection errors, the state is changed to some of the connection error states. In an error state, there is no need to make a `disconnect` request and the application is allowed to attempt connecting again. |
| 85 | + |
| 86 | +##### Getting started |
| 87 | + |
| 88 | +See the example application [mbed-os-example-mesh-minimal](https://github.com/ARMmbed/mbed-os-example-mesh-minimal) for usage. |
6 | 89 |
|
7 |
| -**Tips:** |
8 |
| -- The mesh API supports 6LoWPAN-ND (neighbor discovery) and Thread bootstrap modes. |
9 |
| -- The applications do not use this module directly. The applications use `LoWPANNDInterface`, `ThreadInterface` or `NanostackEthernetInterface` directly. |
10 |
| -- When using an Ethernet interface, there are no configuration options available. It is using the dynamic mode to learn the IPv6 prefix from the network. |
11 | 90 |
|
12 | 91 | ### Mesh class reference
|
13 | 92 |
|
|
0 commit comments