Configure Raspberry Pi as 802.15.4/6LoWPAN Border Gateway

Hi,

with the help of other developers, I successfully got a Raspberry Pi with the Openlabs 802.15.4 radio adapter [0] working as a 802.15.4 and 6LoWPAN border gateway. A border gateway running Linux should allow adding more gateway and translation functions useful for the IoT.

The configuration process, including example. can be found on the wiki [1] and is tested with the Linux configuration on that page and current master of RIOT.

Thanks to Alexander and the rest of the Linux wpan community in #linux-wpan on Freenode and to Martin for building the Pi images.

Cheers, Tobias

[0] http://openlabs.co/store/Raspberry-Pi-802.15.4-radio [1] https://github.com/RIOT-OS/RIOT/wiki/How-to-install-6LoWPAN-Linux-Kernel-on-Raspberry-Pi (all the way at the bottom)

Hi Tobias!

with the help of other developers, I successfully got a Raspberry Pi with the Openlabs 802.15.4 radio adapter [0] working as a 802.15.4 and 6LoWPAN border gateway.

Nice work. I was able to reproduce your settings and it works pretty good.

A border gateway running Linux should allow adding more gateway and translation functions useful for the IoT.

Unfortunately, I'm not able to test this part since I don't have an IPv6 connection from the Raspberry PI to any other computer (due to university restrictions).

The configuration process, including example. can be found on the wiki [1] and is tested with the Linux configuration on that page and current master of RIOT.

I updated and fixed some minor glitches in the documentation. Great work!

Cheers, Oleg

Hi,

nice, thx for enhancing the page :slight_smile: its way better now Best regards, Martin

Hi,

to get an IPv6 connection for testing on any host you can use an ipv6 over ipv4 tunnel. Either by setting it manually using one of your university server (http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/chapter-configuring-ipv6-in-ipv4-tunnels.html) or using a tunnel provider.

When testing 6LowPAN with IoT-LAB long time ago, I used 'gogo6' that provides /56 for free http://www.gogo6.com/freenet6/tunnelbroker and it's enough for testing.

Regards, Gaëtan

Hi Tobias,

with the help of other developers, I successfully got a Raspberry Pi with the Openlabs 802.15.4 radio adapter [0] working as a 802.15.4 and 6LoWPAN border gateway.

thanks for your work, that's a great tutorial! Can you (and perhaps others) tell us which version of the RPi you used?

Your method does not seem to work on the latest RPi (Pi 2 Model B), but it does work on the Pi 1 Model B+. I prepared an SD card following the exact steps in the tutorial, put it in both models, but it only booted

Hello Lennart,

Which kernel version are you running ? (Can you post output of uname -a ? ) If you’re running an older version of kernel (and raspberry pi boot loader / firmware) it won’t support RPi 2 model B out of the box.

Solution could be : “sudo apt-get update && sudo apt-get upgrade” on RPi 1 to get firmware and kernel upgraded. Once done, It should boot on RPi 2 Model B as well.

Hope it helps.

Hi,

Which kernel version are you running ? (Can you post output of uname -a ? ) If you're running an older version of kernel (and raspberry pi boot loader / firmware) it won't support RPi 2 model B out of the box.

Solution could be : "sudo apt-get update && sudo apt-get upgrade" on RPi 1 to get firmware and kernel upgraded. Once done, It should boot on RPi 2 Model B as well.

I downloaded the latest raspian image (2015-05-05) from raspberrypi.org, and after dd'ing it to the SD-Card, it boots on both devices. I did an apt-get update && apt-get upgrade before installing the new (self-build) kernel, as recommended in the tutorial.

Output of uname -a is

Linux raspberrypi 4.1.6+ #1 PREEMPT Tue Aug 18 15:43:23 CEST 2015 armv6l GNU/Linux

which says armv6l at the end, so I'm guessing I built a kernel for armv6 and replaced the original raspian kernel with it.

Another run of apt-get update / upgrade tells me there are no new packages to install.

Best, Lennart

Hi,

Oh I see. I think kernel compilation steps differs slightly for RPi 2. Follow this link : https://www.raspberrypi.org/documentation/linux/kernel/building.md

Hope it helps.

Hi,

Oh I see. I think kernel compilation steps differs slightly for RPi 2. Follow this link: Raspberry Pi Documentation - The Linux kernel

thanks for pointing me to that page! I'll try that and let you know if it works.

Best, Lennart

Hi,

Sure, let me know if it works.

Also, instead of compiling kernel from the scratch, why not use existing kernel, and compile those modules only by grabbing the kernel source. It would be much easier I guess. Just a thought. You can grab RPi kernel source by using “rpi-source” (link : https://github.com/notro/rpi-source/wiki)

regards,

Dhruv.

Hi everyone,

to build the kernel for a RPi 2 Model B, you have to do only a few things differently:

First, before invoking any make command, set the environment variable KERNEL to kernel7, i.e.

KERNEL=kernel7

When cloning the git repo with the kernel sources, use

git clone --depth=1 GitHub - raspberrypi/linux: Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/ linux-rpi

This creates a shallow clone, leaving out most of the history, which you don't need anyway. It takes considerably less time.

When making the initial config, replace bcm2835_defconfig with bcm2709_defconfig, i.e.

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

Instead of arch/arm/boot/dts/bcm2835-rpi-b.dts, edit arch/arm/boot/dts/bcm2709-rpi-2-b.dts, but append the same text.

Finally, when copying the new kernel to the SD card, I recommend to keep the old kernel, and give the new one a distinct name, e.g.

sudo scripts/mkknlimg arch/arm/boot/zImage

/media/<myusername>/boot/super-fresh-kernel.img

and then open /boot/config.txt and add kernel=super-fresh-kernel.img. That way you still have a backup kernel you can use in case something goes wrong, and you don't have to install raspbian from scratch again.

All the steps I did not mention explicitly stay the same.

Happy hacking, Lennart

Hello Lennart,

Why don’t you host those kernels (zImages for Rpi 1 and Rpi 2) on github or something similar so that ppl can use them to build the same gateway without having to compile it on their own. Just a suggestion. :slight_smile: Nice work with RPi 2.

regards,

Dhruv

Hi,

Why don't you host those kernels (zImages for Rpi 1 and Rpi 2) on github or something similar so that ppl can use them to build the same gateway without having to compile it on their own. Just a suggestion. :slight_smile:

great idea, I'll do that and also add a PR to update the tutorial.

Btw, I just realized I forgot one important step that needs to be changed to work with the RPi 2 Model B:

After copying all the files and the kernel to the SD card, open /media/<myusername>/boot/config.txt (as described), but append

device_tree=bcm2709-rpi-2-b.dtb device_tree_address=0x100

Anyway, I'll do this right within the next few days and add it to github, so stay tuned.

Best, Lennart

Hi Lennart,

sorry for the delayed response, as you already found out we used the UK and China RasPI 1 Model B from <2011 in our tutorial.

You can directly add an own part in [1] since the wikipage is open to be edited by anyone. It would be great if you could extend the tutorial for the RasPI 2 :slight_smile: Since we don't have a RasPi 2 available we have no chance to test it.

Best regards, Martin

[1] https://github.com/RIOT-OS/RIOT/wiki/How-to-install-6LoWPAN-Linux-Kernel-on-Raspberry-Pi