Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 21 of 21

Thread: Teensy 3.1 and CC3000 webserver hang

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10

    Teensy 3.1 and CC3000 webserver hang

    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

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    Torrance CA
    Posts
    395
    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....

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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

  4. #4
    Senior Member
    Join Date
    Jun 2013
    Location
    Torrance CA
    Posts
    395
    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

  5. #5
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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:

    Click image for larger version. 

Name:	DeadbugCC3000.jpg 
Views:	248 
Size:	150.3 KB 
ID:	1279

    John

  6. #6
    Senior Member
    Join Date
    Jun 2013
    Location
    Torrance CA
    Posts
    395
    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.

  7. #7
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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

  8. #8
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    898
    Quote Originally Posted by johnraid View Post
    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.

  9. #9
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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 by johnraid; 01-12-2014 at 04:19 PM.

  10. #10
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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 by johnraid; 01-12-2014 at 05:14 PM. Reason: added more info

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Location
    Torrance CA
    Posts
    395
    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).

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    Please give it a try on Teensy 3 using my copy of the Adafruit's library.

    https://github.com/PaulStoffregen/Ad...CC3000_Library

    If this one work, but the latest from Adafruit is broken, please let me know. They generally accept fixes, so I'll look into this if you can confirm your hardware works with this version and fails with their latest code.

  13. #13
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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 by johnraid; 01-13-2014 at 03:07 AM.

  14. #14
    Senior Member johnnyfp's Avatar
    Join Date
    Jan 2014
    Location
    New Zealand
    Posts
    260
    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.

  15. #15
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,001
    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 ...

  16. #16
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    Manitou, can you tell me how you hooked your mega2560 up to the CC3000. I can seem to get mine to talk.

    John

  17. #17
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,001
    Quote Originally Posted by johnraid View Post
    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 by manitou; 01-17-2014 at 05:35 PM. Reason: clarification and MISO is pin 50

  18. #18
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    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

  19. #19
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,001
    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 by manitou; 01-17-2014 at 10:34 AM.

  20. #20
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    898
    with regards to powering, both of these setups (first using usb and second with 4AA batteries) works for the test suite.
    Click image for larger version. 

Name:	cc3000_11.jpg 
Views:	224 
Size:	163.8 KB 
ID:	1293Click image for larger version. 

Name:	cc3000_2.jpg 
Views:	188 
Size:	137.5 KB 
ID:	1294

  21. #21
    Junior Member
    Join Date
    Jan 2014
    Location
    Cedar Rapids, IA
    Posts
    10
    Quote Originally Posted by manitou View Post
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •