[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!

  • Hi Sid,

    I have taken a look at your implementation using Linux as host and it looks amazing

    I am working on an idea which consists of having 2 WiSUN network interfaces on a linux system and making a virtual bridge, just like a VLAN to increase the capacity of connections within a network, this involves using 2 WiSUN networks and joining them together through software.

    Everything has been going well using wfantund but my limitation at this point is that the node + linux does not receive notification when I enter a wisun network before sending the set stack up true command, I would like to analyze the possibility of being able to send this command without having to wait for it to enter the Border router network.

    do you have any advice on how to continue with the approach to a wisun network switch?

  • If you do not touch the bottle, how do you sense its temperature?!?  Laughing

  • Please show examples of uploading meta data from router node to border router.

  • Hi Juan,

    how is the project going? Could you resolve this?

    In general the device state is changing in wfantund once the router node joined the network. You could implement a callback that is triggered for every state change and send the stack:up command automatically once you reach the joined state. 

    Kind regards,
    Theo