This directory contains example platform drivers for the Silicon Labs EFR32MG21 based on EFR32™ Mighty Gecko Wireless Starter Kit
The example platform drivers are intended to present the minimal code necessary to support OpenThread. EFR32MG21 SoC has rich memory and peripheral resources which can support all OpenThread capabilities. See the “Run the example with EFR32 boards” section below for an example using basic OpenThread capabilities.
Download and install the GNU toolchain for ARM Cortex-M.
In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
$ cd <path-to-openthread> $ ./script/bootstrap
/Applications/Simplicity\ Studio.app/Contents/Eclipse/developer/sdks/gecko_sdk_suite
C:\SiliconLabs\SimplicityStudio\v5\developer\sdks\gecko_sdk_suite
./SimplicityStudio_v5/developer/sdks/gecko_sdk_suite
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. For more information on RAIL, see Radio Abstraction Interface Layer.
$ cd <path-to-Simplicity-Studio>/developer/sdks $ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
Alternatively create a symbolic link to the Flex SDK source code.
$ cd <path-to-openthread>/third_party $ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
$ cd <path-to-openthread> $ ./bootstrap
For EFR32MG21™ Mighty Gecko Wireless Starter Kit, this can be done using both the CMake and autotools build systems
CMake (preferred)
$ ./script/cmake-build efr32mg21 -DBOARD=brd4180b ... -- Configuring done -- Generating done -- Build files have been written to: <path-to-openthread>/build/efr32mg21 + [[ -n ot-rcp ot-cli-ftd ot-cli-mtd ot-ncp-ftd ot-ncp-mtd sleepy-demo-ftd sleepy-demo-mtd ]] + ninja ot-rcp ot-cli-ftd ot-cli-mtd ot-ncp-ftd ot-ncp-mtd sleepy-demo-ftd sleepy-demo-mtd [940/940] Linking CXX executable examples/apps/ncp/ot-ncp-ftd + cd <path-to-openthread>
After a successful build, the elf
files are found in <path-to-openthread>/build/efr32mg21/examples
.
# For linux $ find build/efr32mg21/examples -type f -executable build/efr32mg21/examples/apps/cli/ot-cli-mtd build/efr32mg21/examples/apps/cli/ot-cli-ftd build/efr32mg21/examples/apps/ncp/ot-ncp-ftd build/efr32mg21/examples/apps/ncp/ot-ncp-mtd build/efr32mg21/examples/apps/ncp/ot-rcp build/efr32mg21/examples/platforms/efr32/sleepy-demo/sleepy-demo-ftd/sleepy-demo-ftd build/efr32mg21/examples/platforms/efr32/sleepy-demo/sleepy-demo-mtd/sleepy-demo-mtd # For BSD/Darwin/mac systems $ find build/efr32mg21/examples -type f -perm +111 build/efr32mg21/examples/apps/cli/ot-cli-mtd build/efr32mg21/examples/apps/cli/ot-cli-ftd build/efr32mg21/examples/apps/ncp/ot-ncp-ftd build/efr32mg21/examples/apps/ncp/ot-ncp-mtd build/efr32mg21/examples/apps/ncp/ot-rcp build/efr32mg21/examples/platforms/efr32/sleepy-demo/sleepy-demo-ftd/sleepy-demo-ftd build/efr32mg21/examples/platforms/efr32/sleepy-demo/sleepy-demo-mtd/sleepy-demo-mtd
autotools (soon to be depracated)
$ make -f examples/Makefile-efr32mg21 BOARD=BRD4180A
After a successful build, the elf
files are found in <path-to-openthread>/output/efr32mg21/bin
.
Simplicity Commander provides a graphical interface for J-Link Commander.
$ cd <path-to-openthread>/output/efr32mg21/bin $ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex $ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
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.
CLI example
firmware (as shown above)./dev/ttyACM0
(serial port settings: 115200 8-N-1). Type help
for a list of commands.> help help channel childtimeout contextreusedelay extaddr extpanid ipaddr keysequence leaderweight masterkey mode netdata register networkidtimeout networkname panid ping prefix releaserouterid rloc16 route routerupgradethreshold scan start state stop
> panid 0xface Done > ifconfig up Done > thread start Done wait a couple of seconds... > state leader Done
/dev/ttyACM1
(serial port settings: 115200 8-N-1) and attach it to the Thread network as a Router.> panid 0xface Done > routerselectionjitter 1 Done > ifconfig up Done > thread start Done wait a couple of seconds... > state router Done
> ipaddr fdde:ad00:beef:0:0:ff:fe00:fc00 fdde:ad00:beef:0:0:ff:fe00:800 fdde:ad00:beef:0:5b:3bcd:deff:7786 fe80:0:0:0:6447:6e10:cf7:ee29 Done
> ping fdde:ad00:beef:0:5b:3bcd:deff:7786 8 bytes from fdde:ad00:beef:0:5b:3bcd:deff:7786: icmp_seq=1 hlim=64 time=24ms
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.
$ cd <path-to-openthread> $ ./bootstrap $ make -f examples/Makefile-efr32mg21 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
For a list of all available commands, visit OpenThread CLI Reference README.md.
The following toolchain has been used for testing and verification:
The EFR32 example has been verified with following Flex SDK/RAIL Library version: