wpanusb
is a Linux kernel driver for 802.15.4 USB dongle.
The big picture is shown below:
graph TB
subgraph Linux
direction TB
Applications-->IPv6
IPv6-->6LoWPAN
6LoWPAN-->lmac[802.15.4 MAC]
lmac-->driver[wpanusb driver]
end
subgraph Zephyr
direction TB
app[Zephyr wpanusb]-->zmac[802.15.4 driver]
zmac-->radio[802.15.4 radio]
end
Linux-->|USB| Zephyr
Please note that there are 2 wpanusb
s in the picture:
- Linux kernel driver (driver) which is described here
- Zephyr application (firmware) which is described in Zephyr samples/net/wpanusb
For more information please see my presentation at Embedded Linux Conference Europe, 2019. Writing Your Own Gadget.
- a hardware board with 802.15.4 radio and USB controller supported by Zephyr.
- Zephyr
wpanusb
application (firmware) is flashed to the board - the board is connected to Linux via USB cable
- Make sure you have Linux kernel headers installed
$ ls /lib/modules/`uname -r`/build
- Type make, below is output for the latest Ubuntu
$ make
make -C /lib/modules/`uname -r`/build M=$PWD
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-38-generic'
CC [M] /usr/local/src/ieee802154/wpanusb/wpanusb.o
Building modules, stage 2.
MODPOST 1 modules
CC /usr/local/src/ieee802154/wpanusb/wpanusb.mod.o
LD [M] /usr/local/src/ieee802154/wpanusb/wpanusb.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-38-generic'
You can load driver with insmod given that all dependency are loaded, otherwise use provided modprobe.sh script
$ sudo scripts/modprobe.sh
wpan0 device should appear in the network devices list
There is a script helping to configure 6lowpan address
$ sudo scripts/lowpan.sh
lowpan0 network device should appear and IPv6 address can be checked with
$ ip addr show dev lowpan0
59: lowpan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1
link/[825] 92:05:91:9b:5a:2c:34:41 brd ff:ff:ff:ff:ff:ff:ff:ff
inet6 fe80::9005:919b:5a2c:3441/64 scope link
valid_lft forever preferred_lft forever
There is link local IPv6 address which can be used for ping6
.