Netidee Blog Bild
A 6LoWPAN with a Raspberry Pi and two SAMR21-xpro
by using the OpenLabs 802.15.4 radio module (07.04.2021)
Förderjahr 2018 / Project Call #13 / ProjektID: 3441 / Projekt: CoMatrix

In this blogpost we will describe how we set up a 6LoWPAN network consisting of a Raspberry Pi and two SAMR21-xpro microcontrollers. At first we tried to enable 6LoWPAN on a Raspberry Pi 4 with latest Raspberry Pi OS (i.e. Raspbian 10/Buster with Kernel 5.10) by using the OpenLabs 802.15.4 radio module. Unfortunately, it seems like this module is not compatible with a Raspberry Pi 4. Sending packets from the Raspberry Pi 4 via 6LoWPAN to a SAMR21-xpro microcontroller works (at least via Multicast), but receiving 6LoWPAN packets doesn't work. This problem needs further investigation. For the time being, we "solved" this issue by testing the module on a Raspberry Pi 3B and a Raspberry Pi 3B+ with Raspbian 9/Stretch and Kernel 4.9 successfully (cf. [1]). Afterwards we upgraded Raspbian 9/Stretch to Raspbian 10/Buster with Kernel 5.10 where 6LoWPAN also works out-of-the-box. Therefore Raspbian 10/Buster with Kernel 5.10 supports 6LoWPAN with this OpenLabs module by default when using a Raspberry Pi 3B(+).

The module was enabled as described in [2]. Afterwards we installed the Linux WPAN tools to be able to configure the Raspberry Pi's 6LoWPAN device (cf. [3] and [4]).

We configured our lowpan0 interface as follows:

ip link set lowpan0 down
ip link set wpan0 down
iwpan phy phy0 set channel 0 26 # same channel ID as RIOT-OS/examples/gnrc_networking
iwpan dev wpan0 set pan_id 0x23 # same network ID as RIOT-OS/examples/gnrc_networking
ip link add link wpan0 name lowpan0 type lowpan
ip link set wpan0 up
ip link set lowpan0 up

Afterwards the lowpan0 interface on the Raspberry Pi has a link local IPv6 address:

root@raspberrypi:~# ip a
[...]
4: wpan0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 123 qdisc pfifo_fast state UNKNOWN group default qlen 300
    link/ieee802.15.4 36:3a:07:cc:65:41:2b:31 brd ff:ff:ff:ff:ff:ff:ff:ff
5: lowpan0@wpan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
    link/6lowpan 36:3a:07:cc:65:41:2b:31 brd ff:ff:ff:ff:ff:ff:ff:ff
    inet6 fe80::343a:7cc:6541:2b31/64 scope link
       valid_lft forever preferred_lft forever

Note: By default the link local IPv6 Address of the lowpan0 interface changes after every reboot! It is possible to configure a link local address persistently (cf. [5]).

It's important to set the same channel ID and PAN ID for all the devices in a 6LoWPAN network. The default PAN ID on a SAMR21-xpro flashed with RIOT's gnrc_networking example is 0x23, the default channel ID is 26. There are scripts available to configure WPAN interfaces on a Raspberry Pi [6].

We flashed the RIOT's gnrc_networking example [7] on two SAMR21-xpro microcontrollers to test connections in the 6LoWPAN network. It is possible to configure the PAN ID and channel ID also on the SAMR21-xpro:

ifconfig 6 set pan_id 0xbeef
ifconfig 6 set channel 23

If the matching PAN/channel IDs are set and the devices are in range of each other (approx. 10m) they are able to ping each other. E.g. ping a SAMR21-xpro from the Raspberry Pi 3B(+):

ping6 -I lowpan0 fe80::204:2519:1234:5678

And vice versa:

ping fe80::343a:7cc:6541:2b31

Communication via UDP is also provided because the gnrc_networking example includes a UDP server and client.

The next step in the CoMatrix project is to enable communication from the SAMR21-xpro's via 6LoWPAN/CoAP to a Matrix homeserver by using the Raspberry Pi as a forward proxy to translate CoAP to HTTP.

____________________________

Links:

Tags:

CoMatrix IoT Raspberry Pi Openlabs 802.15.4 6LoWPAN border router RIOT-OS SAMR21-xpro Matrix
CAPTCHA
Diese Frage dient der Überprüfung, ob Sie ein menschlicher Besucher sind und um automatisierten SPAM zu verhindern.

    Weitere Blogbeiträge

    Datenschutzinformation
    Der datenschutzrechtliche Verantwortliche (Internet Privatstiftung Austria - Internet Foundation Austria, Österreich) würde gerne mit folgenden Diensten Ihre personenbezogenen Daten verarbeiten. Zur Personalisierung können Technologien wie Cookies, LocalStorage usw. verwendet werden. Dies ist für die Nutzung der Website nicht notwendig, ermöglicht aber eine noch engere Interaktion mit Ihnen. Falls gewünscht, treffen Sie bitte eine Auswahl: