WPANUSB sample

Overview

This application exports ieee802154 radio over USB to be used in other OSes such as Linux. For Linux, the ieee802154 stack would be implemented using the Linux SoftMAC driver.

Requirements

Building and Running

There are configuration files for various setups in the samples/net/wpanusb directory:

  • prj.conf
    This is the standard default config. This can be used by itself for hardware which has native 802.15.4 support.
  • overlay-cc2520.conf
    This overlay config enables support for CC2520
  • overlay-mcr20a.conf
    This overlay config enables support for MCR20A

Build the WPANUSB sample like this:

# On Linux/macOS
cd $ZEPHYR_BASE/samples/net/wpanusb
mkdir build && cd build
# On Windows
cd %ZEPHYR_BASE%\samples\net\wpanusb
mkdir build & cd build
cmake -GNinja -DBOARD=<board to use> -DCONF_FILE=<config file to use> ..
ninja

Example building for the Nordic nRF52840 Development Kit:

cd $ZEPHYR_BASE/samples/net/wpanusb
mkdir build && cd build
cmake -GNinja -DBOARD=nrf52840_pca10056 ..
ninja run

Example building for the Quark SE C1000 Devboard with TI CC2520 support:

cd $ZEPHYR_BASE/samples/net/wpanusb
mkdir build && cd build
cmake -GNinja -DBOARD=quark_se_c1000_devboard -DCONF_FILE="prj.conf overlay-cc2520.conf" ..
ninja run

When connected to Linux with wpanusb kernel driver, it is recognized as:

...
T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=2fe3 ProdID=0101 Rev=01.00
C:  #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=wpanusb
...

The following script enables the network interface in Linux (uses iwpan tool from above):

#!/bin/sh
PHY=`iwpan phy | grep wpan_phy | cut -d' ' -f2`
echo 'Using phy' $PHY
iwpan dev wpan0 set pan_id 0xabcd
iwpan dev wpan0 set short_addr 0xbeef
iwpan phy $PHY set channel 0 26
ip link add link wpan0 name lowpan0 type lowpan
ip link set wpan0 up
ip link set lowpan0 up