Debugging the CC3000

Posted on
  • hi there!

    I've had a working WiFi connection with a CC3000 yesterday but suddenly today it is no longer connecting to my network.

    There are no error messages, wlan = require("CC3000").connect(); returns a valid wlan object and wlan.connect(…, …, …); returns true but the callback is never called. My WiFi router also shows no connection attempt.

    How can I debug and find out what is happening?

    Thank you,
    Mario

  • Hi Mario,

    That's basically all the information that Espruino gets from the CC3000 - it's a bit of a black box!

    After calling wlan.connect, the Espruino is still usable though? As in you can enter commands in the left-hand pane?

    You could try doing wlan.getIP() to see what the current IP address is... I was pretty sure that the CC3000 always did a dhcp when it connects though - and you think that it's not even getting to the point where it's connecting to the router?

    Also, it might be worth checking the power - that you haven't connected 3.3v on the CC3000 to anything, and are instead connecting Vin in the CC3000 to Bat on Espruino.

  • Hi Gordon,

    The espruino is still usable after the calling both connect() functions, I can enter new commands and do whatever I want with it – only when trying a wlan.reconnect() it will hang for a while.
    .getIP() only tells me that there is no internet connection, as does .setIP(): My router logs all connection attempts and known devices and when they were last seen, thats why I think it's not even trying.

    VIN is connected to Bat, when putting it on the 3.3V the module-driver will just print a timeout when calling require on it. The CC3000 was the only thing connected to the espruino in my last tests.

    Since it was working one day and stopped working on the next, maybe there is something that can be reset on the CC3000? Is there anything it can remember? Otherwise its maybe just broken ;)

    But basically if it does not work, there's no way to find out why it doesn't work?

    Cheers,
    Mario

  • Hi Mario,

    You could try entering connection details for a different access point (it doesn't have to exist :) ). I think the CC3000 does remember login details though, so just setting them to something else and then setting them back might help?

    Who makes the module you're using? I guess it's possible that yours has a different firmware version, as I know TI didn't try very hard to make it backwards compatible.

  • Thank you, Gordon!

    I already tried that to provoke an error by entering invalid credentials and to connect to a different network, but didn't do anything – same results. Also checked all pins several times and discovered that whenever one pin isn't correctly connected, loading the driver will already print an error – which is good to know for future debugging :)

    I'm using one from Adafruit ordered at digitalmeans ( https://digitalmeans.co.uk/shop/adafruit­_cc3000_wifi_breakout_with_onboard_ceram­ic_antenna_v1_1?search=cc3000 ). What puzzles me most is that it worked the day before, which means that the firmware can't be the reason (or it would not have worked before?), test code is also the same (copy & paste) and if I access the pins separately on the espruino (read/writes), everything works fine too :(

    At the end of this week I will receive another CC3000 and two more espruino boards, trying another CC3000 should help shed some light on where the problem is.

  • @favo, could you please publish some of your test code you used? I have the CC3000 journey still ahead of me...

  • @allObjects its pretty easy, the documentation provided great examples, its just this:

    var wlan = require("CC3000").connect();
    if ( wlan ) {
      wlan.connect( "<network id>", "<network password>", function (s) {
      console.log("connect callback");
      if ( s == "dhcp" ) {
        LED3.write(1);
        console.log(wlan.getIP());
        }
      });
    }
    

    I've put a little longer test that also writes a logfile on a github gist: https://gist.github.com/ifavo/d3cc923dca­4c94526f35

    The connect() call on the required module takes a little while and freezes the the espurino for some seconds. It prints a timeout error if the wiring is wrong and returns a working wlan object only when everything is good.

    The wlan.connect() needs network id and password to identify on your wpa2 network. From the network code I understand that only WPA2 and unprotected (no password) networks are currently supported. If you are using WEP you may need to re-configure your router.

    And well, the callback is called multiple times (whenver the connection state changes) and only if its parameter is String("dhcp"), you'll have your connection. When it was working, I had multiple calls of it with no arguments provided, so you'll really want to check this.

    You can also use wlan.setIP() to set your static address like this:

    wlan.setIP({
    	ip: "192.168.176.63",
    	subnet: "255.255.255.0",
    	gateway: "192.168.178.1",
    	dns: "192.168.178.1"
    });
    
  • Just wanted to share that today the other CC3000 already arrived and worked straight out of the box. So something must be really wrong with the other one :(

  • Thanks for letting us know! I wonder what happened... Does anything look broken around where the aerial is?

  • Nope, everything looks good – but my bet is still that I broke something at some point. Its just terrible to not been able to really debug this kind of stuff.

    Btw. I've just put a bluetooth chip (HC-05) on it and must say the documentation on the website is generally really good!

  • Thanks! Glad it's all going anyway.

    Things like the CC3000 are pretty nasty to debug (I spent the best part of a month full-time trying to get it working reliably). There's basically a complete computer and operating system in that tin can on the board, and if it's not responding it's hard to know what the problem is.

    Having said that, I recall now that there's actually a 'debug' port on the modules. I haven't used it, but you could hook up a USB-TTL converter and you might be able to get status information from the CC3000 about what's happening.

  • @favo, just to let you know, I made it to the tunnel... see CC3000 initialisation and/or timeout issues. Hurray! ...at least for now... will see what about reliability and robustness.

  • Hi!

    I just recently ordered a CC3000 from Adafruit (v1.1) and I have the same results...

    I connected the CC3000 to the espruino Pico (checked all pin-connections with a multimeter, because I have it set up on a breadboard very close to each other, ~3-9 cm wires) and started the WebIDE.
    The IDE suggested a firmware update, so I updated and choose the CC3000 option from the select box. Update successfull.

    When I run the CC3000 example code (or just this simplified version), it won't get any callbacks.

    var wlan = require("CC3000").connect();
    wlan.connect("SSID", "*************", function(s) {
      console.log("callback time!");
    });
    

    The connect just returns "true" and that's it.

    I also noticed that the activated WLAN-chip does get quite warm very fast... and when I call "wlan.deactivate()" the green LED gets much brigher and the metal casing cools slowly.

    I tried wlan b-standard and g-standard and mixed mode... WPA2, AES+TKIP on 2.4Ghz Channel 3.

    When I console.log(wlan) after trying to connect, there is only one property in the object, the "#onstate"-callback defined above. I think that is right?

    wlan.getIP() will complain "ERROR: Not connected to the internet".

    Is there anything I could do or try to make this work? The module is new and I can't believe it is just broken or something...

  • @Faldrian Just a note to say I that have two of the Adafruit CC3000 modules. One of which worked fine for several months and then started to act as yours does:
    works ok for a few minutes when first powered up but then gets quite warm and no longer responds.
    The second one works fine in the same circuit and same code.
    An original Espruino board and v1.79 (I think).
    Jamie

  • It's worrying about the dimming and heat - have you made sure that the 3.3v line isn't connected to anything? What is the 'VIN' wire connected to?

    The chip usually takes a while to initialise, but something should definitely have happened within about 30 seconds.

    I just tried here and it all works fine for me, so I'd guess that it might be some problem with how you've wired up the power. The chip does get warm (body temperature?) but shouldn't get properly hot though.

  • I solved the mystery! :)
    Thanks for the replies so far!

    I was running the Espruino + CC3000 on the USB-Power-Supply from my computer ... and 500mA do not seem to be enough. It seems the CC3000 draws too much power when operating and since the current is limited it shuts itself down when the voltage drops due to current limiting. Espruino is unimpressed and keeps working. :D

    Now I have the CC3000 on some NiHM-Cells and I get callbacks! Yay, I'm SO relieved...

  • Interesting - thanks for letting us know!

    I guess it could be the diode for USB power on the Pico. It actually wasn't as highly rated as it could have been (it'll be fixed on the 1v4 revision when that comes out), so it might be just on the edge when it comes to getting power off of USB.

  • I guess you might also have some luck if you put a nice big capacitor (100uF or more) across the power lines to the CC3000, but the batteries are a good plan :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Debugging the CC3000

Posted by Avatar for favo @favo

Actions