zephyr/samples/net/wpanusb
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
..
src net: config: Rename Kconfig options to correspond to library name 2018-08-13 18:42:31 -07:00
CMakeLists.txt cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts 2018-08-15 04:06:50 -07:00
overlay-cc1200.conf net: config: Rename Kconfig options to correspond to library name 2018-08-13 18:42:31 -07:00
overlay-cc2520.conf net: config: Rename Kconfig options to correspond to library name 2018-08-13 18:42:31 -07:00
overlay-mcr20a.conf net: config: Rename Kconfig options to correspond to library name 2018-08-13 18:42:31 -07:00
prj.conf net: config: Rename Kconfig options to correspond to library name 2018-08-13 18:42:31 -07:00
README.rst samples: usb: wpanusb: update README to rst format 2018-07-17 11:13:16 +02:00
sample.yaml samples: net: wpanusb: fix sanitycheck 2018-07-17 11:13:16 +02:00
wpan-radio-spec.txt usb: wpanusb: Correct protocol description 2018-04-25 07:17:42 +05:30

.. _wpanusb-sample:

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
************

- a Zephyr WPANUSB enabled board (such as the :ref:`nrf52840_pca10056`)
  connected via USB to a Linux host.
- WPANUSB kernel driver (in the process of being open sourced)
- IWPAN host tools at [http://wpan.cakelab.org/releases/](http://wpan.cakelab.org/releases/)

Building and Running
********************

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

- :file:`prj.conf`
    This is the standard default config.  This can be used by itself for
    hardware which has native 802.15.4 support.

- :file:`overlay-cc1200.conf`
    This overlay config enables support for CC1200

- :file:`overlay-cc2520.conf`
    This overlay config enables support for CC2520

- :file:`overlay-mcr20a.conf`
    This overlay config enables support for MCR20A

Build the WPANUSB sample like this:

.. zephyr-app-commands::
   :zephyr-app: samples/net/wpanusb
   :board: <board to use>
   :conf: <config file to use>
   :goals: build
   :compact:

Example building for the Nordic nRF52840 Development Kit:

.. zephyr-app-commands::
   :zephyr-app: samples/net/wpanusb
   :host-os: unix
   :board: nrf52840_pca10056
   :goals: run
   :compact:

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

.. zephyr-app-commands::
   :zephyr-app: samples/net/wpanusb
   :host-os: unix
   :board: quark_se_c1000_devboard
   :conf: "prj.conf overlay-cc2520.conf"
   :goals: run
   :compact:

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

.. code-block:: console

   ...
   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):

.. code-block:: console

    #!/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