75
 Basic Wifi Application

Wifibooster Maula

Embed Size (px)

DESCRIPTION

Use this tutorial to use wifi modules easily

Citation preview

  • Basic Wifi Application

  • Table of Contents Page

    Prerequisites 3

    Connecting the CC3000 & MSP430 to a PC 4

    Flashing the CC3000 Drivers/Firmware 5

    Flashing the Application to the MSP430 5

    Configuring the Hyperterminal 6

    Running the Application 9

    - SmartConfig Tool for Android 10

    - SmartConfig Tool for iOS 11

    - SmartConfig Tool for a PC 12

    Running SmartConfig on CC3000 13

    Backup

    Detailed Commands 16

    Building the Project in IAR 19

    Building the Project in CCS 29

  • Prerequisites

    Hardware

    1. 1x MSP-EXP430G2 Launchpad, order from TI eStore MSP-EXP430G2 Value Line Development Kit

    2. 1x CC3000BOOST, orderable from the TI eStore

    3. 1x Wi-fi Access Point

    Software

    1. Download and Install the MSP430 Launchpad UART Drivers (Only needed if CCS or IAR is not installed on PC)

    2. Download and Install the Patch programmer installer for Launchpad - MSP430G2553

    3. Download and Install the Launchpad - MSP430G2553 Basic Wi-Fi Application (SDK x.xx)

    4. One of the following evaluation software is required in order to view and compile the Wifi applications sources.

    Alternatively the binary can be used to burn directly to the board(Included in Patch Programmer download)

    IAR Embedded Workbench v5.51.4 (MSP430) CCSv5.3

    5. Download and Install the CC3000 SmartConfig App (Java/Android/iOS)

    6. Download and Install a Hyper Terminal: Such as PuTTY, TeraTerm, etc.

    Assumptions & Knowledge Base

    1. Knowledge of or being familiar with the following will help the user in this demo:

    The CC3000 Host Driver Overview document Changing WLAN access point (AP) parameters

  • 1. Ensure the MSP430 Launchpad is configured to use

    the Hardware UART (USCI). By placing the first two

    jumpers in the orientation denoted in the image.

    2. Connect the CC3000 BoosterPack to the MSP-

    EXP430G2-Launchpad board. (as shown in the image

    J9 of CC3000 should align with J1 of the MSP430)

    3. Connect the USB miniport on the MSP-EXP430G2-

    Launchpad board to a PC.

    4. CC3000 Jumper Settings (on the CC3000

    BoosterPack):

    J13 should be located on pins 1 & 2 or nearest

    to the thick white line.

    J2 should be located on pins 2 & 3 in User

    mode

    For more information please refer to the MSP-EXP430G2-WiKi

    UART Configuration

    Connect CC3000 BoosterPack

    Jumper J13 position (w/o external

    power supply) for CC3000 Board Reset Button

    Network stack Logger pin

    USB HyperTerminal

    connection

    J2

    Connecting the CC3000 & MSP430 to a PC

  • Flashing the CC3000 Drivers/Firmware

    1. Click Start All Programs CC3000 Patch

    Programmer MSP430G2553 Download Driver

    Patches and follow the on screen instructions.

    2. Click Start All Programs CC3000 Patch

    Programmer MSP430G2553 Download

    Firmware Patches and follow the on screen

    instructions.

    Flashing the Application to the MSP430

    3. Click Start All Programs CC3000 SDK

    MSP430G2553 Download Basic Wifi Binary and

    follow the on screen instructions.

    Note: Please ignore comments about FRAM on Step 3

    and follow on screen instructions. At the end look for the

    Green and Red LEDs to be on.

    Note: You must flash the CC3000 Drivers before moving on to

    the Firmware

  • Configuring the HyperTerminal (PuTTY)

    General Notes

    The HyperTerminal is the interface through which commands are

    sent to the CC3000 basic Wi-Fi example application.

    1. Use Device Manager or Computer Management to identify

    MSP430 Application UART COM port for configuring the

    HyperTerminal.

    2. Double-click the MSP430 Application UART to configure the

    Baud Rate

    Configure the baud rate as follows (see also the figure to the

    right):

    Bits per second: 9600 Data bits: 8 Stop bits: 1 Parity: None Flow control: None

  • 3. PuTTY settings: With Session selected in the Category column

    in the left side of window. (see figure to right)

    Select Serial for Connection Type Set the Serial line value to the COM port for the

    MSP430 Application UART (from previous step)

    Set Speed to 9600

    4. With Terminal selected in the Category column in the left side of

    window. (see figure to right)

    Select Force on for Local echo

  • 5. With Serial selected in the Category column in the left side of

    window. (see figure to right)

    Serial Line to connect to: Verify this matches from step 1 Speed(baud): 9600 Data bits: 8 Stop bits: 1 Parity: None Flow control: None

    6. Select Open to start the HyperTerminal. If all settings are

    correct, the terminal will open.

    To get the driver version to display once the terminal is open press the Reset button (S1) on the Launchpad [you

    will need to scroll up in the terminal to see the driver

    information]

    Note: Occasionally PuTTY needs to be restarted and the Reset

    button pressed again to view driver information.

  • Running the Application

    Configuring the Basic Wi-Fi Example Application

    The example application demonstrates basic WLAN connectivity

    together with the capability of sending data over the WLAN

    transport with the help of the standard BSD socket interface.

    General Description

    Each HyperTerminal command-line interface (CLI) command used

    in the basic Wi-Fi example application consists of a minimum of 2

    bytes opcode. To execute a command, type the command and

    press Enter. When command execution completes, DONE

    appears in the HyperTerminal window. (See figure top right)

    Note: The first operation performed is a first-time configuration

    Supported Commands

    Before moving to socket-based operations, additional AP and

    static IP connections must be configured.

    Each command must be typed as an ASCII string in the

    HyperTerminal (see figure to right).

  • SmartConfig Tool for Android

    1. Download and Install the Android SmartConfig Application

    following the on-screen instructions.

    2. Navigate to the installed directory similar to below:

    C:\ti\CC3000AndroidApp\SmartConfigCC3X\bin

    3. Copy SmartConfigCC3X.apk file from this directory to your Android device.

    4. System Settings > Security & Screen Lock > Device

    Administration > Unknown Sources and Select Allow

    5. Navigate to the SmartConfigCC3X.apk on the Android Device and click to begin the install. Follow all on-screen instructions.

    6. Connect your Android devices Wifi connection to your desired

    AP.

    7. Start the SmartConfig App

    If connected to a Wireless AP the App should auto-populate the SSID and Gateway IP

    Enter the required Password and/or Key

    8. Click Start to begin broadcasting the Router information to the

    CC3000. 192.1 6 8 .1 .1

    Note: MSP-EXP430G2-Launchpad SmartConfig doesn't support encryption mode.

  • SmartConfig Tool for iOS

    1. Download and Install the TI WiFi SMARTCONFIG App from the

    iTunes Store following the on-screen instructions.

    2. Connect your iOS devices Wifi connection to your desired AP.

    3. Start the SmartConfig App

    If connected to a Wireless AP the App should auto-populate the SSID and Gateway IP

    Enter the required Password and/or Key

    4. Click Start to begin broadcasting the Router information to the

    CC3000.

    192.168.1.1

    TPLINK

    Note: MSP-EXP430G2-Launchpad SmartConfig doesn't support encryption mode.

  • SmartConfig Tool for a PC

    1. Connect your PCs wireless connection to the desired Access Point.

    2. Open the CC3000 SmartConfig Java Applet by clicking Start All Programs CC3000 Smart Config Java applet Smart Config.

    Note: Before opening the Java Applet make sure that ONLY ONE wireless

    connection exists on your PC. Disable all other wireless connections(i.e. 3G,

    Wireless Network Connection 2, or Bluetooth) otherwise the applet wont know which access point to pull information for.

    If you are properly connected to the desired AP the applet should populate the fields automatically and then click

    Start.

    Note: You may need to adjust your wireless connection MTU size to 1500. For

    Windows Users: Run Command Prompt as an Administrator and type the

    following command:

    netsh interface ipv4 set subinterface Wireless Network Connection

    mtu=1500 store=persistent

    Make sure to restart the SmartConfig Java Applet after changing the MTU size.

    Note: MSP-EXP430G2-Launchpad SmartConfig doesn't support encryption mode.

  • Running SmartConfig on CC3000

    1. In your Terminal type 01 to start Smart Config on the Launchpad.

    When the device finds an AP, the HyperTerminal displays Smart config DONE and then Done

    The example application now reboots the CC3000 device. After the reboot, the CC3000 device tries to

    connect to the AP detected. Following the reboot and

    as soon as the CC3000 device connects to the AP,

    the CC3000 IP address will be displayed.

    2. To test connectivity between the CC3000 device and the PC,

    execute the ping command using the CC3000s IP address from the command prompt window.

    Note: MSP-EXP430G2-Launchpad SmartConfig doesn't support encryption mode.

    0

  • Congratulations! You have successfully connected the CC3000 to

    your desired wireless access point.

    Further Information

    For more details on programming the CC3000 visit the wiki page at: http://processors.wiki.ti.com/index.php/CC3000_Basic_Wi-Fi_example_application_for_Launchpad

    For a detailed description and syntax for see the backup slides attached.

    For information on how to import the Basic Wifi Application source files into IAR or CCS to compile and edit view the backup slides labeled Building the Project with IAR or Building the Project with CCS.

  • Backup

  • Detailed Description of Commands

    Static IP Configuration

    The example application supports the configuration of the CC3000 device with a static IP.

    To configure the device IP, execute the command 08XXYYZZUUAABBCCDD where:

    XXYYZZUU is an IP address assigned to the CC3000 device in hexadecimal form. For example, if the required address is 192.168.39.10, the hexadecimal value is c0a8270a. Lower case only is supported.

    AABBCCDD is an IP address of the default gateway in hexadecimal form as well (which can be an IP address of the AP). The example application assumes that the network mask is 255.255.255.0.

    To test connectivity, execute the ping command.

    In order to configure DHCP, execute the command with zero value for all fields.

    Open UDP Socket

    To open a UDP socket, execute the Socket Open command (03).

    Note: There is a inactivity default timeout on the UDP socket of 60 seconds. This is refreshed with a sent or received packet.

    Send Data

    Please Note: MSP-EXP430G2-Lauchpad supports MAX UDP payload = 8 bytes

    To transmit a data packet:

    1. Execute the Socket Open command (03) as described in the section "Open Socket".

    2. Execute the sendto command (04AAXY02BCDEFGHIKLMN) where:

    AA is the hexadecimal presentation of the length of data. For example, to send 5 bytes, type 05. The field following AA is data. For example, to send the string 12345, type 12345. BCDE is the hexadecimal presentation of the destination port. FGHIKLMN is the hexadecimal presentation of the destination IP address.

  • Detailed Description of Commands (Continued)

    Receive Data

    Please Note: MSP-EXP430G2-Lauchpad supports MAX UDP payload = 8 bytes

    1. Execute the Socket Open command (03) as described in Section 6.4, Open Socket.

    2. Execute the bind command (06XXYY) where XXYY is the port in hexadecimal form. For example, if a port is 51000, the value

    typed is c738.

    3. Execute the Receive Data command (05). The HyperTerminal displays the received data.

    Close Socket

    To close a UDP socket, execute the Socket Close command (07).

    Connect to AP

    Note: The Connect-to-AP command is for advanced users. To connect to the AP manually (that is, not during the simple configuration

    process), execute the command 02XA...D where:

    X is the SSID name length in hexadecimal presentation. A...D is the SSID name length.

    Disconnect from AP

    To disconnect the CC3000 device from the AP, execute the CC3000 Disconnect command (09).

    Note: By default, the CC3000 device tries to reconnect to the AP automatically as programmed by the Simple Configuration process

    within the Example Application. To disconnect without reconnecting, the user must remove the policy as described in the section

    ''Delete Policy''.

  • Detailed Description of Commands (Continued)

    Delete Policy

    Note: The Delete Policy command (0a) is for advanced users.

    To delete the policy of automatic connection to the AP (as programmed by the Simple Configuration process), execute the CC3000

    Delete Policy command (0a). After the following reset, automatic reconnection to the AP is not attempted.

    Send mDNS Advertizement

    Note: The Send mDNS Advertizement command (0b) is for advanced users. This command sending mDNS Query packet with the

    data predefined in Basic WiFi application.

  • Building the Project in IAR

  • Running Basic WiFi Application with IAR

    Working with IAR Embedded Workbench will require opening the

    provided workspace, compile and burn it to the board following

    these instructions:

    In order to open a workspace and compile an application by

    yourself, please follow these steps:

    1. Open the IAR Embedded Workbench.

    2. Select FileOpenWorkspace (see the figure to the right).

    3. Open the CC3000 basic Wi-Fi example application

    (BasicWiFiApplication_workspace.eww) as shown in the

    figure to the right.

  • At this step, a workspace will be opened:(see the figure to the

    right).

  • 4. Project overview:

  • 5. In the Workspace window, right-click Example

    Application - Debug to open a menu. From the

    menu, select Options (see the figure to the right).

  • 6. Build your workspace as follows:

    1. In the Workspace window, right-click CC3000 Host

    Driver - Debug to open a menu. From the menu, select

    Rebuild All to build the CC3000 host driver (see the

    figure below).

  • 2. In the Workspace window, right-click CC3000Spi -

    Debug to open a menu. From the menu, select Rebuild

    All to build the CC3000_Spi (see the figure below).

  • 3. In the Workspace window, right-click

    HyperTerminalDriver - Debug to open a menu. From

    the menu, select Rebuild All to build the HyperTerminal

    driver (see the figure below).

  • 4. In the Workspace window, right-click Demo Application

    - Debug to open a menu. From the menu, select

    Rebuild All to build the example application (see the

    figure below).

  • 7. To download and debug the CC3000

    basic Wi-Fi example application, click

    the button (see the figure below).

  • Building the Project in CCS

  • Running Basic WiFi Application with CCS V5

    1. Open Code Composer Studio v5.

    2. Set the workspace to ..\ Basic WiFi Application\Basic WiFi

    Application CCS (see the figure to the right).

    Working with CCS v5 will require opening the provided workspace,

    compile and burn it to the board following these instructions:

    In order to open a workspace and compile an application by

    yourself, please follow these steps:

    3. Select Project->Import Existing CCS/CCE Eclipse Project

    as shown in the figure below..

  • 4. Select Browse and open Basic WiFi Application Folder as

    shown in the figure to the right.

    5. Select Select All and Finish as shown in the figure to the right.

  • 6. At this step a workspace will be created:

    7. Build your workspace as follows:

    1. In the workspace click CC3000 Host Driver and press

    the hammer icon in order to build.

  • 2. In the Workspace window, click CC3000 Spi and press

    the hammer icon in order to build.

    3. In the Workspace window, click Hyper Terminal Driver

    and press the hammer icon in order to build.

  • 4. In the Workspace window, click Basic WiFi Application

    and press the hammer icon in order to build.

    8. To download and debug the CC3000 basic Wi-Fi example

    application, click the button (see the figure below).

  • IMPORTANT NOTICETexas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and otherchanges to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latestissue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current andcomplete. All semiconductor products (also referred to herein as components) are sold subject to TIs terms and conditions of salesupplied at the time of order acknowledgment.TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TIs termsand conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessaryto support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarilyperformed.TI assumes no liability for applications assistance or the design of Buyers products. Buyers are responsible for their products andapplications using TI components. To minimize the risks associated with Buyers products and applications, Buyers should provideadequate design and operating safeguards.TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, orother intellectual property right relating to any combination, machine, or process in which TI components or services are used. Informationpublished by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty orendorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of thethird party, or a license from TI under the patents or other intellectual property of TI.Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alterationand is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altereddocumentation. Information of third parties may be subject to additional restrictions.Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or servicevoids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.TI is not responsible or liable for any such statements.Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirementsconcerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or supportthat may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards whichanticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might causeharm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the useof any TI components in safety-critical applications.In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TIs goal is tohelp enable customers to design and create their own end-product solutions that meet applicable functional safety standards andrequirements. Nonetheless, such components are subject to these terms.No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the partieshave executed a special agreement specifically governing such use.Only those TI components which TI has specifically designated as military grade or enhanced plastic are designed and intended for use inmilitary/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI componentswhich have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal andregulatory requirements in connection with such use.TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use ofnon-designated products, TI will not be responsible for any failure to meet ISO/TS16949.Products ApplicationsAudio www.ti.com/audio Automotive and Transportation www.ti.com/automotiveAmplifiers amplifier.ti.com Communications and Telecom www.ti.com/communicationsData Converters dataconverter.ti.com Computers and Peripherals www.ti.com/computersDLP Products www.dlp.com Consumer Electronics www.ti.com/consumer-appsDSP dsp.ti.com Energy and Lighting www.ti.com/energyClocks and Timers www.ti.com/clocks Industrial www.ti.com/industrialInterface interface.ti.com Medical www.ti.com/medicalLogic logic.ti.com Security www.ti.com/securityPower Mgmt power.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defenseMicrocontrollers microcontroller.ti.com Video and Imaging www.ti.com/videoRFID www.ti-rfid.comOMAP Applications Processors www.ti.com/omap TI E2E Community e2e.ti.comWireless Connectivity www.ti.com/wirelessconnectivity

    Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265Copyright 2013, Texas Instruments Incorporated