Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit fe60ece

Browse files
committed
Merge pull request #11 from ARMmbed/doc_update
Added 6LoWPAN and Thread configuration to readme
2 parents ab7e546 + 78a05e7 commit fe60ece

File tree

4 files changed

+132
-32
lines changed

4 files changed

+132
-32
lines changed

README.md

Lines changed: 115 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,153 @@ This is the mbed Client example for mbed OS (we also have one for [Linux](https:
44

55
The application:
66

7+
* Connects to network with WiFi, Ethernet, Cellular, 6LoWPAN ND or Thread connection.
78
* Registers with mbed Device Connector.
89
* Gives mbed Device Connector access to its resources (read and write).
910
* Records the number of clicks on the device’s button and sends the number to mbed Device Connector.
1011
* Lets you control the blink pattern of the LED on the device (through mbed Device Connector).
1112

1213
## Required hardware
1314

14-
* An [FRDM-K64F](http://developer.mbed.org/platforms/frdm-k64f/) board.
15-
* An Ethernet connection to the internet.
16-
* An Ethernet cable.
17-
* A micro-USB cable.
15+
* [FRDM-K64F](http://developer.mbed.org/platforms/frdm-k64f/) board.
16+
* 1-2 micro-USB cables.
17+
* [mbed 6LoWPAN gateway router](https://firefly-iot.com/product/firefly-6lowpan-gateway-2-4ghz/) for 6LoWPAN ND and Thread.
18+
* mbed 6LoWPAN shield (AT86RF212B/[AT86RF233](https://firefly-iot.com/product/firefly-arduino-shield-2-4ghz/)) for 6LoWPAN ND and Thread.
19+
* Ethernet cable and connection to the internet.
1820

1921
## Required software
2022

21-
* An [ARM mbed account](https://developer.mbed.org/account/login/?next=/).
23+
* [ARM mbed account](https://developer.mbed.org/account/login/?next=/).
2224
* [mbed-cli](https://github.com/ARMmbed/mbed-cli) - to build the example programs. To learn how to build mbed OS applications with mbed-cli, see [the user guide](https://github.com/ARMmbed/mbed-cli/blob/master/README.md).
23-
* A [serial port monitor](https://developer.mbed.org/handbook/SerialPC#host-interface-and-terminal-applications).
25+
* [Serial port monitor](https://developer.mbed.org/handbook/SerialPC#host-interface-and-terminal-applications).
2426

25-
## Setting up
27+
## Application setup
2628

27-
To set up the example, please:
29+
To configure the example application, please:
2830

29-
1. [Build the example](#Building-the-example).
30-
1. [Set up an IP address](#IP-address-setup). This step is optional.
31-
1. [Set a socket type](#Setting-socket-type). This step is optional.
31+
1. [Select the connection type](#connection-type).
32+
1. [Set the client credentials](#client-credentials).
33+
1. [Change 6LoWPAN ND & Thread settings](#6lowpan-nd-and-thread-settings).
34+
1. [Change Ethernet settings](#ethernet-settings).
35+
1. [Change cellular settings](#cellular-settings).
36+
1. [Change Wi-Fi settings](#wi-fi-settings).
37+
1. [Set up an IP address](#ip-address-setup). This step is optional.
38+
1. [Change the socket type](#changing-socket-type). This step is optional.
3239

33-
### Building the example
40+
### Connection type
3441

35-
To build the example application:
42+
The application uses Ethernet as the default connection type. To change the connection type, set one of them as defined and all the rest as undefined in the beginning of the `main.cpp` file. For example, to enable 6LoWPAN ND mode:
43+
44+
```
45+
#undef ETHERNET
46+
#undef WIFI
47+
#undef CELLULAR
48+
#define MESH_LOWPAN_ND
49+
#undef MESH_THREAD
50+
```
51+
52+
### Client credentials
53+
54+
To register the application to the Connector service, you need to create and set the client side certificate.
3655

37-
1. Clone [this](https://github.com/ARMmbed/mbed-client-quickstart-morpheus) repository.
3856
1. Go to [mbed Device Connector](https://connector.mbed.com) and log in with your mbed account.
3957
1. On mbed Device Connector, go to [My Devices > Security credentials](https://connector.mbed.com/#credentials) and click the **Get my device security credentials** button to get new credentials for your device.
40-
1. Replace the credentials in `security.h` of this project's directory with content copied above.
41-
1. Open a command line tool and navigate to the project’s directory.
42-
1. Update mbed-os sources using the `mbed update` command.
43-
1. Build the application by selecting the hardware board and build toolchain using the command `mbed compile -m K64F -t GCC_ARM`. mbed-cli builds a binary file under the project’s `.build` directory.
44-
1. Plug the Ethernet cable into the board.
45-
1. Plug the micro-USB cable into the **OpenSDA** port. The board is listed as a mass-storage device.
46-
1. Drag the binary `.build/K64F/GCC_ARM/mbed-client-quickstart-morpheus.bin` to the board to flash the application.
47-
1. The board is automatically programmed with the new binary. A flashing LED on it indicates that it is still working. When the LED stops blinking, the board is ready to work.
48-
1. Press the **RESET** button on the board to run the program.
49-
1. For verification, continue to the [Monitoring the application](#monitoring-the-application) chapter.
58+
1. Replace the contents in `security.h` of this project's directory with content copied above.
59+
60+
### 6LoWPAN ND and Thread settings
61+
62+
6LoWPAN ND and Thread use IPv6 for connectivity. Therefore, you need to verify first that you have a working IPv6 connection. To do that, ping the Connector IPv6 address `2607:f0d0:2601:52::20` from your network.
63+
64+
#### mbed gateway
65+
66+
To connect the example application in 6LoWPAN ND or Thread mode to Connector, you need to set up an mbed 6LoWPAN gateway router. Clone the [mbed-client-example-6lowpan](https://github.com/ARMmbed/mbed-client-example-6lowpan) repository and follow the [gateway configuration](https://github.com/ARMmbed/mbed-client-example-6lowpan#gateway-configuration) instructions. Use the dynamic binary in both cases for IPv6 autoconfiguration.
67+
68+
#### Channel settings
69+
70+
In 6LoWPAN ND and Thread mode, you need to set the channel settings to match the mbed gateway settings. Channel settings can be found in the `MACROS.txt` file. For 2.4GHz shields (AT86RF233), use the following values:
71+
72+
```
73+
YOTTA_CFG_MBED_MESH_API_6LOWPAN_ND_CHANNEL_PAGE=0
74+
YOTTA_CFG_MBED_MESH_API_6LOWPAN_ND_CHANNEL=12
75+
YOTTA_CFG_MBED_MESH_API_THREAD_CONFIG_CHANNEL_PAGE=0
76+
YOTTA_CFG_MBED_MESH_API_THREAD_CONFIG_CHANNEL=12
77+
```
78+
79+
Values for sub-GHz shields (AT86RF212B), **6LoWPAN ND only**:
80+
81+
```
82+
YOTTA_CFG_MBED_MESH_API_6LOWPAN_ND_CHANNEL_PAGE=2
83+
YOTTA_CFG_MBED_MESH_API_6LOWPAN_ND_CHANNEL=1
84+
```
5085

51-
### IP address setup (optional)
86+
For more information about the radio shields, see [the related documentation](docs/radio_module_identify.md).
5287

53-
This example uses IPv4 to communicate with the [mbed Device Connector Server](https://api.connector.mbed.com). The example program should automatically get an IPv4 address from the router when connected over Ethernet.
88+
#### Thread-specific settings
89+
90+
With Thread, you can change the operating mode of the device between a router and a sleepy end device as follows:
91+
92+
In the `MACROS.txt` file, change the `YOTTA_CFG_MBED_MESH_API_THREAD_DEVICE_TYPE` to either `MESH_DEVICE_TYPE_THREAD_ROUTER` or `MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE`.
93+
94+
### Ethernet settings
95+
96+
For running the example application using Ethernet, you need:
97+
98+
- An Ethernet cable.
99+
- An Ethernet connection to the internet.
100+
101+
### Cellular settings
102+
103+
TBD
104+
105+
### Wi-Fi settings
106+
107+
The example application uses ESP8266 WiFi Interface for managing the wireless connectivity. To run this application using WiFi, you need to:
108+
109+
1. Have [ESP8266](https://en.wikipedia.org/wiki/ESP8266) WiFi module running [Espressif Firmware](https://codeload.github.com/espressif/ESP8266_AT/zip/master)
110+
1. Mount WiFi module onto [K64F Grove Shield v2](https://developer.mbed.org/platforms/FRDM-K64F/#supported-seeed-studio-grove-extension)
111+
1. Attach the shield on the K64F board.
112+
1. In the `main.cpp` file:
113+
- set WIFI as defined and other connection types as undefined.
114+
- remove `#error "Remember to provide your WiFi credentials and provide in esp.connect("ssid","password");"`
115+
- `esp.connect("ssid", "password");` , replace `ssid` and `password` with your WiFi SSID and WiFi password respectively.
116+
117+
118+
### IP address setup
119+
120+
This example uses IPv4 to communicate with the [mbed Device Connector Server](https://api.connector.mbed.com) except for 6LoWPAN ND and Thread. The example program should automatically get an IPv4 address from the router when connected over Ethernet.
54121

55122
If your network does not have DHCP enabled, you have to manually assign a static IP address to the board. We recommend having DHCP enabled to make everything run smoothly.
56123

57-
### Changing socket type (binding mode - optional)
124+
### Changing socket type
58125

59-
Your device can connect to mbed Device Connector via one of two binding modes: UDP or TCP. The default is UDP.
126+
Your device can connect to mbed Device Connector via UDP or TCP binding mode. The default is UDP. The binding mode cannot be changed in 6LoWPAN ND or Thread mode.
60127

61128
To change the binding mode:
62129

63-
1. In the `simpleclient.h` file, find the parameter `SOCKET_MODE`.
64-
1. The default is `M2MInterface::UDP`.
130+
1. In the `simpleclient.h` file, find the parameter `SOCKET_MODE`. The default is `M2MInterface::UDP`.
65131
1. To switch to TCP, change it to `M2MInterface::TCP`.
66-
67-
Then re-build and flash the application.
132+
1. Rebuild and flash the application.
68133

69134
<span class="tips">**Tip:** The instructions in this document remain the same, irrespective of the socket mode you select.</span>
70135

136+
## Building the example
137+
138+
To build the example application:
139+
140+
1. Clone [this](https://github.com/ARMmbed/mbed-client-quickstart-morpheus) repository.
141+
1. Open a command line tool and navigate to the project’s directory.
142+
1. Update mbed-os sources using the `mbed update` command.
143+
1. [Configure](#application-setup) the client application.
144+
1. Build the application by selecting the hardware board and build the toolchain using the command `mbed compile -m K64F -t GCC_ARM -c -j0`. mbed-cli builds a binary file under the project’s `.build` directory.
145+
1. Plug the Ethernet cable into the board if you are using Ethernet mode.
146+
1. If you are using 6LoWPAN ND or Thread mode, connect and power on the gateway first.
147+
1. Plug the micro-USB cable into the **OpenSDA** port. The board is listed as a mass-storage device.
148+
1. Drag the binary `.build/K64F/GCC_ARM/mbed-client-quickstart-morpheus.bin` to the board to flash the application.
149+
1. The board is automatically programmed with the new binary. A flashing LED on it indicates that it is still working. When the LED stops blinking, the board is ready to work.
150+
1. Press the **RESET** button on the board to run the program.
151+
1. For verification, continue to the [Monitoring the application](#monitoring-the-application) chapter.
152+
153+
71154
## Monitoring the application
72155

73156
The application prints debug messages over the serial port, so you can monitor its activity with a serial port monitor. The application uses baud rate 115200.

docs/img/Radio_Identifications.png

1.62 MB
Loading
1.9 MB
Loading

docs/radio_module_identify.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Radio module identification
2+
3+
* Make sure that you are using the same radio modules on both server and client sides:
4+
5+
* If the radio module on the gateway router supports the 2.4 GHz frequency band, the client side must have an mbed 6LoWPAN shield that uses a 2.4 GHz radio module (such as Atmel AT86RF233).
6+
7+
* If the radio module on the gateway router supports the sub-GHz frequency band, the client side must have an mbed 6LoWPAN shield that uses a sub-GHz radio module (such as Atmel AT86RF212B).
8+
9+
* An easy way to identify which frequency band your setup uses is to check the **Antenna size** on the radio module:
10+
11+
* The sub-GHz band antenna is larger than the 2.4 GHz antenna.
12+
13+
* For the client side (mbed 6LoWPAN shield connected to an FRDM-K64F board), see the image below:
14+
![](img/Radio_Identifications.png)
15+
16+
* For the gateway router, see the image below:
17+
![](img/Radio_Identifications_GW.png)

0 commit comments

Comments
 (0)