Jump to content

Playing with CC3000 on MSP430F5529 with Energia

Recommended Posts

The latest release of Energia includes a library for the CC3000 WiFi BoosterPack.


The library comes with an example called simpleWebServer.



I've faced some issues and here are the solutions I've found so far.
The example assumes an open LAN. Actually, my LAN is managed by an Airport router, in DHCP mode with WPA2 protection.
char ssid[] = "ssid_name"; // your network SSID (name)
unsigned char pswd[] = "password_key"; // your network key (password)

WiFi.begin(ssid, pswd);
Digging into the code let me found the following syntaxes
WiFi.begin(ssid_name); // for no protection
WiFi.begin(ssid_name, password_key); // for WPA protection
WiFi.begin(ssid_name, password_length, password_key); // for WEP protection
Even if I specify the address...
IPAddress serverIP(192,168,1,51);
...that IP address isn't taken into account by my router.
I haven't found yet where the variable serverIP is used except for Serial.println(serverIP);
So I pinged the whole LAN and get 3 addresses...
MacBook:~ reivilo$ ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=255 time=3.763 ms <- Airport router
64 bytes from icmp_seq=0 ttl=64 time=167.911 ms <- MacBook
64 bytes from icmp_seq=0 ttl=64 time=168.171 ms <- CC3000



Unplugging the CC3000 removes from the list.
The console shows now...

connect success!
To see this page in action, open a browser to
new client



...but no more.


And my browser get stuck, apparently waiting for an answer that doesn't come.


Any clues?



Link to post
Share on other sites
  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Not sure it fits your plans, but I've got a git repository with the TI Host Driver and a few patches at https://github.com/pabigot/cc3000 that works well with mspgcc. This is only Host Driver version

BTW - I was able to get my 5529LP and CC3000 device to connect to a WPA2 router successfully with the new 0012 version of Energia that was released.

Ok fwiw...   #include "netapp.h"     later on: uint32_t dhcpIP, dhcpSubnet, dhcpDefaultGW, dhcpDNS;   if (netapp_dhcp(&dhcpIP, &dhcpSubnet, &dhcpDefaultGW, &dhcpDNS) != 0) {  

  • 2 weeks later...

Taking a look at the code... since I don't have any open AP's around here, gonna have to use a key.


The base WiFiClass declaration:

class WiFiClass
        static void init();

        void setCSpin(uint8_t pin);
        void setENpin(uint8_t pin);
        void setIRQpin(uint8_t pin);
        int begin();
        int begin(char* ssid);
        int begin(char* ssid, unsigned char* pass);
        int begin(char* ssid, uint8_t key_idx, unsigned char* key );
        uint8_t status();
        //int startSmartConfig();
        bool countSocket(bool add_sock);

extern WiFiClass WiFi;

There's a WiFiClient class, WiFiUDP and WiFiServer.  WiFiClient looks like it has 2 purposes; an I/O handle for talking to a connection received through the WiFiServer, and a handle used to make new outbound connections.  This is what you'll want to play with @@cubeberg .



WiFiServer returns a WiFiClient in its available() call if a client connects:

class WiFiServer {
  uint16_t _port;

  WiFiClient available(uint8_t* status = NULL);
  // void begin();
  // virtual size_t write(uint8_t);
  // virtual size_t write(const uint8_t *buf, size_t size);
  // uint8_t status();

  // using Print::write;

I also find it interesting the startSmartConfig() stuff is commented out in the base class, guess that's still a work in progress.  I think you're supposed to be able to use Windows software to pre-configure WiFi settings on this chipset and call upon it by number or handle or something?

Link to post
Share on other sites

@@spirilis - thanks - I'll have to dig through.  I tried to download the CCS code from TI, but the download only includes IAR code for some reason - waiting on a response from support.  Need to look at Energia to see if I can get DHCP working.  It says it connects to the WiFi at work, but the hard coded address isn't working so well.

Link to post
Share on other sites

That's pretty weird.


Found this from the source (looks like the Energia lib is based on the TI C code)-

//!  wlan_connect
//!  @param    sec_type   security options:
//!               WLAN_SEC_UNSEC,
//!               WLAN_SEC_WEP (ASCII support only),
//!               WLAN_SEC_WPA or WLAN_SEC_WPA2
//!  @param    ssid       up to 32 bytes and is ASCII SSID of the AP
//!  @param    ssid_len   length of the SSID
//!  @param    bssid      6 bytes specified the AP bssid
//!  @param    key        up to 16 bytes specified the AP security key
//!  @param    key_len    key length

begin(ssid) uses unsec, begin(ssid, pw) uses WPA2, begin(ssid, key_idx, pw) uses WEP fyi.

Link to post
Share on other sites

Meh, I lied, my workplace's wifi is unencrypted but has an authentication page you must sign in to.... so I set up a wifi hotspot on my phone.  It connected, as I can see the MAC address on my phone's mobile hotspot page.


Hardcoded IP in the webserver app is dumb though, need to see how to extract the current DHCP IP and use that instead.

Link to post
Share on other sites

Ok fwiw...


#include "netapp.h"



later on:

uint32_t dhcpIP, dhcpSubnet, dhcpDefaultGW, dhcpDNS;


if (netapp_dhcp(&dhcpIP, &dhcpSubnet, &dhcpDefaultGW, &dhcpDNS) != 0) {

  Serial.println("DHCP failed."); LPM4;

} else {

  Serial.println("DHCP success:");

  serverIP = dhcpIP;  // unsigned long assignment is overloaded to properly copy long var into the object





gives me:

DHCP success:


...but that's not right, since my phone gave it  Still looking.

Link to post
Share on other sites

FYI - just got a response back from TI on the CCS code.  I'm downloading now to see if it's there.


It looks like they may have just included all of that into the new SDK (v1.1) shown on that same page:



Please grab that here:




Download for Windows Environment

SDK 1.11 Windows: One Installer for Basic Wifi Application and all available sample application or demo




Then see locally here:

C:\ti\CC3000SDK\CC3000 SDK\MSP430F5529\Basic WiFi Application\Basic WiFi Source\Basic Wifi Application CCS\Basic WiFi Application



Hopefully this is what you are after. Please let me know if its not.

Link to post
Share on other sites

Well then again, there's firmware to account for.



In the CC3000 example:


#include "nvmem.h"


in setup():

uint8_t fwver[2];


after WiFi.begin():


Serial.println("Firmware revision: ");

Serial.print(fwver[0]); Serial.print("."); Serial.println(fwver[1]);


Mine says 1.10, which is a bit old.  So I'll probably use the patch uploader soon.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...