This application is the simplest one to utilize our mesh networking stack. It just joins your device to the unsecure 6LoWPAN-ND network. The canonical source for this example lives at https://github.com/ARMmbed/mbed-os-example-mesh-minimal

Example mesh application for Mbed OS

With this application, you can use our mesh networking stack. This application joins your device to the unsecure 6LoWPAN-ND network.

Setup

Building with Mbed CLI

If you'd like to use Mbed CLI to build this offline, then you should refer to the Mbed CLI documentation. The instructions here relate to using the Mbed Online Compiler

  1. Click `Import this application` button.
  2. Change the channel settings: See the file `mbed_app.json` for an example of defining an IEEE 802.15.4 channel to use.
  3. Compile the application

A binary is generated at the end of the build process.

Connect the RF shield to the board

By default, we are using the Atmel AT86RF233, which you can purchase. Place the shield on top of your board, and power it on.

Program the target

Drag and drop the binary to the target to program the application.

Update the firmware of the border router.

You can read the instructions on updating the firmware of your board working as 6LoWPAN border router here.

Please remember to connect the Ethernet cable between the border router and your router. Then, power up the board.

Testing

As soon as both the border router and the target are up and running, you can verify the correct behavior. Open a serial console, and see the IP address obtained by the device.

Note: This application uses a baud rate of 115200.

Quote:

connected. IP = 2001:db8:a0b:12f0::1

You can use this IP address to ping from your PC and verify that the connection is working correctly.

Changing the radio driver (optional)

To run a 6LoWPAN-ND network, you need a working RF driver for Nanostack. This example uses the Atmel AT86RF233 by default.

To change the RF driver:

  1. Uninstall the Atmel RF driver.
  2. Install the new driver. (For example, for the FRDM-CR20A radio shield based on the MCR20A device.)
  3. Recompile your application.
Committer:
mbed_official
Date:
Tue Oct 25 14:15:10 2016 +0100
Revision:
21:6c1e9147037c
Child:
24:671ef092f6ca
Merge pull request #28 from ARMmbed/add_jenkins_file

Added jenkins file

Commit copied from https://github.com/ARMmbed/mbed-os-example-mesh-minimal

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 21:6c1e9147037c 1 // List of targets with supported RF shields to compile
mbed_official 21:6c1e9147037c 2 def targets = [
mbed_official 21:6c1e9147037c 3 "K64F": ["ATMEL", "MCR20"],
mbed_official 21:6c1e9147037c 4 //"NUCLEO_F401RE": ["ATMEL", "MCR20"],
mbed_official 21:6c1e9147037c 5 "NUCLEO_F429ZI": ["ATMEL", "MCR20"],
mbed_official 21:6c1e9147037c 6 //"NCS36510": ["NCS36510"],
mbed_official 21:6c1e9147037c 7 "UBLOX_EVK_ODIN_W2": ["ATMEL", "MCR20"]
mbed_official 21:6c1e9147037c 8 ]
mbed_official 21:6c1e9147037c 9
mbed_official 21:6c1e9147037c 10 // Map toolchains to compilers
mbed_official 21:6c1e9147037c 11 def toolchains = [
mbed_official 21:6c1e9147037c 12 ARM: "armcc",
mbed_official 21:6c1e9147037c 13 GCC_ARM: "arm-none-eabi-gcc",
mbed_official 21:6c1e9147037c 14 IAR: "iar_arm"
mbed_official 21:6c1e9147037c 15 ]
mbed_official 21:6c1e9147037c 16
mbed_official 21:6c1e9147037c 17 // Supported RF shields
mbed_official 21:6c1e9147037c 18 def radioshields = [
mbed_official 21:6c1e9147037c 19 "ATMEL",
mbed_official 21:6c1e9147037c 20 "MCR20",
mbed_official 21:6c1e9147037c 21 "NCS36510"
mbed_official 21:6c1e9147037c 22 ]
mbed_official 21:6c1e9147037c 23
mbed_official 21:6c1e9147037c 24 // Mesh interfaces: 6LoWPAN and Thread
mbed_official 21:6c1e9147037c 25 def meshinterfaces = [
mbed_official 21:6c1e9147037c 26 "6lp",
mbed_official 21:6c1e9147037c 27 "thd"
mbed_official 21:6c1e9147037c 28 ]
mbed_official 21:6c1e9147037c 29
mbed_official 21:6c1e9147037c 30 def stepsForParallel = [:]
mbed_official 21:6c1e9147037c 31
mbed_official 21:6c1e9147037c 32 // Jenkins pipeline does not support map.each, we need to use oldschool for loop
mbed_official 21:6c1e9147037c 33 for (int i = 0; i < targets.size(); i++) {
mbed_official 21:6c1e9147037c 34 for(int j = 0; j < toolchains.size(); j++) {
mbed_official 21:6c1e9147037c 35 for(int k = 0; k < radioshields.size(); k++) {
mbed_official 21:6c1e9147037c 36 for(int l = 0; l < meshinterfaces.size(); l++) {
mbed_official 21:6c1e9147037c 37 def target = targets.keySet().asList().get(i)
mbed_official 21:6c1e9147037c 38 def allowed_shields = targets.get(target)
mbed_official 21:6c1e9147037c 39 def toolchain = toolchains.keySet().asList().get(j)
mbed_official 21:6c1e9147037c 40 def compilerLabel = toolchains.get(toolchain)
mbed_official 21:6c1e9147037c 41 def radioshield = radioshields.get(k)
mbed_official 21:6c1e9147037c 42 def meshInterface = meshinterfaces.get(l)
mbed_official 21:6c1e9147037c 43 def stepName = "${target} ${toolchain} ${radioshield} ${meshInterface}"
mbed_official 21:6c1e9147037c 44 if(allowed_shields.contains(radioshield)) {
mbed_official 21:6c1e9147037c 45 stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield, meshInterface)
mbed_official 21:6c1e9147037c 46 }
mbed_official 21:6c1e9147037c 47 }
mbed_official 21:6c1e9147037c 48 }
mbed_official 21:6c1e9147037c 49 }
mbed_official 21:6c1e9147037c 50 }
mbed_official 21:6c1e9147037c 51
mbed_official 21:6c1e9147037c 52 timestamps {
mbed_official 21:6c1e9147037c 53 parallel stepsForParallel
mbed_official 21:6c1e9147037c 54 }
mbed_official 21:6c1e9147037c 55
mbed_official 21:6c1e9147037c 56 def buildStep(target, compilerLabel, toolchain, radioShield, meshInterface) {
mbed_official 21:6c1e9147037c 57 return {
mbed_official 21:6c1e9147037c 58 stage ("${target}_${compilerLabel}_${radioShield}_${meshInterface}") {
mbed_official 21:6c1e9147037c 59 node ("${compilerLabel}") {
mbed_official 21:6c1e9147037c 60 deleteDir()
mbed_official 21:6c1e9147037c 61 dir("mbed-os-example-mesh-minimal") {
mbed_official 21:6c1e9147037c 62 checkout scm
mbed_official 21:6c1e9147037c 63
mbed_official 21:6c1e9147037c 64 if ("${radioShield}" == "MCR20") {
mbed_official 21:6c1e9147037c 65 // Replace default rf shield
mbed_official 21:6c1e9147037c 66 execute("sed -i 's/\"value\": \"ATMEL\"/\"value\": \"MCR20\"/' mbed_app.json")
mbed_official 21:6c1e9147037c 67 }
mbed_official 21:6c1e9147037c 68
mbed_official 21:6c1e9147037c 69 if ("${radioShield}" == "NCS36510") {
mbed_official 21:6c1e9147037c 70 // Replace default rf shield
mbed_official 21:6c1e9147037c 71 execute("sed -i 's/\"value\": \"ATMEL\"/\"value\": \"NCS36510\"/' mbed_app.json")
mbed_official 21:6c1e9147037c 72 }
mbed_official 21:6c1e9147037c 73
mbed_official 21:6c1e9147037c 74 if ("${meshInterface}" == "thd") {
mbed_official 21:6c1e9147037c 75 // Change mesh interface to thread
mbed_official 21:6c1e9147037c 76 execute("sed -i 's/\"value\": \"MESH_LOWPAN\"/\"value\": \"MESH_THREAD\"/' mbed_app.json")
mbed_official 21:6c1e9147037c 77
mbed_official 21:6c1e9147037c 78 //Change operation mode to Thread router
mbed_official 21:6c1e9147037c 79 execute("sed -i 's/\"NANOSTACK\", \"LOWPAN_ROUTER\", \"COMMON_PAL\"/\"NANOSTACK\", \"THREAD_ROUTER\", \"COMMON_PAL\"/' mbed_app.json")
mbed_official 21:6c1e9147037c 80 }
mbed_official 21:6c1e9147037c 81
mbed_official 21:6c1e9147037c 82 if ("${meshInterface}" == "6lp") {
mbed_official 21:6c1e9147037c 83 // Use systest border router for testing
mbed_official 21:6c1e9147037c 84 execute("sed -i 's/\"mbed-mesh-api.6lowpan-nd-channel\": 12/\"mbed-mesh-api.6lowpan-nd-channel\": 18/' mbed_app.json")
mbed_official 21:6c1e9147037c 85 }
mbed_official 21:6c1e9147037c 86
mbed_official 21:6c1e9147037c 87 execute ("mbed deploy --protocol ssh")
mbed_official 21:6c1e9147037c 88 // Checkout latest mbed-os master
mbed_official 21:6c1e9147037c 89 dir("mbed-os") {
mbed_official 21:6c1e9147037c 90 execute ("git fetch origin master")
mbed_official 21:6c1e9147037c 91 execute ("git checkout FETCH_HEAD")
mbed_official 21:6c1e9147037c 92 }
mbed_official 21:6c1e9147037c 93 execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}_${meshInterface}/ -m ${target} -t ${toolchain} -c")
mbed_official 21:6c1e9147037c 94 }
mbed_official 21:6c1e9147037c 95 archive '**/mbed-os-example-mesh-minimal.bin'
mbed_official 21:6c1e9147037c 96 }
mbed_official 21:6c1e9147037c 97 }
mbed_official 21:6c1e9147037c 98 }
mbed_official 21:6c1e9147037c 99 }