6LoWPAN Network Connectivity and CoAP

Verify connectivity over 6LoWPAN between Raspi and SAMR21-xpro

  • Use gnrc_networking example on Ubuntu and build it for the SAMR21-xpro board, flash the firmware to the SAMR21-xpro and connect via pyterm:
cd RIOT/examples/gnrc_networking
make BOARD=samr21-xpro
make BOARD=samr21-xpro flash
make BOARD=samr21-xpro term
  • Use ifconfig to determine the interface id of SAMR21-xpro (7 in our case):
ifconfig
# Iface  7  HWaddr: 57:98  Channel: 26  Page: 0  NID: 0x23  PHY: O-QPSK
[...]
#           Long HWaddr: E2:F9:02:0F:36:26:A2:68
[...]
#           inet6 addr: fe80::e0f9:20f:3626:a268  scope: link  VAL
  • All ifconfig config options can be shown with ifconfig <interface id> set.

  • RIOT-OS default 802.15.4 channel is 26 and default PAN ID 0x23. We kept the defaults, if you change them, make sure to change them in the SAMR21-xpro configuration aswell:

    • [optional] Change the channel to 13 and the PAN ID to 0xbeef:
ifconfig 7 set pan_id 0xbeef
ifconfig 7 set channel 13

Ping test from Raspi to SAMR21-xpro

  • Multicast ping test through interface lowpan0 to group ff02::1 (all nodes in the link-local):
ping ff02::1%lowpan0        
PING ff02::1%lowpan0(ff02::1%lowpan0) 56 data bytes
64 bytes from fe80::1%lowpan0: icmp_seq=1 ttl=64 time=0.195 ms
64 bytes from fe80::e0f9:20f:3626:a268%lowpan0: icmp_seq=1 ttl=64 time=10.4 ms (DUP!)
  • Unicast ping:
ping fe80::e0f9:20f:3626:a268%lowpan0
ping fe80::e0f9:20f:3626:a268%lowpan0
PING fe80::e0f9:20f:3626:a268%lowpan0(fe80::e0f9:20f:3626:a268%lowpan0) 56 data bytes
64 bytes from fe80::e0f9:20f:3626:a268%lowpan0: icmp_seq=1 ttl=64 time=23.0 ms
[...]

Ping test from SAMR21-xpro to Raspi

  • Multicast ping test through interface 7 to group ff02::1:
# ping6 ff02::1%7
# 12 bytes from fe80::1%7: icmp_seq=0 ttl=64 rssi=-61 dBm time=8.309 ms
# 12 bytes from fe80::1%7: icmp_seq=1 ttl=64 rssi=-61 dBm time=6.124 ms
# 12 bytes from fe80::1%7: icmp_seq=2 ttl=64 rssi=-59 dBm time=6.461 ms
#
# --- ff02::1 PING statistics ---
# 3 packets transmitted, 3 packets received, 0% packet loss
# round-trip min/avg/max = 6.124/6.964/8.309 ms
  • Unicast ping from SAMR21-xpro to Raspi 6LoWPAN interface:
# : ping6 fe80::1%7
# 12 bytes from fe80::1%7: icmp_seq=0 ttl=64 rssi=-61 dBm time=8.467 ms
# 12 bytes from fe80::1%7: icmp_seq=1 ttl=64 rssi=-61 dBm time=7.966 ms

Monitoring 802.15.4 traffic with Nordic nRF52840-Dongle (PCA10059)

We used a Nordic nRF52840-Dongle (on Debian/Ubuntu Linux) to monitor 802.15.4 traffic exchanged between Raspi/SAMR21-xpro:

We flashed the nRF52840-Dongle as described in this tutorial (on a Debian 10 VM) and configured Wireshark as stated. Important is to have python3 as standard interpreter, otherwise the python script throws an error after starting Wireshark. Also make sure to set the correct channel ID for sniffing.

Possible Problems with 6LoWPAN, SAMR21-xpro and Raspberry Pi (with Openlabs 802.15.4 radio)

  • 6LoWPAN: RIOT does not receive packets from Linux when short_addr is set #11033
  • Do not use Raspberry Pi 4 with OpenLabs 802.15.4 radio module:
    • At least with the newest available Kernel (i.e. 5.10) it was only possible to send 802.15.4 packets to SAMR21-xpro and the Raspi did not receive any packets from SAMR21-xpro.
    • It is better to use Raspberry Pi 3B(+)
      • There it’s working with Raspbian STRETCH (Kernel 4.9 (Downgrade) and also with newest Kernel (5.10))
      • It’s also working with Raspbian BUSTER and Kernel 5.10
  • Monitoring 802.15.4 traffic: Correct channel ID must be set (RIOT-OS default: 26)
  • Communication SAMR21-xpro<->Raspi: The same channel ID (RIOT-OS default: 26) and PAN ID need to be set (RIOT-OS default: 0x23)

Test CoAP communication between Raspi and SAMR21-xpro

  • Install python3-pip and aiocoap on Raspi:
sudo apt install python3-pip
pip3 install --upgrade "aiocoap[all]"
  • Clone aiocoap repo and start the included simple CoAP server:
git clone https://github.com/chrysn/aiocoap.git
cd aiocoap
python3 server.py
  • Use gcoap example on SAMR21-xpro (RIOT OS repo already cloned on PC):
cd ~/RIOT/example/gcoap
make BOARD=samr21-xpro         //build gcoap example
make BOARD=samr21-xpro flash       //flah gcoap to samr21-xpro
make BOARD=samr21-xpro term     //start pyterm
  • [optional] Reset SAMR21-xpro and change 6LoWPAN settings:
ifconfig 7 set pan_id 0xbeef
ifconfig 7 set channel 13
  • Send a CoAP request to the CoAP server:
coap put fe80::1%7 5683 /send test