1 # OpenThread on EFR32MG12 Example
3 This directory contains example platform drivers for the [Silicon Labs EFR32MG12][efr32mg12] based on [EFR32™ Mighty Gecko Wireless Starter Kit][slwstk6000b] or [Thunderboard™ Sense 2 Sensor-to-Cloud Advanced IoT Development Kit][sltb004a].
5 [efr32mg]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc
6 [slwstk6000b]: http://www.silabs.com/products/development-tools/wireless/mesh-networking/mighty-gecko-starter-kit
7 [sltb004a]: https://www.silabs.com/products/development-tools/thunderboard/thunderboard-sense-two-kit
9 The example platform drivers are intended to present the minimal code necessary to support OpenThread. [EFR32MG12P SoC][efr32mg12p] has rich memory and peripheral resources which can support all OpenThread capabilities. See the "Run the example with EFR32MG12 boards" section below for an example using basic OpenThread capabilities.
11 See [sleepy-demo/README.md](sleepy-demo/README.md) for instructions for an example that uses the low-energy modes of the EFR32MG12 when running as a Sleepy End Device.
13 [efr32mg12p]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc/device.EFR32MG12P432F1024GL125
17 Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
19 [gnu-toolchain]: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
21 In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
24 $ cd <path-to-openthread>
30 1. Download and install the [Simplicity Studio][simplicity_studio].
32 [simplicity_studio]: http://www.silabs.com/products/development-tools/software/simplicity-studio
34 2. Install Flex (Gecko) SDK including RAIL Library from Simplicity Studio.
35 - Connect EFR32MG12P Wireless Starter Kit to Simplicity Studio.
36 - Find Flex SDK v2.7 in the Software Update page and click Install.
37 - Flex SDK v2.7 will be installed in the path: `/SimplicityStudio_v4/developer/sdks/gecko_sdk_suite`.
39 For more information on configuring, building, and installing applications for the Wireless Gecko (EFR32) portfolio using FLEX, see [Getting Started with the Silicon Labs Flex Software Development Kit for the Wireless Gecko (EFR32™) Portfolio][qsg138]. For more information on RAIL, see [Radio Abstraction Interface Layer][rail].
41 [qsg138]: https://www.silabs.com/documents/public/quick-start-guides/qsg138-flex-efr32.pdf
42 [rail]: http://www.silabs.com/products/development-tools/software/radio-abstraction-interface-layer-sdk
44 3. Configure the path to Flex SDK source code.
47 $ cd <path-to-openthread>/third_party
49 $ cd <path-to-Simplicity-Studio>/developer/sdks
50 $ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
53 Alternatively create a symbolic link to the Flex SDK source code.
56 $ cd <path-to-openthread>/third_party
58 $ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
61 4. Build OpenThread Firmware (CLI example) on EFR32 platform.
64 $ cd <path-to-openthread>
68 For EFR32MG12™ Mighty Gecko Wireless Starter Kit:
71 $ make -f examples/Makefile-efr32mg12 BOARD=BRD4161A
74 or alternatively for the Thunderboard™ Sense 2:
77 $ make -f examples/Makefile-efr32mg12 BOARD=BRD4166A
80 After a successful build, the `elf` files are found in `<path-to-openthread>/output/efr32mg12/bin`.
84 Compiled binaries may be flashed onto the EFR32 using [JLinkGDBServer][jlinkgdbserver]. EFR32 Starter kit mainboard integrates an on-board SEGGER J-Link debugger.
86 [jlinkgdbserver]: https://www.segger.com/jlink-gdb-server.html
89 $ cd <path-to-JLinkGDBServer>
90 $ sudo ./JLinkGDBServer -if swd -device EFR32MG12PxxxF1024
91 $ cd <path-to-openthread>/output/efr32/bin
92 $ arm-none-eabi-gdb ot-cli-ftd
93 $ (gdb) target remote 127.0.0.1:2331
99 Note: Support for the "EFR32MG12PxxxF1024" device was added to JLinkGDBServer V6.14d.
101 Or Compiled binaries also may be flashed onto the specified EFR32 dev board using [J-Link Commander][j-link-commander].
103 [j-link-commander]: https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/
106 $ cd <path-to-openthread>/output/efr32mg12/bin
107 $ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
108 $ JLinkExe -device EFR32MG12PxxxF1024 -speed 4000 -if SWD -autoconnect 1 -SelectEmuBySN <SerialNo>
109 $ J-Link>loadfile ot-cli-ftd.hex
114 Note: SerialNo is J-Link serial number. Use the following command to get the serial number of the connected J-Link.
120 Alternatively Simplicity Commander provides a graphical interface for J-Link Commander.
123 $ cd <path-to-openthread>/output/efr32mg12/bin
124 $ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.ihex
125 $ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
128 In the J-Link Device drop-down list select the serial number of the device to flash. Click the Adapter Connect button. Ensure the Debug Interface drop-down list is set to SWD and click the Target Connect button. Click on the Flash icon on the left side of the window to switch to the flash page. In the Flash MCU pane enter the path of the ot-cli-ftd.s37 file or choose the file with the Browse... button. Click the Flash button located under the Browse... button.
130 ## Run the example with EFR32MG12 boards
132 1. Flash two EFR32 boards with the `CLI example` firmware (as shown above).
133 2. Open terminal to first device `/dev/ttyACM0` (serial port settings: 115200 8-N-1). Type `help` for a list of commands.
157 routerupgradethreshold
165 3. Start a Thread network as Leader.
173 Channel Mask: 0x07fff800
174 Ext PAN ID: d63e8e3e495ebbc3
175 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
176 Master Key: dfd34f0f05cad978ec4e32b0413038ff
177 Network Name: OpenThread-8f28
179 PSKc: c23a76e98f1a6483639b1ac1271e2e27
180 Security Policy: 0, onrcb
182 > dataset commit active
189 wait a couple of seconds...
196 4. Open terminal to second device `/dev/ttyACM1` (serial port settings: 115200 8-N-1) and attach it to the Thread network as a Router.
199 > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
201 > dataset commit active
203 > routerselectionjitter 1
210 wait a couple of seconds...
217 5. List all IPv6 addresses of Leader.
221 fd3d:b50b:f96d:722d:0:ff:fe00:fc00
222 fd3d:b50b:f96d:722d:0:ff:fe00:c00
223 fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
224 fe80:0:0:0:6c41:9001:f3d6:4148
228 6. Send an ICMPv6 ping to Leader's Mesh-EID IPv6 address.
231 > ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
232 16 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms
235 The above example demonstrates basic OpenThread capabilities. Enable more features/roles (e.g. commissioner, joiner, DHCPv6 Server/Client, etc.) by assigning compile-options before compiling.
238 $ cd <path-to-openthread>
240 $ make -f examples/Makefile-efr32mg12 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
243 For a list of all available commands, visit [OpenThread CLI Reference README.md][cli].
245 [cli]: https://github.com/openthread/openthread/blob/master/src/cli/README.md
249 The following toolchain has been used for testing and verification:
253 The EFR32 example has been verified with following Flex SDK/RAIL Library version:
255 - Flex SDK version 2.7.0.0