Embedded TCP/IP stack  4.3.0
FNET Shell FreeRTOS Wi-Fi Demo Quick Start

Requirements

Tools used during this quick start:

Step by step

Follow these steps to run the FNET Shell demo application:

  • Prepare your evaluation board according to your board User Manual.
  • Use USB or RS-232 male/female DB-9 serial cable to connect your PC (through COM port) to the evaluation board.
  • You may connect the evaluation board to an Ethernet network, but it is not required if you are going to use Wi-Fi only interface.
  • Power the board up.
  • Invoke the terminal program on the PC to which the evaluation board is connected and configure it to:
    • Bits per second: 115200.
    • Data bits: 8.
    • Parity: none.
    • Stop bits: 1.
    • Flow control: None.


      fnet_serial_setup.jpg
      Serial port setup
  • Launch IDE.
  • Open the project:
    fnet\fnet_demos\build\<board_name>\shell_mbedtls\<compiler_name>\
    
    Note
    So far, it is was tested only with frdmk64f board.
  • In the IDE, choose a project target you want to compile.
  • Compile, load (or flash) the application to the board and run the project.
  • In your terminal program window you should see the FNET application welcome message:
    [FREERTOS] Starting scheduler.
    
    ************************************************
     FNET Shell Application (FreeRTOS-WIFI)
    ************************************************
     FNET TCP/IP Stack for MK64FN1
     Version 4.0.0
     Built Oct 27 2017 at 13:18:30 by IAR
    
     Enter '?' for command list.
    ************************************************
    [QCA] Initialized
    [QCA] Firmware version 3.3.5.9999
    [FAPP] Application parameters loaded from Flash.
    SHELL>
    
  • If you have connected the Ethernet interface to a local link, you should see in the terminal window:
    [LINK] eth0: connected => Script: dhcpc autoip -n eth0; mdns -n eth0; llmnr -n eth0;
    ************************************************
     DHCPv4 Client started.
     Interface            : eth0
    ************************************************
    Press [Ctr+C] to cancel.
    [DHCP] Discovering...
    
    ************************************************
     IPv4 parameters updated :
    ************************************************
    Ethernet Interface:
     Name                 : eth0
     ScopeID              : 1
     Media State          : connected
     IPv4 Address         : 192.168.0.102 <dhcp>
     IPv6 Address         : fe80::211:22ff:fe33:4455 <autoconfigurable>
     IPv4 Subnet mask     : 255.255.255.0
     IPv4 Gateway         : 192.168.0.1
     IPv4 DNS             : 192.168.0.1
     DHCP Client          : on
     DHCP Server Address  : 192.168.0.1
     AUTOIP Service       : off
     LLMNR Server         : off
     MDNS Server          : off
    
    ************************************************
     mDNS server started.
     Interface            : eth0
     Host Name            : fnet
    ************************************************
    ************************************************
     LLMNR server started.
     Interface            : eth0
     Host Name            : fnet
    ************************************************
    SHELL>
    
  • This application has absolutely the same features and behavior as the Shell demo application. So before next steps, read about it in FNET Shell Demo Quick Start.
    In addition this demo has Wi-Fi specific shell commands:
    >   connect [<ssid> [<passphrase>]]            - Connect to Wi-Fi access point
    >disconnect                                    - Turn off the Wi-Fi interface radio
    >        ap [<ssid> [<passphrase> [wpa|wpa2]]] - Turn on Wi-Fi Access Point
    
  • You may get an information about all initialized network interfaces by typing the info command into your terminal program window.
    In your terminal program window you should see:
    SHELL> info
    Wi-Fi Interface <default>:
     Name                 : wifi
     ScopeID              : 2
     Media State          : disconnected
     IPv4 Address         : 0.0.0.0 <manual>
     IPv6 Address         : fe80::865d:d7ff:fe49:e5a <autoconfigurable>
     IPv4 Subnet mask     : 0.0.0.0
     IPv4 Gateway         : 0.0.0.0
     IPv4 DNS             : 0.0.0.0
     DHCP Client          : off
     AUTOIP Service       : off
     LLMNR Server         : off
     MDNS Server          : off
    
    Ethernet Interface:
     Name                 : eth0
     ScopeID              : 1
     Media State          : connected
     IPv4 Address         : 192.168.0.102 <dhcp>
     IPv6 Address         : fe80::211:22ff:fe33:4455 <autoconfigurable>
     IPv4 Subnet mask     : 255.255.255.0
     IPv4 Gateway         : 192.168.0.1
     IPv4 DNS             : 192.168.0.1
     DHCP Client          : on
     DHCP Server Address  : 192.168.0.1
     AUTOIP Service       : off
     LLMNR Server         : on
     MDNS Server          : on
    
    Services:
     HTTP Server          : off
     TELNET Server        : off
    SHELL>
    
  • So far, the Wi-Fi media interlace is disconnected.
  • The Wi-Fi interface supports Station or Access Point modes.
  • To start Wi-Fi connection in the station mode, try
    connect [<ssid> [<passphrase>]] 
    . Use your Wi-Fi router SSID name and a pass-phrase if it is secured by WPA/WPA2.
    In your terminal program window you should see:
    SHELL> connect test password
    [QCA] (MODE) Station
    [QCA] Scanning for SSID "test"...
    [QCA] Scan result count:1
             ssid = test
             bssid = 0:18:e7:8c:45:26
             channel = 11
             indicator = 22
             security = YES
             RSN/WPA2=  { PSK } { AES }
             WPA=  { PSK } { AES }
    [QCA] Connecting to "test"...
    SHELL> [QCA] (EVENT) CLIENT connected
    [QCA] (EVENT) 4 way handshake success
    
    [LINK] wifi: connected => Script: dhcpc autoip -n wifi; mdns -n wifi; llmnr -n wifi;
    ************************************************
     DHCPv4 Client started.
     Interface            : wifi
    ************************************************
    Press [Ctr+C] to cancel.
    [DHCP] Discovering...
    
    ************************************************
     IPv4 parameters updated :
    ************************************************
    Wi-Fi Interface <default>:
     Name                 : wifi
     ScopeID              : 2
     Media State          : connected
     Wi-Fi mode           : station
     IPv4 Address         : 192.168.0.105 <dhcp>
     IPv6 Address         : fe80::865d:d7ff:fe49:e5a <autoconfigurable>
     IPv4 Subnet mask     : 255.255.255.0
     IPv4 Gateway         : 192.168.0.1
     IPv4 DNS             : 192.168.0.1
     DHCP Client          : on
     DHCP Server Address  : 192.168.0.1
     AUTOIP Service       : off
     LLMNR Server         : off
     MDNS Server          : off
    
    ************************************************
     mDNS server started.
     Interface            : wifi
     Host Name            : fnet
    ************************************************
    ************************************************
     LLMNR server started.
     Interface            : wifi
     Host Name            : fnet
    ************************************************
    SHELL>
    
  • The <ssid> and <passphrase> arguments of the connect shell command may be omitted. By default, they are defined by the "ssid" and "passphrase" application parameters.
    SHELL> get
        ...
     ssid    : test
     passphrase: password
    
    Their initial values are defined by the FAPP_CFG_PARAMS_WIFI_SSID and FAPP_CFG_PARAMS_WIFI_WPA_PASSPHRASE configuration parameters.
  • To start Wi-Fi access point, try
    ap [\<ssid\> [\<passphrase\> [wpa|wpa2]]] 

    In your terminal program window you should see:
    SHELL> ap
    [QCA] (MODE) Access Point
    ************************************************
     Switching to Wi-Fi access point mode:
     SSID                 : FNET
     Passphrase           :
    ************************************************
    SHELL> [QCA] (EVENT) AP connected
    
    [LINK] wifi: connected => Script: dhcp -n wifi; mdns -n wifi; llmnr -n wifi;
    ************************************************
     DHCPv4 server started.
     Interface            : wifi
    ************************************************
    ************************************************
     mDNS server started.
     Interface            : wifi
     Host Name            : fnet
    ************************************************
    ************************************************
     LLMNR server started.
     Interface            : wifi
     Host Name            : fnet
    ************************************************
    
  • The application starts DHCPv4 server automatically for Wi-Fi access point mode.
  • After that, you may connect to "FNET" Wi-Fi access point.
  • You may print the DHCPv4 server address pool status using "dhcp pool" command:
    SHELL> dhcp pool
     DHCPv4 Server Pool:
            [0] 192.168.0.2 = 2c:0e:3d:40:1d:bf (44 sec)
    

    - To turn off the Wi-Fi interface radio use the disconnect shell command. In your terminal program window you should see:
    SHELL> disconnect
    SHELL> [QCA] (EVENT) AP disconnect
    
    [LINK] wifi: disconnected => Script: dhcp -n wifi release; llmnr -n wifi release; dhcpc -n wifi release;
    SHELL>
    
  • There is possibility to update the the Wi-Fi module firmware to the latest version. Set FNET_CFG_CPU_WIFI_FW_UPDATE to 1, in the project fnet_user_config.h.
    After that you may try the fw shell command. In your terminal program window you should see:
    SHELL> fw
    Wi-Fi FW update. Do not turn off...
    Wi-Fi FW update is completed
    
    The firmware binary is placed in the
    fnet/third_party/qca-x.x.x/flashotp_x_x_x.h 
Note
  • The application project includes QCA4002/4 SDK, with some modifications and fixes to support on-chip stack. Its source code is located in fnet/third_party/qca-x.x.x/.
  • The Wi-Fi interface connect/disconnect scripts, in the access point operation mode, are defined by FAPP_CFG_LINK_CONNECT_WIFI_ACCESS_POINT_SCRIPT and FAPP_CFG_LINK_DISCONNECT_WIFI_ACCESS_POINT_SCRIPT.
  • The DHCPv4 server interface address parameters are defined by FAPP_CFG_DHCP_CMD_IP4_ADDR, FAPP_CFG_DHCP_CMD_IP4_MASK, FAPP_CFG_DHCP_CMD_IP4_GW and FAPP_CFG_DHCP_CMD_IP4_DNS.

© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net