George Djabarov / Mbed OS mbed-os-example-mesh-minimal
Revision:
19:f55c7983f8ab
Parent:
17:ee2610e1cb78
Child:
49:425a1889434d
--- a/README.md	Wed Oct 05 05:15:26 2016 +0100
+++ b/README.md	Fri Oct 21 09:15:09 2016 +0100
@@ -15,6 +15,72 @@
 
 See the file `mbed_app.json` for an example of defining an IEEE 802.15.4 channel to use.
 
+### Selecting optimal Nanostack configuration
+
+If you want to optimize the flash usage, you need to select a proper configuration for Nanostack. The configuration depends mostly on the preferred use case.
+
+See [6LoWPAN overview](https://docs.mbed.com/docs/arm-ipv66lowpan-stack/en/latest/quick_start_intro/index.html) for the definition of star and mesh networks. These same principles apply also to Thread protocol.
+
+Select the protocol the network is based on:
+
+- 6LoWPAN-ND
+- Thread
+
+Select the device role:
+
+- Mesh network. A router. (default)
+- Star network. Non routing device. Also known as a host, or sleepy host.
+
+Modify your `mbed_app.json` file to tell which Nanostack build to choose and which configrations to use on [mbed Mesh API](https://github.com/ARMmbed/mbed-os/blob/master/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md).
+
+An example of the `mbed_app.json` file:
+
+```
+...
+        "mesh-type":{
+            "help": "options are MESH_LOWPAN, MESH_THREAD",
+            "value": "MESH_LOWPAN"
+        }
+    },
+    "target_overrides": {
+        "*": {
+            "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
+            "mbed-mesh-api.6lowpan-nd-device-type": "NET_6LOWPAN_ROUTER",
+            "mbed-mesh-api.thread-device-type": "MESH_DEVICE_TYPE_THREAD_ROUTER",
+            "mbed-mesh-api.heap-size": 32000,
+            "mbed-trace.enable": false
+        }
+    }
+```
+
+The following tables show the values you should use in the `mbed_app.json` file for your devices in different networks.
+
+- For 6LoWPAN-ND based network use `mesh-type: MESH_LOWPAN`.
+- For Thread based network use `mesh-type: MESH_THREAD`.
+
+**mesh-type: MESH_LOWPAN**
+
+|Device role|`target.features_add` value|`mbed-mesh-api.6lowpan-nd-device-type`|
+|-----------|-------------------------|------------------------------------|
+|Mesh router (default) | LOWPAN_ROUTER | NET_6LOWPAN_ROUTER |
+|Non routing device | LOWPAN_HOST | NET_6LOWPAN_HOST |
+
+**mesh-type: MESH_THREAD**
+
+|Device role|`target.features_add` value|`mbed-mesh-api.thread-device-type`|
+|-----------|-------------------------|------------------------------------|
+|Mesh router (default) | THREAD_ROUTER | MESH_DEVICE_TYPE_THREAD_ROUTER |
+|Non routing device | THREAD_END_DEVICE | MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE |
+
+**Note:** You need to recompile your application after modifying the configurations by issuing the command `mbed compile -c`.
+
+### Requirements for hardware
+
+The networking stack used in this example requires TLS functionality to be enabled on mbed TLS.
+On devices where hardware entropy is not present, TLS is disabled by default. This would result in compile time failures or linking failures.
+
+To learn why entropy is required, read the [TLS Porting guide](https://docs.mbed.com/docs/mbed-os-handbook/en/5.2/advanced/tls_porting/).
+
 ### Compile the application
 
 ```
@@ -33,9 +99,16 @@
 
 ### Update the firmware of the border router
 
-You can read the instructions on updating the firmware of your K64F working as 6LoWPAN border router [here](https://github.com/ARMmbed/mbed-os-example-client#mbed-gateway).
+This example supports the following two border routers:
 
-Please do not forget to connect the Ethernet cable between the border router and your home/office router. Then power up the board.
+- [k64f-border-router](https://github.com/ARMmbed/k64f-border-router), 6LoWPAN only
+- [mbed gateway](https://firefly-iot.com/product/firefly-6lowpan-gateway-2-4ghz/)
+ 
+Read the instructions on updating the firmware of your mbed gateway working as 6LoWPAN [here](https://github.com/ARMmbed/mbed-os-example-client#mbed-gateway).
+
+Both border routers support static and dynamic backhaul configuration. The static configuration is good for testing but the dynamic one works if your network infrastructure is supplying an IPv6 address. Make sure that you use the appropiate mode.
+
+Remember to connect the Ethernet cable between the border router and your home/office router. Then power up the board.
 
 ## Testing
 
@@ -67,7 +140,7 @@
 
         mbed compile -m K64F -t GCC_ARM
 
-**NOTE:** Please make sure that the _mbed_app.json_ is also updated to reflect the usage of a particular RF driver. For example,
+**Note:** Make sure that the `mbed_app.json` file is also updated to reflect the usage of a particular RF driver. For example,
 
 ```json
       "radio-type":{
@@ -75,23 +148,3 @@
             "value": "ATMEL"
         },
 ```
-## Important note (Multi-platform support)
-
-mbed OS provides you with total control of the device. However, some defaults are always loaded if you do not provide proper information regarding them. This becomes evident when you switch among platforms. On some platforms, a particular pin might be reserved for a particular functionality (depending upon the MCU) which thus cannot be used generally. If the Ardurino form factor is not available, or the required peripherial is on a different pin, the pins values can be set manually. For example, you can add *"atmel-rf.spi-rst": "D4"* to your `mbed_app.json` file. This will set the SPI_RST pin to D4 of the GPIO.
-
-```json
-{
-    "target_overrides": {
-        "*": {
-            "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
-            "atmel-rf.spi-rst": "D4"
-        }
-    }
-}
-```
-
-Desired work flow for switching the platform:
-
-1. Check the platform pin map from [mbed Platforms](https://developer.mbed.org/platforms/).
-2. Make sure that the desired GPIO pin is free by looking at the data sheet of the particular MCU. Most of the data sheets are available on [mbed Platforms](https://developer.mbed.org/platforms/). 
-3. If necessary, change the pin or pins by using the mbed OS config mechanism. To get more information about the configuration system see the [documentation](https://github.com/ARMmbed/mbed-os/blob/master/docs/config_system.md).