Jump to content
Sign in to follow this  
Mark Easley TI

CC3000Boost Library - in progress

Recommended Posts

Hi,

 

I just wrote my first basic energia library that blinks an LED in Morse code, and now that I see how its done I'm looking for a bigger challenge. I want to write a library for the CC3000 Wifi BoosterPack.  Check this post for more information: https://github.com/energia/Energia/issues/232

 

 

From some of my initial testing, the MSP430 LaunchPad will be hard pressed to meet the memory and power requirements for this BoosterPack so I'm going to use the Stellaris / Tiva LaunchPad as my initial prototype and then hopefully be able to port it over to the MSP430G2 later (supposedly it does run on it in native code). I have set up these function prototypes based on the APIs in the CC3000 wiki: http://processors.wiki.ti.com/index.php/CC3000_Basic_Wi-Fi_example_application_for_Stellaris#Running_the_Application

/*
  CC3000Boost.h - Library for CC3000 BoosterPack
  Created by Mark Easley, May 2013.
  Released into the public domain.
*/
#ifndef CC3000Boost_h
#define CC3000Boost_h


#include "Energia.h"


class CC3000Boost
{
  public:
    CC3000Boost();
    void SmartConfig();
    void Connect(int SSID, int SSID_LENGTH);
void SocketOpen();
void SendData(int DESTINATION_PORT, int IPADDR_AND_DATA); //length of packet cannot exceed 255 bytes
void ReceiveData();
void Bind(int PORT_TO_BIND);
void SocketClose();
void IPConfig(int LOCAL_IP_ADDR, int DEFAULT_GATEWAY); //No DHCP configuration is supported
void Disconnect();
void DeletePolicy();
void SendmDNSAdvertisements();
  private:
    int _pin;
};


#endif
/*
  CC3000Boost.cpp - Library for CC3000 BoosterPack
  Created by Mark Easley, May 2013.
  Released into the public domain.
*/


#include "Energia.h"
#include "CC3000Boost.h"


CC3000Boost::CC3000Boost()
{
  pinMode(pin, OUTPUT);
  _pin = pin;
}


void CC3000Boost::SmartConfig()
{


}


void CC3000Boost::Connect(int SSID, int SSID_LENGTH)
{


}


void CC3000Boost::SocketOpen()
{


}


void CC3000Boost::SendData(int DESTINATION_PORT, int IPADDR_AND_DATA)
{


}


void CC3000Boost::ReceiveData()
{


}


void CC3000Boost::Bind(int PORT_TO_BIND)
{


}


void CC3000Boost::SocketClose()
{


}


void CC3000Boost::IPConfig(int LOCAL_IP_ADDR, int DEFAULT_GATEWAY)
{


}


void CC3000Boost::Disconnect()
{


}


void CC3000Boost::DeletePolicy()
{


}


void CC3000Boost::SendmDNSAdvertisements()
{


}

Is this the right way to approach library design?  Do I now convert the native code that is already available in Code Composer to these energia functions?  The CCS code is dependent on 3 separate projects, do I need to convert these to Energia libraries too, or just try to combine everything into this library?

 

Finally, the TI apps team did not provide a good demo for this BoosterPack.  The only thing you can do is send and receive UDP packets but there is no "practical" application of using embedded wifi.  Is there a good out of box demo we can design using energia that demonstrates how useful this is to projects and applications?

 

 

 

Share this post


Link to post
Share on other sites

Hmm, this particular case sounds complex since it's a TCP/IP adapter of sorts.  Take great care to make sure you're presenting an API that works with existing stuff--in particular, you need to support the native Arduino/Energia Print library so folks can use the familiar blahblah.print(x); blahblah.println(y); type of stuff.

 

For an example of this, see my Enrf24 library: https://github.com/spirilis/Enrf24

 

There's more to this I suspect, though.  Can the CC3000 support multiple sockets open at the same time?  If so, you have to branch out into managing the different sockets.  So the SocketOpen() function will have to return a handle of sorts, some kind of handle that is passed to the various write/read functions so they know which socket to work on.  Unless you desire the scope of this library to only work with 1 socket of course, then things get simpler.  Another alternative (and probably more sensible since it won't break .print(), .println() et al) is to have the library manage multiple sockets but you have to use a method to "switch" which one you're operating on, e.g. if you have 3 sockets open (0, 1 and 2) then you can use a wifi.use(X) method to select which one.  That way the interface looks the same whether you're managing 1 connection or 10, and the user just has to wrap their head around the .use() syntax and convention if they're advancing into multi-socket applications.

 

I will note that my Enrf24 library was written with familiarity of the conventional function/method names used by SPI and Serial (i.e. .available(), .write(), .read(), .flush() along with .begin() and .end()--and by having "using Print::write;" in the .h file the .print() and .println() functions are there), it's a good idea to stick with that IMO for consistency.

Share this post


Link to post
Share on other sites

This is definitely a tricky one.  I downloaded the source for the Basic Wifi App. It is split into a Basic Wifi Application, CC3000 SPI, CC3000 Host Driver, HyperTerminal Driver.

 

I think the Host Driver is the main guts I need for the library.  Can I use the Energia SPI library and ignore the HyperTerminal Driver?

BasicWifiM4Source.zip

Share this post


Link to post
Share on other sites

I wonder why you adding new libraries for a hardware module that is expensive, seems to be back ordered, and unlikely to work on the msp430 launchpad board with Energia. The majority of Enegeria users are focused on the msp430 launchpad board. It seems premature to focus on nice to have extras while there are many new editor features and bugs fixes waiting in the source tree without a release.

 

Now that TI is throwing paid programming resources at Energia and writing books about it, when will we see a new release? Is there a timeline and feature list for next version? I'd like to see some of the basic issues fixed.

 

Is there going to be a 64 bit linux version? What about linux support in general, Will TI be releasing patched CDC drivers to deal with the problematic serial port on linux?

 

-rick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×