Indigo Example Summary

This example demonstrates the extensive networking capabilities of the CC35xx device.

Silo Description
WLAN Includes link layer functions such as scan, connect, etc.

Each silo contains several commands accessible via the command line interface, implemented using the user UART. Any events or application output will be displayed on the UART terminal screen. In the Available Commands section, we will discuss each silo and its commands in greater detail.

Example Usage

The connection should have the following settings:

    Baud-rate:    115200
    Data bits:    8
    Stop bits:    1
    Parity:       None
    Flow Control: None

Once the application completes its initialization and the network processor is up, the application banner will be displayed, showing version details:

******************************************************************
******************     Osprey Quick Track      *******************
*******************      Version x.x.x.x      ********************
******************************************************************

At this point, a menu showing the available commands will be printed, followed by a command prompt, indicating that the application is ready for user input.

Application Overview

Network Terminal is a command-line interface (CLI) application used to demonstrate the networking capabilities of the CC35xx device. It offers a list of commands that are fed to the application via UART, then parsed and dispatched.

The application starts by invoking cmd_prompt(), which polls the UART input for a command. Polling is completed once a carriage return is detected. At this point, cmd_prompt possesses the command name, followed by the user’s choice of parameters. Once the command is obtained, cmd_prompt searches for the user’s command in the global command table, gCmdList. This table stores three entries for each command: the command string, a callback that handles the command, and a menu print callback that prints the help menu.

If the typed command matches a table entry, the handler is dispatched, and the parameters provided by the user are passed to the command callback. All callback functions follow the same naming convention: cmd<command_name>Callback and reside in the appropriate file. For example, all WLAN-related callbacks are implemented in wlan_cmd.c.

Inside each command callback, the first action is to parse the user’s input. This is achieved by calling the corresponding parser function. A structure containing each command’s parameters is also passed to the designated parser and returned filled with the parsed user’s parameters. Later, the parsed structure is handled by the callback. All command parser functions follow the same naming convention: Parse<command_name>Cmd. Parser functions reside in cmd_parser.c.

Once a dispatched callback finishes its run, the application returns to the cmd_prompt function, ready for another input from the user.

Available Commands

================================================================================
Available commands:

help                clear               wlan_ap_role_up     wlan_ap_role_down   
wlan_sta_role_up    wlan_sta_role_down  wlan_connect        wlan_disconnect     
wlan_get_mac        wlan_set_mac        wlan_set_pm         wlan_set_if_ip      
wlan_get_if_ip      wlan_set_dhcp       wlan_get_dhcp       wlan_get_fw_ver     
wlan_start          wlan_stop           set_date_time       get_date_time       
set_peer_aging      p2p_role_up         p2p_role_down       p2p_find            
p2p_connect         p2p_stop_find       p2p_group_remove    p2p_set_channel     
p2p_get_channel     p2p_listen          p2p_cancel          start_ap_wps        
wlan_set_con_policy wlan_get_con_policy wlan_add_profile    wlan_del_profile    
wlan_get_profile    wlan_profile_connectping                ping_stop           
================================================================================

WLAN Commands


wlan_start

This command turns on the WLAN device, initialize the upper MAC thread, and initialize the SPI interface.

Note: This command is called by the main function, and is used only if the user has called the wlan_stop command first.


wlan_stop

This command turns off the WLAN device and deactivates the SPI interface.


wlan_sta_role_up

This command adds and starts the station role on the device:

  1. Adding a new STA netif interface to the network stack.
  2. Adding a new WLAN role ID by dispatching CMD_ROLE_START to the CC35xx device.
Usage: 
        wlan_sta_role_up [-help] 

Description:
        Role up device as STA.

Note: This command is used to start the device in station mode after it is powered on and all modules are initialized.


wlan_sta_role_down

This command removes and finishes the station role on the device:

  1. If the device is connected to an AP, disconnect it from the AP.
  2. Remove the STA netif interface from the network stack.
  3. Remove the STA WLAN role ID by dispatching CMD_ROLE_DISABLE to the CC35xx device.

wlan_connect

This command allows a user to connect to an AP. It receives the following parameters:

  1. SSID (Optional): The requested SSID of the AP. The application expects this parameter to be inside quotation marks (" “).
  2. Security Type: The device supports four modes: [OPEN, WPA2, WPA3, WPS].
  3. Password (Optional): The application expects this parameter to be inside quotation marks (" “).

When one of the [OPEN, WPA2, WPA3] Security Types is given, the connection is based on the SSID parameter, and hence this parameter is required. However, for [WPS], the SSID parameter is not allowed.

Usage: 
  wlan_connect [-help] [-s <"ssid name">] [-t <security type>] [-p <"password">]
    -s      SSID
    -t      Type of security (security type = [OPEN, WPA/WPA2])
    -p      Password in ASCII characters 

Note: This command is blocking, and the timeout is configured by WLAN_EVENT_TOUT in wlan_cmd.c. For WPS, the timeout is two minutes.

  1. WLAN_EVENT_CONNECT: This event signals that the device is connected to an AP. It also prints details about the connected AP, such as SSID and BSSID. Please refer to WlanEventHandler() implemented in network_terminal.c for more info.
  2. WLAN_EVENT_DISCONNECT: If the device is already connected to an AP, it will disconnect from the old one before attempting to connect to the requested AP. The disconnect reason code will be: WLAN_DISCONNECT_USER_INITIATED. Please refer to WlanEventHandler() implemented in network_terminal.c for more info.

Example:

wlan_connect -s "myhome network" -t WPA2 -p "password" 

wlan_disconnect

This command allows a user to disconnect from an AP, if currently connected to one.


wlan_get_mac

This command allows a user to get the device MAC address. It receives the following parameter:

  1. Role Type: There are two role types available: 0 for Station and 2 for Access Point (AP).
Usage: 
        wlan_get_mac [-help] [-i <RoleType>] 

Description:
        Get MacAddress. role type 0 - STA , 2 - AP 

        -i      RoleType, if role type does not exists error is return

        -help   Display this help

Note: We support STA role, AP role, and Multi role.

Example:

wlan_get_mac -i 0

[MAC ADDRESS] : a8:1b:6a:a9:90:f2

wlan_set_mac

This command allows a user to set the device’s MAC address. It receives the following parameters:

  1. Role Type: There are two role types available: 0 for Station and 2 for Access Point (AP).
  2. MAC Address: The new MAC address.
Usage: 
        wlan_set_mac [-help] [-i <RoleType>] [-m <macAdress>]

Description:
        Set MacAddress. Role type 0 - STA, 2 - AP 

        -i      RoleType, if role type does not exist, an error is returned

        -m      MacAddress, if MAC address is not valid, an error is returned

        -help   Display this help

To apply the changes, you must run wlan_sta_role_down and then wlan_sta_role_up.

Example:

wlan_set_mac -i 0 -m AA:BB:CC:DD:EE:FF

wlan_sta_role_down

wlan_sta_role_up

wlan_get_mac -i 0

[MAC ADDRESS] : aa:bb:cc:dd:ee:ff