为了一个项目刚接触不到两三天,网上查了一些例子,然后还是比较模糊,所以想请教一下。
本人QQ:2454008481.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
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.
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
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.
Refer to the main.c file of the reference application for more details
None.
比如官方的get wearther的例子,就是连接一个天气服务器获取天气信息,可参考。
http://processors.wiki.ti.com/index.php?oldid=184797
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 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>:
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.
WEP connectivity is not tested with this application.