forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Linux802.15.4
Paul Sokolovsky edited this page Oct 23, 2017
·
5 revisions
How to configure Linux 802.15.4 interface for interconnectivity to Zephyr.
Reference hardware:
- "ATUSB" dongle on Linux side
- BOARD=frdm_kw41z on Zephyr side
Zephyr side:
samples/net/ieee802154 or samples/net/echo_server (the latter lacks frdm_kw41z config in the mainline so far).
Configuring Linux:
- An older way to configure 802.15.4 interfaces/subsysem is
lowpan-toolspackage (iz, etc. executable). That's what e.g. Ubuntu 16.04 ships. But it's not flexible enough for our use, e.g. it doesn't allow to configure 15.4 channel number and other similar params. - Instead, newer wpan-tools should be used, which allows to configure fine-grained params like above. On distros which lack native package, it can be built from source (tested on Ubuntu 16.04).
- List available phy devices:
iwpan list. - List available 15.4 interfaces:
iwpan dev. - Configure channel to used by default by Zephyr:
sudo iwpan phy phy0 set channel 0 26. - Configure PAN ID to used by default by Zephyr:
sudo iwpan dev wpan0 set pan_id 0xabcd. -
wpan0is an 15.4 interface, not suitable for IP networking directly (one sign of that is that it has 15.4 MTU, ~ 127). For IPv6 networking, we need to wrap it in 6LoWPAN interface:ip link add link wpan0 name lowpan0 type lowpan. Createdlowpan0interface will have the standard IPv6 MTU (1280), can have IPv6 addresses configured, etc. - Make sure that both interfaces are up:
sudo ifconfig wpan0 up, sudoifconfig lowpan0 up. - Configure Zephyr's standard sample IPv6 address:
sudo ip address add 2001:db8::2/64 dev lowpan0 - Verify that the device can be pinged:
ping6 -I lowpan0 2001:db8::1, thenping6 2001:db8::1.
Script for more or less automated setup:
set -ex
PHY=$1
WPAN=$2
if [ -z "$PHY" ]; then
PHY=$(./iwpan phy | awk '/^wpan_phy/ {print $2}')
fi
if [ -z "$WPAN" ]; then
WPAN=$(./iwpan dev | awk '/Interface/ {print $2}')
fi
ifconfig lowpan0 down
ifconfig wpan0 down
./iwpan phy $PHY set channel 0 26
./iwpan dev $WPAN set pan_id 0xabcd
ip link add link wpan0 name lowpan0 type lowpan || true
ifconfig wpan0 up
ifconfig lowpan0 up
ip address add 2001:db8::2/64 dev lowpan0
ping6 2001:db8::1