Teensy 3.1 and CC3000 webserver hang

Status
Not open for further replies.

johnraid

Member
I'm having a problem with my Teensy 3.1 and a CC3000 sample I received from TI. I have it set up as a web server and every time I hit it with a browser it hangs. I can get it to connect to my network without any problems both with a hardcoded SSID and with SmartConfig. I can even get mDNS working to get the IP. However every time I try to send something back [with something like client.println("HTTP/1.1 200 OK");] to a client from the server the Teensy hangs. mysntp.UpdateNTPTime(); also causes it to hang. I just went back to the echo server example and can telnet to the Teeny and it will echo the first character back and then hang so "hello world" only sends back 'h'.

The sample has firmware 1.10 on it and Chris Magagna's CC3000patch won't work with the Teensy 3.1.

I'm on the verge of buying 10 of Adafruit's breakout board for a project but want to make sure I can get this to work first. Anyone have any ideas?

John
 
Chris Magagna's CC3000patch won't work with the Teensy 3.1

That's me!

Can you tell me what happens when you try the patch? Does it lock up, give an error, etc.? Are you using the hardware SPI or software bit banging?

I don't own a Teensy 3.1 yet but if your need is non-critical and we can isolate the problem to the new 3.1 board I'll order one and see what needs to be done to get the patch working with it.

My guess is the problem you're seeing is due to the 1.10 firmware. It's pretty buggy. I don't know why TI still ships the CC3000 with the original firmware...very lazy on their part....
 
Thanks for your work Potatotron.

I couldn't get the patch to compile so I assumed it was a problem with having 3.1 as the target. Something about a symbol had previously declared a different type. I removed everything else from the Library directory per the instructions. I'll try again when I get home tonight and let you know the error. It could be a result of what I feel like is a cobbled together arduino environment on my part. I am using Paul's Teensyduino 1.18 candidate 1.

I am using the HW SPI from the 3.1. Putting it on the scope it seemed like a fair amount of ringing on the edges but all of the other communication seems solid so I don't feel like hacking up my dev board yet. I'll include a picture too. A dead bug CC3000 is quite a sight. I'm surprised it even works at all.

I have an arduino pro and and arduino mega pro at home. I'll try updating the firmware with one of those too.

Thanks again.

John
 
This weekend I'll install Teensyduino 1.18 and see if I can find any problems etc. It's been on my to-do list for some time but the last few months slipped away a lot faster than I expected...

In the meantime if you can try the upgrade code from one of the Atmel-based Arduinos you'll hopefully have better luck; I've had only a few problem reports from people using those AVRs and most have been 5V <-> 3.3V problems.

More soon.

Chris
 
So I actually read the error and it turns out I had the files in the CC3000Patch folder as well as the libraries director and that confused things. Now it compiles and uploads just fine but there is no response on the serial monitor. Nothing. I updated to Teensyduino 1.18rc2 just to see but no change.

Tomorrow I'll dig out an AVR and level converter and see if I can get some newer firmware shoved in there. Here's my deadbug:

DeadbugCC3000.jpg

John
 
A few things on this:

1 - Very nice dead bug soldering! It looks much better than my first attempt.

2 - Are you powering the CC3000 directly from the Teensy? If so you may have a problem in that the Teensy can only supply about 100mA but the CC3000 will take up to 350mA when it's transmitting.

3 - Regarding running the patch -- check the Line Ending setting in the serial monitor. I think I'm only checking for newlines so if it's set to carriage return it probably won't work.
 
Thanks. I have a separate 1A 3.3V LDO for the CC3000.

I spent a couple of hours this morning putting optiboot on a Mini Pro 3.3V with not much luck. So I gave up and now have my Mega Pro 2560 hooked up. I get the menu on the serial monitor now but any selection results in - Testing the CC3000... Initializing hardware... Unable to initialize the CC3000! Check your wiring! Aborting... I've triple checked my wiring but I haven't yet drug everything downstairs to put it on the scope yet. I guess that's for tomorrow.

I also tried my teensy program on the Mega and it gives me an error, "IRQ pin is not an INT pin!" Looking at dreqinttable[] in Adafruit_CC3000.cpp I don't know where those interrupts came from. But changing them to match the schematic didn't seem to change anything either. And that seemed unrelated to using your patch and a rabbit hole I didn't want to go down.

Maybe I'll just buy the Adafruit boards and hope I can get them to do what I want. We'll see where tomorrow gets me.

John
 
Now it compiles and uploads just fine but there is no response on the serial monitor. Nothing.
John

I had the same issue with using the adafruit cc3000 breakout board, sketch compiles and uploads, and no response from serial monitor. In the end, I changed the IRQ pin to pin 2 (I am using a Teensy 3.0), and all worked well. For some reason I could not get Pin 3 to be seen.
 
Chris, I added delay(1000) just before and after Serial.begin(115200); in setup. That made the command menu finally show up on the Teensy. Now whenever I select 0 through 3 it hangs at cc3000.begin();. It is init_spi(); on line 238 of Adafruit_3000_4patching.cpp that is causing the hang. Still digging....

Thanks for the idea Mortonkopf. On my teensy3.1 I had IRQ on 2 already but I changed it to 3 and now to pin 9. In all cases CC3000patch would hang but my program will talk to the cc3000 for everything except the web server response problem I started with.

John
 
Last edited:
I'm guessing this is why things are hanging. In ccspi.cpp in init_spi() calls SpiConfigStoreOld() that is defined on line 103 as:
Code:
// TODO: ARM (Due, Teensy 3.0, etc)
// #error platform not yet supported by Adafruit_CC3000
#define SpiConfigStoreOld()		do {  } while (0)
#define SpiConfigStoreMy()		do {  } while (0)
#define SpiConfigPush()			do {  } while (0)
#define SpiConfigPop()			do {  } while (0)
#endif

Anyone know what the purpose of that is and why all other CC3000 programs don't hit this same do loop?

Commenting out the calls to SpiConfigStoreOld() and SpiConfigStoreMy() allows me to get past init_spi() but then I hang at wlan_start(patchReq) on line 249 in Adafruit_CC3000_4Patching.cpp.

John
 
Last edited:
mortonkopf beat me to it on the serial front. The other thing you can do is add this to your code to setup() so the Teensy explicitly waits until you open the serial port:

Code:
void setup(void) {
	Serial.begin(115200);	
	while (!Serial);	// wait for the Serial Monitor to be opened on Teensy, Leonardo, etc.

Regarding the SpiConfigStoreOld() etc. - This is Adafruit's attempt to make the CC3000 play nice with other SPI devices, for example let's say you'd set SPI for the CC3000 to SPI_CLOCK_DIV2 and SPI_MODE0 but you've got another chip that needs SPI_CLOCK_DIV4 and SPI_MODE1. These routines are to set the bus the CC3000's way when it needs to talk, and back when it's done. I'm not a huge fan of this approach but certainly see why something like this is necessary.

One thing that may help when testing on the Teensy, Pro Micro, etc. is this code

https://github.com/cmagagna/ArduinoCC3000Test

It's a small bit of code that does the low-level init of the CC3000 to make sure all the hardware's working.

I'll be looking into the actual CC3000 <-> Teensy 3.x issue later this afternoon*(hopefully).
 
Chris,

Here is the output from the test. I get the same thing with both the CC3000Patch library and with Paul's updated library below:
Code:
Waiting for you before starting...
Confirming WLAN_IRQ is high...
Turning CC3000 on...
Waiting for the CC3000 to boot...

Testing first packet:
Expected: 2 0 FF 0 0 0 0 0 0 0 
Received: 2 0 FF 0 0 0 0 0 0 0 

Testing second packet:
Expected: 2 0 0 0 5 4 0 40 1 0 
Received: 2 0 0 0 5 4 0 40 1 0 

ALL TESTS PASSED!!!

Paul, I've been using your library. If I remember right the adafruit version didn't work and yours did but I thought I remember commenting out some print lines in a cpp file but I can't find it now. I can talk to the CC3000 just fine except when I try to upgrade to firmware. I think the latest Adafruit library is the same as yours now? At least they both have the same modified date if that's a good way to tell.

I should clarify that was all on my teensy 3.1. Maybe I'll go back to my Mega 2560 at try the test.

John
 
Last edited:
I too am having issues with the Teensy 3.1 creating a listen socket with the Adafruit CC3000 TI breakout board and library.

If I switch on the libraries debug, I can see that there is indeed reams of comms going on, and the teensy is not actually locked up. It's just that the correct event hasn't been sent back to tell the teensy that it has a client connected to it.

I think there might be a bug in the Adafruit library. Both the latest and Pauls libraries fail the same way. Maybe the latest firmware on the TI has changed the Event states that the Ada lib doesn't recognize any more.

Jfp.
 
Adding my 2 cents: examples/EchoServer works on mega2560, teensy ++ 2, and teensy 3.0, but NOT on teensy 3.1. On 3.1 it does DHCP etc and says listening ..., but when I try to connect to port 7 on cc3000, linux says "no route to host", can't ping it either. Could be a subtle timing issue since 3.1 is slightly faster on SPI and I2C due to faster memory/cache ... or something else ...
 
Manitou, can you tell me how you hooked your mega2560 up to the CC3000. I can seem to get mine to talk.

John

Here's how i hookup my Adafruit CC3000 breakout board
Code:
            Vin to 5v    grnd-grnd
            SCK - #52
            MISO #50
            MOSI #51
            CS for CC3000 #10
            VBAT_EN #5
            IRQ #3
            3.3v NA
 
Last edited:
Thanks manitou. Unfortunately I still couldn't get my mega to talk to my deadbug CC3000 through level converter. I even inadvertently put 5V to the CC3000 and was sure I fried it. Putting the teensy 3.1 back it I can talk to it just fine, ping it on my network, and find it via mDNS. Everything works so long as I don't try to reply to any http request with it.

I give. I bought 10 breakout boards from Adafruit for my project. I sure hope it's just the old firmware in my sample and my web server can respond with the new ones or it's going to be a bunch of late nights.

Thanks all.

John
 
Clarification. my CC3000 resides on Adafruit breakout board, so that board requires 5v and provides voltage regulator and level-shifter (5v to 3.3v)

http://www.adafruit.com/products/1469

are you running from separate power supply? CC3000 can draw near 300ma
 
Last edited:
with regards to powering, both of these setups (first using usb and second with 4AA batteries) works for the test suite.
cc3000_11.jpgcc3000_2.jpg
 
are you running from separate power supply? CC3000 can draw near 300ma

Yes, I had level converters and a separate regulator for for the CC3000. I powered both the Mega and the CC3000 regulator from a bench supply at 5V. I think I had other things going on though because I didn't even see the clock line for SPI bus. I suppose I need to figure out how to upgrade the firmware eventually but for now I need to get on with development.

John
 
Status
Not open for further replies.
Back
Top