Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

CC3200 Getting Started with WLAN Station

From Texas Instruments Wiki
Jump to: navigation, search
Cc31xx cc32xx return home.png
Cc32xx return sample apps.png

Overview

A CC3200 device has the capability to behave as a station in a typical networking system (Infrastructure setup). It can connect to access point (with or without security) and can use the internet services via the same access point, if available.

gs_with_wlan_station.jpg


Application details

This application aims to exhibit the CC3200 device as a station in a simple network. Developers/users can refer the function or re-use them while writing new application. The application will be used without the UART terminal. The device connects to an AP (access point), with AP configurations stored in the form of macros in the application. If the connection is successful, it will try to get the IP address of “www.ti.com” and then ping to the ip address. Zero is the expected return value. A different return code would mean that the internet connection is not available or that the ping to the link is not successful.

Macros for Security

#define SSID_NAME              	 "cc3200demo"
#define SECURITY_TYPE         	 SL_SEC_TYPE_OPEN
#define SECURITY_KEY          	 ""
#define WEP_KEY_ID               1

This example can be used either on TI-RTOS or FreeRTOS.

For the application to work with TI-RTOS, ti_rtos project and ti_rtos_config project need to be imported into the application workspace. These projects can be found in CC3200-SDK under ti_rtos folder. Please follow this link for CC3200 TI-RTOS.

Source Files briefly explained

  • main.c – main file creates the simplelink task which does most of the network related operations, a WlanStationMode task makes calls to the network related APIs of simplelink library.
  • startup_ewarm.c – IAR workbench specific vector table implementation for interrupts.
  • startup_ccs.c – IAR workbench specific vector table implementation for interrupts.
  • gpio_if.c - GPIO interface file for LED APIs
  • pinmux.c - File to mux device pin to different peripheral signal.


Code flow

void WlanStationMode( void *pvParameters )
{
    ...
    //Start the SimpleLink
    lMode = sl_Start(0, 0, 0);
    ...
    // Connecting to WLAN AP
    // After this call we will be connected and have IP address */
    WlanConnect();
    ...
    // Checking the Lan connection by pinging to AP gateway
    lRetVal = CheckLanConnection();
    ...
    // Turn on GREEN LED when device gets PING response from AP
    GPIO_IF_LedOn(MCU_EXECUTE_SUCCESS_IND);
    ...
    // Checking the internet connection by pinging to external host
    lRetVal = CheckInternetConnection();
    ...
    // Turn on ORANGE LED when device gets PING response from AP
    GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO);
    ...
}

Using the CC3200 as an STA is a simple three step process.

  1. Start the SimpleLink by calling sl_Start() API
  2. Connect to the Access point by calling sl_WlanConnect() API
  3. Use the sl_NetCfgGet() API or check for SL_NETAPP_IPV4_IPACQUIRED_EVENT NetApp Event to get the IP address of the device.

Refer to the main.c file of the reference application for more details

Usag

  • Run this application (getting_started_with_wlan_sta) application from IAR/CCS or Flash the bin file to device.
  • Device will switch to STA mode if it's in other mode.
  • It'll try to connect open predefined AP (cc3200demo) and at successful connection Red LED will glow up.
  • After AP connection device will ping to AP, at successful ping to AP, Green LED will switch on.
  • Device will further check for internet connection (ping to 'www.ti.com') and at successful ping to external host Orange LED will switch on.
  • Observe the LEDs state and code flow to confirm the proper execution.
Getting Started STA Terminal

Limitations/Known Issues

None.

Links