cc3000 simple socket demo (not using EthernetInterface) !

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed

You are viewing an older revision! See the latest version

Homepage

Info

Simple Socket demo application for the wireless CC3000 module.

Warning

This application will only work when TI's Service Pack 1.11 or higher is installed on the CC3000.
If necessary, run the PatchProgrammer before proceeding.

Setup

Note

It is recommended to run an initial test WITHOUT security settings.

Changing network parameters in main.h

  • Setup a wireless router with a non-secured wireless connection using the wireless settings stored in main.h.

// use smart config
#define USE_SMART_CONFIG 0

 // Default SSID Settings
//#define AP_KEY       "test"               // MUST BE DISABLED FOR NON-SECURE CONNECTIONS
#define AP_SECURITY  NONE
#define SSID         "test"
  • By default, DHCP is used to obtain the IP address.
    Change IP_ALLOC_METHOD, STATIC_IP_OCT_x and STATIC_GW_OCT4 when you want to use a fixed IP address.
    When the unsecure test works, re-enable AP_KEY and set both AP_KEY and AP_SECURITY to your preferred values.
    Valid values for AP_SECURITY are : NONE, WEP, WPA and WPA2
    See the next chapter on how to use USE_SMART_CONFIG.


Setting up the Python script

  • Download Python 2.7 from http://www.python.org/download/
    Install it on a computer connected to the router you previously set up (wireless or wired).
  • Download this Python script to the Python2.7 folder (credit : Jim Carver from Avnet).
  • Compile the CC3000_Simple_Socket_demo code and save it to your board.

Running the application for the first time

  • Open a terminal program (eg: TeraTerm) and connect to your board (serial speed : 115200 baud).
  • Press the reset button on your board.
  • Following startup screen will appear :

Note

The version info can be different.
the dots in the MAC address will show your CC3000's real MAC address.

cc3000 simple socket demo.
MAC address + cc3000 info
 MAC address ..:..:..:..:..:..

 FTC        1
 PP_version 3.4
 SERV_PACK  1.11
 DRV_VER    7.13.19
 FW_VER     7.12.14

<0> Normal run. SmartConfig will
    start if no valid connection exists.
<1> Connect using fixed SSID : test
<2> SmartConfig.


  • For the initial test, select option <1> (Connect using fixed SSID : ...).
  • If all goes well, the following screen is shown (the IP address and mDNS status can be different):
<TODO : ADD SCREENSHOT>


  • On the computer where you installed Python2.7:
    • Make sure the wireless connection between your computer and the router is active.
    • Open a DOS prompt and go to the folder where Python2.7 is installed.
    • Type following command :
python wigo_test.py -a 192.168.0.101 -p 15000


Note

Don't forget to replace the IP address with the real IP address assigned by DHCP to the CC3000 module.

If a connection is established, the DOS window will show

-----------------
run tcp client
-----------------
connected to  remote ip=192.168.0.101 remote port=15000
Press ENTER ....


In return the controller board will send following info to the serial port:

Connected


When we press Enter in the DOS window, the controller board will send following info to the serial port:

Connection from: 192.168.0.10
Received: Hello Wi-Go
Sending the message to the server.


And the DOS window will show:

recv from :  data:  Hello Python


Using the application's options <0> or <2>

Note

Set #define USE_SMART_CONFIG 1 in main.h and re-compile your code before you want to use these options.
USE_SMART_CONFIG tells the cc3000 module to use stored wireless profiles to connect.

Options <0> (Normal run) and <2> (SmartConfig) are very similar.
They both allow us to connect the CC3000 to another wireless network, without changing the pre-configured wireless settings stored in main.h.

As mentioned before, option <0> will automatically start SmartConfig if no valid connection exists (First Time Config),
but if the CC3000 was previously configured using SmartConfig, it will automatically connect to the wireless network.

Option <2> can be used to switch to another wireless connection.


See TI's pages on how to use the SmartConfig tool:


All wikipages