微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > cc3200连接路由器要用那个例程

cc3200连接路由器要用那个例程

时间:10-02 整理:3721RD 点击:

为了一个项目刚接触不到两三天,网上查了一些例子,然后还是比较模糊,所以想请教一下。

本人QQ:2454008481.

用getting_started_with_wlan_station 这个例子。SDK里每个例子都是有文档的。直接按照文档做就好了。

CC32xx Getting Started with WLAN Station

Revision as of 06:58, 8 September 2014 by Jitgupta (Talk | contribs) (→‎Usag)


(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Cc31xx cc32xx return home.png

Cc32xx return sample apps.png

Contents

 [hide] 

  • 1 Overview
  • 2 Application details
    • 2.1 Source Files briefly explained
    • 2.2 Code flow
  • 3 Usag
  • 4 Limitations/Known Issues
  • 5 Links

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 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 ORAGE 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.

这一步我实现了,但是我现在要通过WIFI把TM4C获取的数据通过连接的路由器发送出去(到指定服务器),我应该怎么做。

那就看你的服务器提供怎样的连接方式咯。 TCP, UDP, HTTP. 这些都是有例子的。 

比如官方的get wearther的例子,就是连接一个天气服务器获取天气信息,可参考。

http://processors.wiki.ti.com/index.php?oldid=184797

CC32xx Info Center Get Weather Application

Revision as of 06:04, 8 September 2014 by Jitgupta (Talk | contribs) (→‎Usage)


(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Cc31xx cc32xx return home.png

Cc32xx return sample apps.png

Contents

 [hide] 

  • 1 Overview
  • 2 Application details
  • 3 Source Files briefly explained
  • 4 Usage
  • 5 Limitations/Known Issues
  • 6 Links

Overview

Get Weather application connects to "openweathermap.org" server, requests for weather details of the specified city, process data and displays it on the Hyperterminal. 

Application details

Application connects to a open AP with SSID "cc3200demo". In case the connection to this default AP is unsuccessful, the user is prompted to enter the AP details on the hyperterminal.

The AP details have to be entered in the format as specified below:

<ap_ssid>:<security_type>:<password>:<wep_key_id>:

  • ap_ssid - ssid of the AP to be connected
  • security_type - values 1(for Open) or 2(for WEP) or 3(for WPA)
  • password - network password in case of 2(for WEP) or 3(for WPA)
  • wep_key_id - key ID in case of 2(for WEP)

The RED LED continuously blinks as long as a connection with AP is not established. Once established, the RED LED stays continuously ON. 
The user is prompted to enter the city name of interest to obtain the weather information.

The weather information is then requested from "openweathermap.org" server for the specified city. This is done by opening a TCP socket with
server and sending a HTTP Get request. The response is parsed and the weather information displayed.

Source Files briefly explained

  1. network_if - Common functions to handle connection to AP and FreeRTOS hook functions.
  2. gpio_if - Basic GPIO interface APIs. Used to control the RED LED.
  3. main - Initializes the device, connects to a AP, performs a DNS lookup, open a TCP socket, send a HTTP Get request and displays weather information
  4. pinmux - Assigns a personality to the pins at the device boundary
  5. uart_if - To display status information over the UART
  6. udma_if - Wrapper functions for uDMA module driver
  7. timer_if - Wrapper functions for timer module driver
  8. startup_* - Tool specific vector table implementation

Usage

  1. Setup a serial communication application (HyperTerminal/TeraTerm). For detail info visit CC31xx & CC32xx Terminal Setting
    On the host PC, open a hyperterminal, with the following settings
    • Port: Enumerated COM port
    • Baud rate: 115200
    • Data: 8 bit
    • Parity: None
    • Stop: 1 bit
    • Flow control: None
  2. Run the reference application (Flashing the bin/IAR/CCS).
    • Open the Project as mentioned in the 'docs\CC3200-Getting Started Guide.pdf'.
    • Build and download the application to the board
  3. Application requires the AP to have the internet connectivity.
  4. On the Hyperterminal, in case the connection to this default AP is unsuccessful, the user is prompted to enter the AP details.
  5. The RED LED continuously blinks as long as a connection with AP is not established. Once established, the RED LED stays continuously ON.
  6. The user is prompted to enter the city name.
  7. The weather information of the specified city is displayed if obtained.
  8. When prompted, the user can enter quit to exit the application.
Terminal snapshot when application runs on device:

CC3200_get_weather_terminal_runScreen.png

Limitations/Known Issues

WEP connectivity is not tested with this application.

服务器不用我管,如果我用TCP应该如何搞,或是别的,有没有那个比较详细的教程。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top