[FAQ] LP-CC1352P7: Use Wfantund on a Linux host connected to a TI Wi-SUN FAN Router Node.

Part Number: LP-CC1352P7
Other Parts Discussed in Thread: WI-SUN

Note: This guide assumes you have used the wfantund based solution with a TI Wi-SUN FAN Border Router. If not, please refer to the wfantund Readme and installation guide found here: https://github.com/TexasInstruments/ti-wisunfantund

The Why:

Wfantund is a user space network interface driver that runs on a linux host and provides a native ipv6 interface to a TI Wi-SUN FAN Border Router. This was mainly provided for gateway development.

But, there are some use-cases where linux based processors are necessary even on the nodes. If you are developing one such application, this thread is relevant to you!

In such cases, the following steps and work around can be used to run wfantund on the linux host connected to a TI Wi-SUN FAN Router Node.

The Setup:

1. Import the ns_node project for your device.

2. Replace  the bool is_net_stack_up() function in application.c with the following code.

 /*!
  * Check if the node joined the network or not on starting
  * the connection to network
  * return value: true if connected or connecting, false if not started
  */
 bool is_net_stack_up(void) {

    protocol_interface_info_entry_t *cur;
    cur = protocol_stack_interface_info_get(IF_6LoWPAN);
    
    if (!cur) {
        return false;
    }

    if(ER_IDLE != cur->nwk_bootstrap_state) {
        return true;
    }
    
    return false;
 }

3. Flash Border Router and Router Node devices. Connect them to two different PC or VMs.

4. Start Wfantund and Wfanctl as usual on both Border Router and Router Node.

5. Start the Wi-SUN network on the border router side with the set interface and set stack commands as you normally would, as specified in the wfantund README. (if you want to only test wfantund on router node side, you could use pyspinel on the border router side as described in the wi-sun fan fundamentals simplelink academy lab).

6. Start the RN as follows:

  • Start wfantund and wfanctl
  • In wfanctl, run ONLY set interface:up true on the Router Node

            

  • Wait until the device is joined the border router's network. You can verify this by checking the get connecteddevices property on the Border Router.

           

  • Once the node has joined the border router network, run set stack:up true on the router node

             

Now we have a IPv6 tunnel driver(Wfantund) up and running on the Linux host connected to the Wi-SUN router node,

So, we can now use the Linux host's ping command to ping the border router through the router node!Smiley

Quick Test: 

You can find the border router's ipv6 address with the ipv6addresstable command.

  

You can now ping this address from the Router Node. Open a terminal on Linux and use the ping command.

Now you have communication from a Linux host attached to a TI Wi-SUN FAN Router Node to a TI Wi-SUN FAN Border Router!