discussion on supporting the TI CC3000 WiFi module

I really like the price and form-factor of the CC3000 WiFi module http://www.ti.com/product/cc3000

and I REALLY link the concept of SimpleLink for a headless embedded device http://www.ti.com/ww/en/simplelink/

From what I can tell, there is no Arduino support for the module and from what I read, the module supports DHCP, DNS, TCP/IP and UDP but not much else (ie no HTTP) - for sure less than the current Ardunio WiFi shield (that works great but it too expensive for my needs and does not have the SimpleLink capability) ...

So my question is - does anyone have an idea how hard it would be to hook up the module to an Uno (SPI interface is pretty straightforward) and to get a library in place to support the module to the point that we could hook up to cosm.com (formerly pachube.com aka patch bay).

Thoughts, comments?

Cheers David

PS: BTW I'd be willing to build the shield and provide it to the community to do the API work

I think you're right, it does have the possibility to be a really good fit for wireless Arduino-based devices. DigiKey has the chip for $12.51 (http://www.digikey.com/product-detail/en/CC3000MODR/296-35512-1-ND/3768439), which is a lot better than official wireless board or even the WiFly adapter from SparkFun et al.

I've got the data sheet bookmarked and will hopefully get to reading it this weekend, but I glanced through it at lunch and it seems doable. The chip's 3.3V only so you'll have to level convert the SPI pins but there's several ways to do that.

You're right it doesn't have a built in webserver for HTTP, but I don't think it would be too difficult to adapt the existing Arduino libraries to do that.

You've probably seen this guy's working on a shield (http://www.evenchick.com/cc3000-shield-and-the-internet-of-things.html) but I'm not sure of the project's current status. TI's got several eval boards, I'm going to look into those as well.

Please keep us posted on any progress you make, and I'll do the same.

I've gone back and forth with Eric Evenchik and he's working on it in his spare time. The SW is the challenge there too.

Here's a really good Kickstarter project using the CC3000 ... I'm a backer now...and planning to become an earlier adopter to get the Core in June.


Does anyone know of any work being done for home automation purposes? For example connecting a CC3000 to a low cost MCU so that you can control wall sockets (relays) and light dimmers would be amazing. Right now the only options require additional wireless hardware to receive the signals and all the solutions are proprietary.

I just got a CC3000EM prototype board. I'm going to try connecting it to an Arduino over SPI via a TXB0104 level translator, then starting a library for it (unless I can find someone else already working on one).

I'll post further updates in the Networking forum, but if anyone has any immediate questions please let me know.

No questions but I'm interested in how you go, that looks like a nice module.


Also curious on how this project is coming?

Any news??

I'm still working on it but so far no real news to report. I have the CC3000 evaluation module but so far I've been unable to get an Arduino to get the CC3000 to do WiFi-ish things.

I thought I'd have better luck getting TI's MSP430 board (it's only about $35 from DigiKey - http://processors.wiki.ti.com/index.php/CC3000_Wi-Fi_Platforms) and reverse engineering a working copy, but I've been unable to install their IDE on my Windows 8 laptop (yet another reason to not get a Windows 8 laptop...but I digress...)...hopefully some night this week or this weekend I'll be able to try again with a Windows 7 or XP box.


I may have made some progress.

Initially I was never able to get the CC3000 to respond to any SPI commands from either a Nano or a Teensy, so I bought TI's MP430 board (their version of Arduino) to make sure it even works. I finally got their IDE installed and got some of their sample apps compiled and uploaded yesterday. I was able to configure it with the iPhone app, ping it, etc.

So now I'm back to making the CC3000 work with Arduino and port TI's CC3000HostDriverLibrary. The biggest obstacle is their code spi.c and spi.h, which does all the SPI work but is all TI-specific. It's semi-documented here:


but I didn't find that guide to be very complete or useful, so I copied their version, renamed the files to ArduinoCC3000SPI so they can work with Arduino's standard SPI.h, then commented out all the TI hardware-specific code until it compiled. It doesn't do anything yet but I believe just compiling is a good sign.

I'm currently slogging through their code and trying to figure how to rewrite the TI code for Arduino. Here's an example:

//! This function enter point for write flow
//!  \param  SpiPauseSpi
//!  \return none
//!  \brief  The function triggers a user provided callback for 

//  todo: code this

I'm not sure how you pause SPI on Arduino, if it's necessary, if removing it will break something else, etc., but I'm working on it.

If I ever get anything useful working I will post this on github or some place, but for now it's just commented out code and a bunch of Serial.println()s.


Welcome to the world of porting code.


I'd love to see this ported.

Some similar qustions being discussed here: http://e2e.ti.com/support/low_power_rf/f/851/p/260521/911920.aspx

void SpiPauseSpi(void) { SPI_IRQ_PORT &= ~SPI_IRQ_PIN; } void SpiResumeSpi(void) { SPI_IRQ_PORT |= SPI_IRQ_PIN; } As far I understand these functions enable or disabled the IRQ_SPI Line in your Microcontroller, and in case of CC3000 produce a falling edge in the IRQ Pin it would not be treated

I do the same using a Flag void SpiPauseSpi(void) { irq_flag=0; } void SpiResumeSpi(void) { irq_flag=1; }

Well I have bad news, good news, and bad news.

I finished porting the library’s SPI routines but the init routine locks, I traced that down to it waiting and never receiving an init reply from the CC3000.

I put the library to the side and went back to trying to communicate with it directly by bit-banging the handshake pins and manually sending the init string via SPI, and it’s failing the same way the library fails. I wanted to rule out the Teensy so I swapped it for a Nano + some voltage dividers (Arduino pin → 5.6K R → CC3000 pin + 10K R → GND).

I’m now able to do the initial handshaking, send the SPI init string, and get the SPI init response. (I’m not sure why the Teensy wasn’t working but I’ll come back to that later)

The problem now is the data I’m getting back is 1 bit off. Both the received bytes in the init string, and the bytes in the init response, have a leading 1 bit:

First string:
02 00 FF 00 00 00 00 00 00 00 (expected)
81 00 7F 80 00 00 00 00 00 00 (observed)

Second string:
02 00 00 00 05 04 00 40 01 00 (expected)
81 00 00 00 02 82 00 20 00 80 (observed)

TI’s documentation (http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide) says:

The SPI protocol is used to communicate with the CC3000 device from the host MCU that is acting as the SPI master while the CC3000 device is the SPI slave. The protocol is an extension of the existing standard SPI. The endianness on transport is assumed to be most-significant bit (MSB) first.
The clock and phase settings for the SPI are configured such that the data is sampled on the falling edge of the clock cycle. Note that different MCU may use different naming conventions in order to configure SPI clock phase and polarity, For example, MSP430 uses UCCKPL and UCCKPH for clock polarity and phase respectively. Both are set to 0, indicating that the data is sampled on the falling edge of the clock cycle. The more generic convention is CPOL and CPHA, however, in order to configure sampling on the falling edge of the clock cycle, CPHA is set to 1.

I take this as CPOL=0 CPHA=1, which for Arduino is SPI.setDataMode(1), but that isn’t working. I’ve tried modes 0, 2, and 3 as well, and get the exact same results. I’ve also tried changing the SPI clock with DIV2, DIV4, DIV8 with no changes.

Short of bit-banging the SPI protocol to the CC3000, does anyone have any ideas on how to fix this?

I’m attaching my useless code, maybe I’m overlooking something obvious here?

cc3000.ino (3.62 KB)

I would find it difficult to believe that the TI module is incompatible with AVR’s SPI…

It looks like SPI.setDataMode() is:

void SPIClass::setDataMode(uint8_t mode)
  SPCR = (SPCR & ~SPI_MODE_MASK) | mode;

Which means that you should be calling it with: SPI.setDataMode(1<<CPHA); instead of SPI.setDataMode(1)

There are a lot of complaints on the TI forums about the state of the CC3000 documentation (or lack thereof.) :frowning:

I apologize for that error. I caught that a while ago. I've tried using the built in constants, e.g. SPI_MODE1, but get the same results no matter what option I pick.

There are a lot of complaints on the TI forums about the state of the CC3000 documentation (or lack thereof.) :-(

Yes...it hasn't been as much fun as I'd hoped...

I caught that a while ago

Can we see the actual code that you have now?


I'd feel better if the SPI.begin() was last instead of first.

I'm pleased to report that works! No idea why, but it's definitely working now with the Nano. I'm getting exactly what I expect:

First packet data: 2 0 FF 0 0 0 0 0 0 0 (HCI_CMND_SIMPLE_LINK_START ack) Wlan sent me: 2 0 0 0 5 4 0 40 1 0 (HCI_CMND_SIMPLE_LINK_START command complete)

I'm still unable to get it working with the Teensy -- even with dc42's suggestion of resistors on the IO lines all I get back is FFs. I'll work on that later.

In the meantime, back to porting the library to Arduino.

Thanks for your help.

Keep us posted on your progress! I too am working on getting a CC3000 working with an arduino...

I’ve got good news to report. I’m now able to get the TI library to compile for Arduino and execute basic commands (show version, start config, connect to a WiFi network, get a DHCP address, etc.). I’m still experimenting with the API but it looks like everything is there and functional.

I found the problem between the Teensy and the CC3000 – the TI module is very unforgiving about what it expects in SPI timing and/or the Teensy 3.0 SPI implementation has a bug about how it handles SPI mode 1 (CPOL=0 CPHA=1) so I’m bit banging everything for now. The nice thing about the Teensy is it has (relatively) lots of Flash and RAM so I didn’t have to worry about buffer sizes etc.

The code currently compiles for the ATMega328 but crashes/reboots when I call the init routine on my Nano…my guess is it’s running out of RAM. There’s a ‘small memory’ compiler option ("#define CC3000_TINY_DRIVER" - http://processors.wiki.ti.com/index.php/Tiny_Driver_Support) which is supposed to limit the library to about 200 bytes of memory but that doesn’t work for me…I probably broke something while porting the code but I’ll get back to that soon.

Once I know everything’s working I’m going to remove all my debugging etc. then do a diff between the TI reference library and my code, document the changes, and post things on github or Google code.

In the meantime I hope someone’s working on a hardware implementation…currently I’m using the CC3000EM (http://www.ti.com/lit/ug/swru326/swru326.pdf) but it’s got a weird pinout, is expensive, and seems to be perpetually on backorder everywhere.

Glad to see that someone is also working on this! I also have a CC3000 evaluation board, and would like to communicate it with my arduino micro at 3.3 to make some tests. I started to port the example library for the TI chip, but it is in a very preliminary stage. What is your compiled sketch size in the Arduino environment? Are you compiling with CC3000_TINY_DRIVER definition enabled?.

How many pins are you using to communicate with the chip? I need 6, one to drive wifi enabled/disabled, one to detect chip IRQs, and the typical 4 for SS, CS, MISO and MOSI.

Hope to see some library or reference software to test with the Arduino =D

Keep us updated!