Go Down

Topic: discussion on supporting the TI CC3000 WiFi module (Read 61083 times) previous topic - next topic

dbm123

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

magagna

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.
http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

dbm123

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.

http://www.kickstarter.com/projects/sparkdevices/spark-core-wi-fi-for-everything-arduino-compatible

experimenter2000

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.

magagna

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.
http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Graynomad

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

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

ievolve



magagna

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.
http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

magagna

Howdy,

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:

   http://processors.wiki.ti.com/index.php/CC3000_Host_Driver_Porting_Guide

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:

Code: [Select]

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

void
SpiPauseSpi(void)
{
// todo: code this
// SPI_IRQ_PORT &= ~SPI_IRQ_PIN;
}


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.

Chris
http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Graynomad

Welcome to the world of porting code.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

martin_bg

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

Quote
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;
}



magagna

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:

Quote
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?
http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

westfw

#13
Jun 19, 2013, 02:17 am Last Edit: Jun 19, 2013, 02:19 am by westfw Reason: 1
I would find it difficult to believe that the TI module is incompatible with AVR's SPI...

It looks like SPI.setDataMode() is:
Code: [Select]
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.)  :-(

magagna

#14
Jun 19, 2013, 02:31 am Last Edit: Jun 19, 2013, 02:34 am by magagna Reason: 1
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.

Quote
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...

http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Go Up