samples/net/wpanusb/README.html · samples/net/wpanusb/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Networking · WPAN

802.15.4 USB

Wpanusb kernel driver가 radio를 인식하면 iwpan으로 PAN·address·channel·6LoWPAN interface를 설정합니다.

Official pathsamples/net/wpanusb/README.html
Source filesamples/net/wpanusb/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

USB descriptor와 9줄 Linux setup script를 값까지 그대로 보존합니다.

Radio

IEEE 802.15.4

Host

Linux SoftMAC

Interface

wpan0 · lowpan0

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 36A91B658B6D962DE26777A95052817CACB0F62C574F19FC147DEE4310932B4C
.. zephyr:code-sample:: wpan-usb
   :name: 802.15.4 USB
   :relevant-api: ieee802154 _usb_device_core_api

   Implement a device that exposes an IEEE 802.15.4 radio over USB.

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.
This sample can be found under :zephyr_file:`samples/net/wpanusb` in the
Zephyr project tree.

Requirements
************

- a Zephyr board with supported 802.15.4 radio and supported USB driver
  (such as the :ref:`nrf52840dk_nrf52840` or :ref:`samr21_xpro`)
  connected via USB to a Linux host
- wpanusb Linux kernel driver (in the process of being open sourced)
- wpan-tools (available for all Linux distributions)

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-cc2520.conf`
    This overlay config enables support for CC2520

Build the wpanusb sample for a board:

.. zephyr-app-commands::
   :zephyr-app: samples/net/wpanusb
   :board: <board to use>
   :gen-args: -DEXTRA_CONF_FILE=<overlay file to use>
   :goals: build
   :compact:

Example building for the Nordic nRF52840 Development Kit:

.. zephyr-app-commands::
   :zephyr-app: samples/net/wpanusb
   :board: nrf52840dk/nrf52840
   :goals: build
   :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=000d 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

Part 3

한국어 전문 번역

개요

이 application은 IEEE 802.15.4 radio를 USB로 export하여 Linux 같은 다른 OS에서 사용할 수 있게 합니다. Linux에서는 IEEE 802.15.4 stack을 Linux SoftMAC driver로 구현합니다.

이 sample은 Zephyr project tree의 samples/net/wpanusb에서 찾을 수 있습니다.

요구 사항

  • 지원되는 802.15.4 radio와 USB driver가 있는 Zephyr board. 예를 들어 nRF52840 DK 또는 SAM R21 Xplained Pro를 USB로 Linux host에 연결합니다.
  • wpanusb Linux kernel driver. 공식 원문 작성 시점에는 open source 공개 절차가 진행 중입니다.
  • 모든 Linux distribution에서 이용할 수 있는 wpan-tools.

빌드 및 실행

samples/net/wpanusb directory에는 여러 setup용 configuration file이 있습니다.

  • prj.conf: Standard default configuration이며 native 802.15.4를 지원하는 hardware에서는 단독으로 사용할 수 있습니다.
  • overlay-cc2520.conf: CC2520 지원을 활성화합니다.

Board용 wpanusb sample은 다음과 같이 build합니다.

west build -b <board to use> samples/net/wpanusb -- -DEXTRA_CONF_FILE=<overlay file to use>

Nordic nRF52840 Development Kit용 build 예:

west build -b nrf52840dk/nrf52840 samples/net/wpanusb

Wpanusb kernel driver가 있는 Linux에 연결하면 다음과 같이 인식됩니다.

...
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=000d 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
...

다음 script는 앞에서 언급한 iwpan tool을 사용해 Linux의 network interface를 활성화합니다. PHY를 찾고 PAN ID 0xabcd, short address 0xbeef, channel 26을 설정한 뒤 lowpan0 interface를 만들고 두 interface를 올립니다.

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

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.