Skip to content

Latest commit

 

History

History
711 lines (401 loc) · 21.7 KB

ti_wisun_commands.md

File metadata and controls

711 lines (401 loc) · 21.7 KB

TI Wi-SUN FAN Wfantund NCP Properties

wfanctl is based on wpanctl and supports the following TI Wi-SUN FAN Commands:


List of all NCP Commands

  • get

  • set

  • status


List of GET Commands to GET NCP Properties


  • get NCP:ProtocolVersion

    Description:
    Major and Minor version of the protocol. Only Supported value = 1.0

    Expected Result:

    Wi-SUNFAN/87.105





  • get NCP:Version

    Description:
    Describes the firmware currently running on the NCP.

    STACK-NAME/STACK-VERSION[BUILD_INFO][; OTHER_INFO]; BUILD_DATE_AND_TIME

    Expected Result:
    TIWISUNFAN/1.0.1; RELEASE; <Date and Time>

    Sample Output:

    TIWISUNFAN/1.0.1; RELEASE; Jun 10 2021 21:58:51





  • get NCP:InterfaceType

    Description:
    Identifies the network protocol for the NCP . Will always return 4 (Wi-SUN FAN)

    Expected Result:

    NCP:InterfaceType=4





  • get NCP:HardwareAddress

    Description:
    Eight byte HW Address (EUI-64)

    Expected Result:
    NCP:HardwareAddress = [<HardwareAddressOfYourDevice>]

    Sample Output:

    NCP:HardwareAddress = [00124B0014F7D2E6]





  • get NCP:CCAThreshold

    Description:
    Value will be rounded to the nearest supported value

    Expected Result:

    NCP:CCAThreshold = -60





  • get NCP:Region

    Description:
    1 - NA, 2 - JP, 3 - EU, 7 - BZ

    Expected Result:

    NCP:Region = "1: North-America"





  • get NCP:ModeID

    Description:
    Supported values (1-7) (If a PHY Mode Id is not supported
    for the chosen Region--> an PROP_LAST_STATUS will be thrown with INVALID_PARAMETER)

    Expected Result:

    NCP:ModeID = 2





  • get unicastchlist

    Description:
    Bit Mask of Max size 17 bytes (129 channels) --> Each bit
    represents if the channel is present or not

    Expected Result:
    unicastchlist = "<channellist>"

    Sample Output:

    unicastchlist = "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:01"

    More details on this command are listed below.




  • get broadcastchlist

    Description:
    Bit Mask of Max size 17 bytes (129 channels) --> Each bit
    represents if the channel is present or not

    Expected Result: broadcastchlist = "<channellist>"

    Sample Output:

    broadcastchlist = "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:01"

    More details on this command are listed below.




  • get asyncchlist

    Description:
    Bit Mask of Max size 17 bytes (129 channels) --> Each bit
    represents if the channel is present or not

    Expected Result:
    asyncchlist = "<channellist>"

    Sample Output:

    asyncchlist = "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:01"

    More details on this command are listed below.




  • get chspacing

    Description:
    Channel spacing in MHz. (If a channel spacing is not
    supported for the chosen Region/PhyModeId --> an PROP_LAST_STATUS will be thrown with INVALID_PARAMETER)

    Expected Result:

    chspacing ="200 kHz"





  • get ch0centerfreq

    Description:
    Channel 0 Center frequency structure with value{Ch0-MHz, Ch0-KHz}. For example a ch0 center frequency of 902.2 MHz will be encoded as a structure of {902,200}

    Expected Result:

    ch0centerfreq = "{902 MHz, 200 kHz}"





  • get Network:panid

    Description:
    MAC PAN Id of the device. For Wi-SUN Network, this needs to
    be set only of the Border Router. Router device will select network based on Network Name.

    Expected Result:

    Network:panid = 0xABCD





  • get bcdwellinterval

    Description:
    Broadcast Dwell Interval (0 - 255 ms)

    Expected Result:

    bcdwellinterval = 255





  • get ucdwellinterval

    Description:
    Unicast Dwell Interval (0 - 255 ms)

    Expected Result:

    ucdwellinterval = 255







  • get bcinterval

    Description:
    Broadcast Interval (0 - 0xFFFFFF ms)

    Expected Result:

    bcinterval = 1020





  • get ucchfunction

    Description:
    0 - Fixed, 1 - Hopping based on DH1CF (others are reserved)

    Expected Result:
    ucchfunction = <unicastchfunction>

    Sample Output:

    ucchfunction = 2

    More details on this command are listed below.




  • get bcchfunction

    Description:
    0 - Fixed, 1 - Hopping based on DH1CF (others are reserved)

    Expected Result:
    bcchfunction = <broadcastchfunction>

    Sample Output:

    bcchfunction = 2

    More details on this command are listed below.




  • get macfilterlist

    Description:
    When read, it provides an array of EUI Address.
    CMD_VALUE_INSERTED return value of EUI-64 inserted or "all zeros" to inform that operation failed.

    Expected Result:
    List of all devices specified in macfilter list.
    If nothing has been set, this should return an empty string.
    If the hardware address of various nodes have been added to the allow list
    or deny list, a sample output would look like the following:

    macfilterlist = "
    00124B0014F7D2E6
    nextaddress
    nextaddress2...
    "






  • get macfiltermode

    Description:
    0 - Disabled, 1 - Allow List, 2 - Deny List

    Expected Result:

    macfiltermode = 0





  • get Interface:Up

    Description:
    Network interface up/down status. Non-zero (set to 1) indicates up,

    zero indicates down. (Equivalent of Start/Init)

    Expected Result:

    Interface:Up = true
    or
    Interface:Up = false

    if interface has not yet been started.

    More details on this command are listed below.




  • get Stack:Up

    Description:
    Wi-SUN stack operational status. Non-zero (set to 1) indicates up, zero indicates down

    Expected Result:

    Stack:Up = true
    or
    Stack:Up = false
    if stack has not yet been started.

    More details on this command are listed below.




  • get Network:NodeType

    Description:
    Indicates router or border router (0 - Border Router; 1 - Router)

    Expected Result:

    Network:NodeType = "0 : Border Router"
    for Border router, or
    Network:NodeType = "1 : Router"
    for Router




  • get Network:Name

    Description:
    UTF8 encoded string of max size 32 bytes, represents the network name that is used
    for Router to select the Border Router to connect to.

    Expected Result:

    Network:Name = "Wi-SUN Network"





  • get dodagroutedest

    Description:
    IPv6 address of the destination to which a PROP_DODAG_ROUTE can be called to get the
    path from border router.

    Expected Result: dodagroutedest = "<ip address of destination node>"

    Sample Output:

    dodagroutedest = "2020:abcd:0000:0000:0212:4b00:14f8:2b18"





  • get dodagroute

    Description:
    Can be used by Border router HOST to read the entire path specific to a device. This
    is the only property where the Host is expected to specify a value for the "CMD_VALUE_GET" command.
    Border Router HOST should specify the PathCost as "0 (UInt16)" and specify the target device "IPAddress"
    NCP will return the Path Cost and the array of IPv6 address that serves as current PATH for downlink
    messages to the target device

    If no DODAG route exists, then NCP will return with PathCost = 0 and the specified target IPAddress Sample Output:


    dodagroute = "
     2020:abcd:0000:0000:0212:4b00:14f7:d2e6
     2020:abcd:0000:0000:0212:4b00:14f7:2add
     2020:abcd:0000:0000:0212:4b00:14f7:db18
     "






  • get numconnected

    Description:
    Returns the number of nodes currently in the network.

    Expected Result:

    numconnected = 2





  • get connecteddevices

    Description:
    Provides a list of all the IP Addresses currently in the Border Router's routing table, along with the number of connected devices.

    Expected Result:

    connecteddevices = "
    List of connected devices currently in routing table:
    2020:abcd:0000:0000:0212:4b00:14f7:2add
    2020:abcd:0000:0000:0212:4b00:14f7:db18
    Number of connected devices: 2
    "





  • get IPv6:AllAddresses

    Description:
    Array of structures containing:

    • "6": IPv6 Address

    • "C": Network Prefix Length

    • "L": Valid Lifetime

    • "L": Preferred Lifetime

    • "C": Flags

    Expected Result:

    IPv6:AllAddresses = [
    "2020:abcd:0000:0000:0212:4b00:14f7:d2e6" prefix_len: 64 origin:ncp valid:7198 preferred:3598
    "fe80::212:4b00:17f7:d2e6" prefix_len: 64 origin:ncp valid:forever preferred:forever
    ]


List of SET Commands to SET NCP Properties




  • set NCP:CCAThreshold 0

    Description:
    Value will be rounded to the nearest supported value

    Expected Result:

    NCP:CCAThreshold = 0





  • set unicastchlist 7-15:120-128

    Description:
    Bit Mask of Max size 17 bytes (129 channels) --> Each bit
    represents if the channel is present or not

    Then, after calling set unicastchlist, to see the new value for unicast channel list, call get unicastchlist and it should return the following: Expected Result:
    unicastchlist = "<channellist>"

    Sample Output:

    unicastchlist = "80:ff:00:00:00:00:00:00:00:00:00:00:00:00:00:ff:00"

    More details on this command are listed below.




  • set broadcastchlist 0-57:79-102

    Description:
    Bit Mask of Max size 17 bytes (129 channels) --> Each bit
    represents if the channel is present or not

    After calling set broadcastchlist, call get broadcastchlist to see the updated values:

    Expected Result: broadcastchlist = "<channellist>"

    Sample Output:

    broadcastchlist = "ff:ff:ff:ff:ff:ff:ff:03:00:ff:ff:7f:00:00:00:00"

    More details on this command are listed below.




  • set asyncchlist 1-129

    Description:
    Bit Mask of Max size 17 bytes (129 channels) --> Each bit
    represents if the channel is present or not

    Expected Result:
    asyncchlist = "<channellist>"

    Sample Output:

    asyncchlist = "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:01"

    More details on this command are listed below.




  • set Network:panid 0xDEED

    Then call get Network:panid:
    Description:
    MAC PAN Id of the device. For Wi-SUN Network, this needs to
    be set only of the Border Router. Router device will select network based on Network Name.

    Expected Result:

    Network:panid = 0xDEED





  • set bcdwellinterval 0

    Description:
    Broadcast Dwell Interval (0 - 255 ms)

    Expected Result:

    bcdwellinterval = 0





  • set ucdwellinterval 255

    Description:
    Unicast Dwell Interval (0 - 255 ms)

    Expected Result:

    ucdwellinterval = 255


  • set bcinterval 1020

    Description:
    Broadcast Interval (0 - 0xFFFFFF ms)

    Expected Result:

    bcinterval = 1020





  • set ucchfunction 2

    Description:
    0 - Fixed, 1 - Hopping based on DH1CF (others are reserved)

    Expected Result:
    ucchfunction = <unicastchfunction>

    Sample Output:

    ucchfunction = 2

    More details on this command are listed below.




  • set bcchfunction 0

    Description:
    0 - Fixed, 1 - Hopping based on DH1CF (others are reserved)

    Expected Result:

    bcchfunction = 

    Sample Output:

    bcchfunction = 0

    More details on this command are listed below.




  • add macfilterlist 2020abcd21124b00
    would insert this extended address value into the filterlist.
  • remove macfilterlist 2020abcd21124b00
    would remove this extended address value out of the filterlist.

    Description:
    After inserting or removing from macfilterlist, get macfilterlist can be called to obtain the contents of the list.
    When read, it provides an array of EUI Addresses.
    CMD_VALUE_INSERTED returns a value of EUI-64 inserted or "all zeros" to inform that operation failed.

    Expected Result:

    List of all devices specified in macfilter list. If nothing has been set, this should return an empty string.
    If the hardware address of various nodes have been added to the allow list
    or deny list, a sample output would look like the following:

    macfilterlist = "
    extaddr1
    extaddr2
    extaddr3
    "





  • set macfiltermode 1

    Description:
    0 - Disabled, 1 - Allow List, 2 - Deny List

    Then call get macfiltermode:
    Expected Result:

    macfiltermode = 1





  • set Interface:Up true

    Description:
    Network interface up/down status. Non-zero (set to 1) indicates up,

    zero indicates down. (Equivalent of Start/Init)

    Expected Result:

    Interface:Up = true
    or
    Interface:Up = false

    if interface has not yet been started.

    More details on this command are listed below.




  • set Stack:Up true

    Description:
    Wi-SUN stack operational status. Non-zero (set to 1) indicates up, zero indicates down

    Expected Result:

    Stack:Up = true
    or
    Stack:Up = false
    if stack has not yet been started.

    More details on this command are listed below.




  • set Network:Name "Your Wi-SUN Network"

    Description:
    UTF8 encoded string of max size 32 bytes, represents the network name that is used
    for Router to select the Border Router to connect to.

    Expected Result:

    Network:Name = "Your Wi-SUN Network"





  • set dodagroutedest 2020:abcd:0000:0000:0212:4b00:14f8:2b18

    Description:
    IPv6 address of the destination to which a PROP_DODAG_ROUTE can be called to get the
    path from border router.

    Expected Result: dodagroutedest = "<ip address of destination node>"

    Sample Output:

    dodagroutedest = "2020:abcd:0000:0000:0212:4b00:14f8:2b18"


Running the Basic Example

To start wfantund, use this command:

sudo /usr/local/sbin/wfantund -o Config:NCP:SocketPath /dev/ttyACM0 -o Config:TUN:InterfaceName wfan0

A successful start of wfantund should look something like this:

wpantund[2518]: Starting wpantund 0.08.00d (Aug 9 2021 08:08:26) . . .
wpantund[2518]: SOURCE_VERSION = 0.07.01-361-g4b7cbb3-dirty
wpantund[2518]: BUILD_VERSION = 0.07.01-365-ga1c331c-dirty
wpantund[2518]: Configuration file "/etc/wpantund.conf" read.
wpantund[2518]: Ready. Using DBUS bus ":1.101"
wpantund[2518]: Running as root without dropping privileges!
wpantund[2518]: [-NCP-]: Stack is not up
wpantund[2518]: State change: "uninitialized" -> "offline"
wpantund[2518]: NCP is running "TIWISUNFAN/1.0.0; RELEASE; Aug 6 2021 17:45:13"
wpantund[2518]: Driver is running "0.08.00d (0.07.01-361-g4b7cbb3-dirty/0.07.01-365-ga1c331c-dirty; Aug 9 2021 08:08:26)"
wpantund[2518]: [-NCP-]: Interface is not up
wpantund[2518]: [-NCP-]: Stack is not up
wpantund[2518]: Resetting interface(s). . .
wpantund[2518]: Finished initializing NCP

After starting up wfantund, the network should be available via the software-assigned ip address, and hence can be seen when running

ifconfig -a


To run wfanctl, use this command:


sudo /usr/local/bin/wfanctl

When making edits to wfantund or wfanctl OR when starting up, please run the following commands from the Installation and Run Guide:

sudo make
sudo make install



Command Examples:

set ucchfunction <unicastchfunctionvalue>

This command would set the unicast channel function based on the specified value.

set ucchfunction 1
would set the unicast channel function to 1 (hopping).


set ucchfunction 0
would set the unicast channel function to 0 (fixed).


set unicastchlist 

Running the command

set unicastchlist 0-56:72-95
means that the unicast channel list is set to all channels from 0 through 56, excluding channels 57 through 71, and including channels 72 through 95.

If only one channel is desired, call this command with a single value like so:

set unicastchlist 1



Likewise,

set broadcastchlist 1
means that the broadcast channel list used is set to a fixed channel of 1.
set broadcastchlist 17-85:97-120
means that the broadcast channel list is set to all channels from 17 through 85, excluding

86 to 96, and including 97 to 120.

set asyncchlist 

works exactly the same way and can be called like so in the hopping case:

set asyncchlist 0-60:72-84

or like

set asyncchlist 1
to signify a fixed channel of 1.



Forming Network Topology and Configuring Mac Filter Lists

An allow list example:

set macfiltermode 1
add macfilterlist 2020abcd21124b00

This would first set the macfilter mode to 1 (allow list), and then insert the extended address value of 2020abcd21124b00 into the allow list.

A deny list example:

set macfiltermode 2
add macfilterlist 2020abcd21124b00

This would first set the macfilter mode to 2 (deny list), and then insert the extended address value of 2020abcd21124b00 into the deny list.


If the allow list is used, the border router can ONLY communicate with the devices listed in the allow list.
Likewise, if the deny list is used, the border router can ONLY communicate with the devices if they are not in the deny list.



Starting Up the Network

In order for nodes to connect to the border router, both the interface and the stack must be turned on.

Example:

set interface:up true
set stack:up true

This will kickstart the border router based on your configurations and nodes can begin to connect.

  • The general recommendation after starting up the network is to wait up to 5 minutes for nodes to begin connecting, then run
    get connecteddevices
    to see the list of IP addresses of the nodes in the table.
    Then, using the ip addresses from the connecteddevices list, you can individually ping each of the router nodes following the instructions in the last section.



Obtaining the dodag route for a particular node

By using the

set dodagroutedest 
command, the full dodag connection path from the Border Router to this specific node can be obtained.

For example,

set dodagroutedest 2020:abcd:0000:0000:0212:4b00:14f7:db18
sets db18 device as the destination node to obtain the dodag route from.
Next,
get dodagroute
can be called, and will return a list of ip addresses from Border Router to the selected node to display the overall topology for that particular node.

The sample output looks something like the following:

2020:abcd:0000:0000:0212:4b00:14f7:d2e6
2020:abcd:0000:0000:0212:4b00:14f7:2add
2020:abcd:0000:0000:0212:4b00:14f7:db18

The first device in the list displayed is the Border Router.

This output signifies that the first device, Border Router (d2e6) is a direct link to Router device (2add) and then is connected to the second Router device (db18).

This means that the second Router device (db18) is one hop away from the Border Router.



Pinging the Nodes

After nodes have joined the network:

To perform a ping to any node, in your terminal call:

ping6 -c 10  -I wfan0

This will trigger 10 pings to be sent to your respective IP Address.