Sunday, June 15, 2014

The CC3000 Wifi - Part I

I have been messing around with the CC3000 Wifi based breakout board and shield from Adafruit lately and have found a bunch of problems with that CC3000 from Texas Instruments. With a little research over the internet i found that i was not the only one with these problems and many people were facing similar problems with the TI wifi module. To keep things brief here are my findings on the CC3000.

Devices Used - Arduino UNO, Arduino Mega 2560, CC3000 Breakout, CC3000 Shield.
CC3000 Firmware - v1.24
Problems - Unknown hang-ups, Buffer Full.

1. CC3000 WiFi shield + Arduino
I implemented a small weather station a few days ago, details of which can be found here. This arduino sketch runs flawlessly on an Arduino Uno for hours and days without any hang-ups or inconsistencies in behavior. Very strange it might seem, perhaps it's got something to do with the 40 second delay created due to the use of println() function that sends data character by character giving enough time for the buffers in the CC3000 firmare to freeup...maybe...

2. CC3000 Breakout + Arduino Mega 2560
A similar approach to [1] above only that i send a single random number to the Xively site. On the Mega 2560, using the println() the CC3000 used to hand up frequently after 3 - 4 minutes of sending data. Then i switched to the fastrprintln() API where the hang-ups happened after quiet some time usually 20 - 30 minutes. There are two hang-ups that i have observed. One is in the HostFlowControlConsumeBuff returning an error of -3, i.e a timeout as there are no free buffers available on the CC3000. The other is an unknown hang-up that i have not been able to figure out, but i have a hunch that it is in the while(1) of the hci_event_handler function. #defining SEND_NON_BLOCKING has no effect, just making things worse, making HostFlowControlConsumeBuff return -2 frequently. 

The watchdog cannot be used on the MEGA 2560, since the WDTON fuse is set to 1 (unprogrammed). Even enabling and using it results in a continuous resets. I used the method shown below to take care of HostFlowControlConsumeBuff problems in simple_link_send. The SysReset is nothing but this - void (*SysReset)() = NULL. The unknown hangup remains unknown.

I had to modify the Adafruit CC3000 library and added an API for fastrprintln() that took a String object as an argument. 

The firmware of the CC3000 seems to be pretty buggy at the moment. So beware before you buy any product that uses this one. I will be updating soon some crude workarounds and stuff with the Teensy soon using the CC3000...

Update June 19th 2014 

To use the existing fastrprintln without having to add a new member function to the client class we can invoke it as follows


Where data is a String object and c_str() is the member function that returns the character buffer.
I came across this thread on the Texas Instruments community forum. Looking at this there seems to be no hope of getting the CC3000 to work properly. The last time the thread was active was on Feb 2014, since then, complete silence. Looks like the CC3000 firmware team at TI is either working hard or hardly working at all...and right now after almost 4 months i'd go with the latter...

No comments: