Code Monkey home page Code Monkey logo

ti-wisunfantund's Introduction

wfantund, Userspace Wireless Field Area Network (WFAN) Network Daemon

wfantund is derived from wpantund which was written and developed by Nest Labs to make supporting Thread connectivity on Unix-like operating systems more straightforward.

wfantund is a user-space network interface driver/daemon that provides a native IPv6 network interface to TI Wi-SUN FAN Border Router operating in Network Processor (NWP) mode.

TI Wi-SUN FAN Solution are supported over TI CC13xx platforms. Refer to https://www.ti.com/wireless-connectivity/wi-sun/overview.html for more details.

TI Wi-SUN FAN embedded software running on TI CC13xx platform can be downloaded from TI CC13xx_26xx SDK (https://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK)

Software provided in this repository provides Linux Application Examples that can run over TI Wi-SUN FAN Border Router NWP software (to be obtained from TI CC13xx_26xx SDK) connected via UART to a Linux Platform.

These examples are meant to be serve as sample application examples to aid in development of a Linux OS based Wi-SUN Border Router custom applications and provide back-end connectivity.

Software can be ported to other embedded Linux platforms to develop WI-SUN FAN based Border router solution. Reference cross compilation support has been provided for TI AM64x SK Platform (https://www.ti.com/tool/SK-AM64).

wfantund is designed to marshall all access to the NCP, ensuring that it always remains in a consistent and well-defined state.

License

wfantund is based on wpantund. wfantund is open-source software released under the Apache License, Version 2.0. See the file LICENSE for more information.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the [License][4] for the specific language governing permissions and limitations under the License.

Compilation and Installation

Linux OS (Ubuntu) Support

Refer to Install.md for compiling and installing wfantund and wfanctl in Ubuntu Linux OS.

Embedded Linux OS Support

Refer to Install_AM64x_sk.md for cross-compiling and installing wfantund and wfanctl for TI AM64x SK (https://www.ti.com/tool/SK-AM64).

Usage Overview

The behavior of wfantund is determined by its configuration parameters, which may be specified in a configuration file (typically /etc/wpantund.conf) or at the command line. A typical configuration file might look like that shown below. For a more thorough explanation of available configuration parameters, see the included example.

# Try to name the network interface `wpan0`.
# If not possible, a different name will be used.
Config:TUN:InterfaceName      "wfan0"

# The pathname of the socket used to communicate
# with the NCP.
Config:NCP:SocketPath         "/dev/ttyUSB0"

# The name of the driver plugin to use. The chosen
# plugin must support the NCP you are trying to use.
Config:NCP:DriverName         "spinel"

# Drop root privileges after opening all sockets
Config:Daemon:PrivDropToUser  "nobody"

Starting wfantund

sudo /usr/local/sbin/wfantund -o Config:NCP:SocketPath `<Serial Port>`
example: sudo /usr/local/sbin/wfantund -o Config:NCP:SocketPath /dev/ttyACM0

Configuring wfantund using wfanctl

When up and running, you can use wfanctl to get or set TI Wi-SUN FAN Parameters

To start wfanctl use

   $ sudo /usr/local/bin/wfanctl 

To get/set properties use the get/set command.

example:

   wfanctl:wfan0> get panid
   0xABCD

The status of TI Wi-SUN Border Router along with some other related information can be obtained using the status command

wfanctl:wfan0> status
wfan0 => [
	"NCP:State" => "offline"
	"Daemon:Enabled" => true
	"NCP:Version" => "TIWISUNFAN/1.0.1; RELEASE; Oct 28 2021 14:02:58"
	"Daemon:Version" => "0.08.00d (0.07.01-380-ge8fc63f-dirty; Nov  2 2021 20:16:55)"
	"Config:NCP:DriverName" => "spinel"
	"NCP:HardwareAddress" => [00124B0014F7D160]
	"Network:NodeType" => "0 : Border Router"
	"Network:PANID" => 0xABCD
]

For detailed list of all supported TI Wi-SUN FAN Command, please refer to ti_wisun_commands.md

The interface and stack can be started using the following commands

   $ sudo wfanctl set interface:up true
   $ sudo wfanctl set stack:up true

Status of Interface can be checked by using the status command.

wfanctl:wfan0> status
wfan0 => [
	"NCP:State" => "associated"
	"Daemon:Enabled" => true
	"NCP:Version" => "TIWISUNFAN/1.0.1; RELEASE; Oct 28 2021 14:02:58"
	"Daemon:Version" => "0.08.00d (0.07.01-380-ge8fc63f-dirty; Nov  2 2021 20:16:55)"
	"Config:NCP:DriverName" => "spinel"
	"NCP:HardwareAddress" => [00124B0014F7D160]
	"Network:NodeType" => "0 : Border Router"
	"Network:PANID" => 0xABCD
]

Note: associated in TI WI-SUN FAN Contest implies that the TI Wi-SUN FAN Border Router has started.

Checking if tun Interface is up.

When the stack is up, the TUN interface will be enabled. It can be verified by checking

$ ifconfig wfan0
wfan0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1280  metric 1
    inet6 fe80::212:4b00:14f7:d160  prefixlen 64  scopeid 0x20<link>
    inet6 2020:abcd::212:4b00:14f7:d160  prefixlen 64  scopeid 0x0<global>
    inet6 fe80::31b1:1233:76ab:d3e5  prefixlen 64  scopeid 0x20<link>

Checking for connected devices

User can check for connected devices using the connecteddevices property

   wfanctl:wfan0> get connecteddevices
   connecteddevices = "
   List of connected devices currently in routing table:
   2020:abcd:0000:0000:0212:4b00:14f7:d102
   2020:abcd:0000:0000:0212:4b00:14f7:d2e8`

Interacting with connected devices

Using the TUN interface, users can directly communicate to devices over IPv6.

Ping specific devices

Users can ping devices using linux ping6 application and wfan0 interface

ping6 -I wfan0 <ip address>

CoAP Application

If TI Wi-SUN FAN CoAP examples are used on router devices using TI CC13x2X7 LPs, then router devices will expose their LEDs as CoAP Services. The LED lights on LPs can be controlled using any Linux COAP Client.

example: Install libcoap-1-0-bin package to get coap-client

Then coap-client can be used to interact with TI CoAP based embedded routers. Sample shell scripts are provided under shell_scripts folder to showcase this. Refer to README.md under shell_scripts to use run_coap_get.sh and run_coap_put.sh.

Webserver Demo

A reference webserver application has been provided under ti_wisun_webapp folder. Recommended to use node.js of version v14.17.6 or higher.

Install all dependent npm packages using: npm install package.json

Preparation of TI CC13xx Images:

Steps to run demo

  • Connect one TI CC13x2R7 with TI Wi-SUN BR Image to Linux PC
  • Start wfantund in webserver mode sudo /usr/local/sbin/wfantund -o Config:NCP:SocketPath /dev/ttyACM0 --webserver
  • Start wfanctl in webserver mode sudo /usr/local/bin/wfanctl --webserver
  • Start webserver node ti_wisunfan_webserver.js
  • Power on one (or few) Wi-SUN FAN Router devices
  • Wi-SUN FAN Router devices will start blinking their Green LED to show that they are trying to join network
  • Rate at which they blink will go down as they connect to network
  • Wi-SUN Router devices will stop blinking after they join the network (Note: It may take around 3-5 min for a node to join)
  • The webserver can be connected to using any standard webbrowser to display the Wi-SUN FAN network as a graph
  • The webserver is designed to interface with TI Wi-SUN FAN CoAP example (ns_node_coap) based router nodes and toggle their LEDs.

User can observer the Topology and Interact with the devices (toggle LEDs)

Feature and Architecture Summary

wfantund based on wpantund provides:

  • ... a native IPv6 interface to an NCP.
  • ... a command line interface (wfanctl) for managing and configuring the NCP.
  • ... a DBus API for managing and configuring the NCP.
  • ... a way to reliably manage the power state of the NCP.
  • ... a uniform mechanism for handling NCP firmware updates.

The architecture and design of wfantund is based on wpantund which has been motivated by the following design goals (in no specific order):

  • Portability across Unix-like operating systems (currently supports Linux. BSD support should be fairly trivial to add)
  • Require few runtime dependencies (DBus, with boost needed when building)
  • Single-threaded architecture, with heavy use of asynchronous I/O
  • Power efficiency (0% CPU usage when idle)
  • Allow management interface to be used by multiple independent applications simultaneously
  • Allow multiple instances of wfantund to gracefully co-exist on a single machine
  • Modular, plugin-based architecture (all details for communicating with a specific NCP stack are implemented as plugins)

Note that Windows is not currently supported, but patches are welcome.

The following NCP plugins are provided:

  • src/ncp-spinel: Modified from those provided by wpantund to support TI Wi-SUN FAN Border Router.
  • src/ncp-dummy: A dummy NCP plug-in implementation meant to be the starting point for implementing new NCP plug-ins

Conceptual Overview

wfantund is based on wpantund and is conceptually similar in purpose to the point-to-point daemon (pppd, commonly used on Unix platforms to provide network connectivity via a dial-up modems) except that instead of communicating with a dial-up modem, wfantund is communicating with an NCP.

wfantund communicates with the NCP via an abstraction of a asynchronous stream socket, which could be any of the following:

  • A real serial port (UART) connected to the NCP (preferably with hardware flow control)
  • The stdin and stdout from a subprocess (for supporting SPI interfaces using a translator program or debugging virtual stacks)
  • A TCP socket (for debugging, not recommended for production)

Unlike a dial-up modem, NCPs often have a rich management interface for performing operations, such as forming a network, joining a network, scanning for nearby networks, etc. To perform these operations, wfantund includes a command line utility called wfanctl. Applications that need to directly configure the network interface can also communicate directly with wfantund using its DBus API.

To expose a native IPv6 network interface to the host operating system, wfantund uses the tun driver on Linux. On Linux, the default name for the interface is wfan0.

If compiled with libreadline or libedit, wfanctl supports an convenient interactive console. All commands support online help: type help to get a list of supported commands, or add -h to a command to get help with that specific command.

Support

Submit bugs and feature requests to https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum

Authors and Contributors

The following people have significantly contributed to the design and development of wfantund: Texas Instruments Inc

wpantund Authors

  • Robert Quattlebaum
  • Marcin Szczodrak
  • Vaas Krishnamurthy
  • Arjuna Siva
  • Abtin Keshavarzian

ti-wisunfantund's People

Contributors

abtink avatar ackermanc avatar aeliot avatar ankuns avatar bukepo avatar camsovti avatar chshu avatar d-bahr avatar darconeous avatar dgowri avatar eugenegonzalez avatar fivedimensions avatar giedriusm avatar gjc13 avatar henryrlee avatar josephn123 avatar jwhui avatar kbogucki avatar konradderda avatar librasungirl avatar lmaciejonczyk avatar mszczodrak avatar piotrkoziar avatar robszewczyk avatar sjlongland avatar smides-nest avatar vyrastas avatar xpawan avatar zhangle2016 avatar zhanglongxia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.