Difference between revisions of "RIOT-OS and IEEE 802.15.4 / 6LoWPAN"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
Line 6: Line 6:


In order to complete these steps, you must have followed [[Riot-OS_Setup]] before.
In order to complete these steps, you must have followed [[Riot-OS_Setup]] before.
* Default 802.15.4 PAN ID of RIOT-OS/SAMR21-xpro: <code>0x23</code>
* Default 802.15.4 channel ID of RIOT-OS/SAMR21-xpro: <code>26</code>


== Configure IEEE 802.15.4 PAN/Channel ID in RIOT ==
== Configure IEEE 802.15.4 PAN/Channel ID in RIOT ==
Line 24: Line 27:


cf. https://github.com/RIOT-OS/RIOT/blob/master/makefiles/default-radio-settings.inc.mk
cf. https://github.com/RIOT-OS/RIOT/blob/master/makefiles/default-radio-settings.inc.mk
* Default 802.15.4 PAN ID of RIOT-OS/SAMR21-xpro: <code>0x23</code>
* Default 802.15.4 channel ID of RIOT-OS/SAMR21-xpro: <code>26</code>


=== OPTIONAL: change HW address via RIOT Shell: ===
=== OPTIONAL: change HW address via RIOT Shell: ===

Revision as of 13:30, 28 November 2023

Summary

Information on how to use RIOT-OS with IEEE 802.15.4 and 6LoWPAN.

Requirements

In order to complete these steps, you must have followed Riot-OS_Setup before.

  • Default 802.15.4 PAN ID of RIOT-OS/SAMR21-xpro: 0x23
  • Default 802.15.4 channel ID of RIOT-OS/SAMR21-xpro: 26

Configure IEEE 802.15.4 PAN/Channel ID in RIOT

Via RIOT Shell:

ifconfig 6 set pan_id 0xbeef
ifconfig 6 set channel 23

Set Channel/PAN ID via Makefile of your application, e.g.:

CFLAGS += -DCONFIG_IEEE802154_DEFAULT_CHANNEL=16
CFLAGS += -DCONFIG_IEEE802154_DEFAULT_PANID=0xcafe

Or for RIOT in general:

/Path/to/RIOT/makefiles/default-radio-settings.inc.mk

cf. https://github.com/RIOT-OS/RIOT/blob/master/makefiles/default-radio-settings.inc.mk

  • Default 802.15.4 PAN ID of RIOT-OS/SAMR21-xpro: 0x23
  • Default 802.15.4 channel ID of RIOT-OS/SAMR21-xpro: 26

OPTIONAL: change HW address via RIOT Shell:

ifconfig 6 set addr_long 02:0:0:0:0:0:0:2

Test 802.15.4/6LoWPAN with RIOT gcoap example

RIOT's gcoap example can be found here: https://github.com/RIOT-OS/RIOT/tree/master/examples/gcoap

README: https://github.com/RIOT-OS/RIOT/blob/master/examples/gcoap/README.md

Flash it on e.g. two SAMR21-xpro devices.

It may be necessary to specify the sending / outgoing interface. This can be done by appending the number of the network interface to the (link-local) IPv6 address (e.g. %6"):

coap get [fe80::d8b8:65ff:feee:121b%6]:5683 /.well-known/core

=> fe80::d8b8:65ff:feee:121b%6 => fe80::[..] is the remote link-local address, but "%6" specifies the local interface ID of node where this command is submitted.

The interface ID is stated when you perform ifconfig on your local node. Normally this interface ID is 6 or 7.

Used Hardware

e.g. Atmel_SAM_R21_Xplained_Pro_Evaluation_Platform

Courses

  • IT-Security master's programme: Mobile and Embedded Security ILV

References