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 AP

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

Overview

The SimpleLink CC3200 device can act as an AP (access point). Any Wifi Enabled Client in its range can connect to the device and then communicate as per standard networking protocols.

wlan_ap.jpg


Application details

This application aims to exhibit the CC3200 device as AP. Developers/users can refer the function or re-use them while writing new application.
The device comes up as an AP (access point), and then wait for a station to connect to it. If the connection is successful, it will ping to that station. Zero is the expected return value. A different return code would mean that the ping to the station is unsuccessful.

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 usage CC3200 TI-RTOS

Source Files briefly explained

  • main.c – main file creates the simplelink task which does most of the network related operations, a WlanAPMode task makes calls to the network related APIs of simplelink library.
  • startup_ewarm.c – IAR workbench specific vector table implementation for interrupts.


Code flow

void WlanAPMode( void *pvParameters )
{
...
lRetVal = sl_Start(NULL,NULL,NULL);
...
// Configure the networking mode and ssid name(for AP mode)
if(lRetVal != ROLE_AP)
{
   if(ConfigureMode(lRetVal) != ROLE_AP)
   {
      UART_PRINT("Unable to set AP mode, exiting Application...\n\r");
      sl_Stop(SL_STOP_TIMEOUT);
      LOOP_FOREVER();
   }
}
while(!IS_IP_ACQUIRED(g_ulStatus))
{
   //looping till ip is acquired
}
...
lRetVal = sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO,&ucDHCP,&len,(unsigned char *)&ipV4);
...
while(!IS_IP_LEASED(g_ulStatus))
{
  //wating for the client to connect
}
 
ulIpAddr = g_ulStaIp;
iTestResult = PingTest(ulIpAddr);
...
}

Using the CC3200 as an AP is a simple two step process.

  1. Start the SimpleLink by calling sl_Start() API.
  2. Wait until the device gets an ip address.

After the device has come up in AP mode, we will follow two more steps to make sure the device can act as an AP.

  1. wait for a station to connect to the device (you have to connect a machine to the device).
  2. ping to the machine (station).

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

Note 1: In case, if the device is not able to ping to the connected machine, try disabling the antivirus on your machine.

Usage

  • Run this application (getting_started_with_wlan_ap) application from IAR/CCS or Flash to the device.
  • Application with switch to AP mode if it's not in AP mode.
  • After client connected to device, device(AP) will ping to client and print the result over UART.
  • All result can be viewed on Terminal screen.
  • Observe the execution flow to understand the working.
Getting Started AP Terminal

Limitations/Known Issues

None.

Links