• Hi everyone!

    I'm trying to use my Pico + CC3000 using non-default pins (not B6-B8).

    In failing to do this, I tried just this:

    var wlan = require("CC3000").connect(SPI1, B6, B7, B8);

    ...which hangs!

    But this:

    var wlan = require("CC3000").connect();

    ...works great! Takes about four seconds.

    Am I using the API incorrectly?

    Thanks everyone!

    P.S. I tried this too:

    var wlan = require("CC3000").connect(SPI1, {cs:B6, en:B7, irq:B8});

    Also hangs.

  • Your first attempt: var wlan = require("CC3000").connect(SPI1, B6, B7, B8);

    Seems like the correct one - but did you set up SPI1 beforehand? You'd need to use SPI1.setup({ mosi: .., sck: ..., miso:.., baud:1000000, mode:1) to make sure it's working on the right pins and in the correct mode (CC3000 seems to use a different SPI mode to normal for some reason).

    Unfortunately the software TI provides for their module is awful - if you initialise it with the wrong information, it just crashes and never returns (rather than erroring).

  • Thanks for the quick reply, @Gordon!

    Unfortunately, setting up SPI1 doesn't fix it (that would be too easy). A .connect() call with no args always works, but .connect(SPI1, B6, B7, B8) always hangs, whether I set up SPI or not.

    At least now I know I'm not going crazy, and this is actually weird.

    I'm thinking of just getting an ESP8266, unless there's WiFi module folks recommend.

  • I just tracked this down - it turns out that there was a regression which meant that mode in SPI.setup wasn't getting read correctly.

    If you use the latest Pico firmware from Git (which annoyingly doesn't come in a CC3000 flavour!) then it'll be fixed and the following will work:

    SPI1.setup({ sck:B3, miso:B4, mosi:B5, baud:1000000, mode:1});
    var wlan = require("CC3000").connect(SPI1, B6 */ CS */, B7 /* EN */, B8 /* IRQ */);

    I've put a working build at:


    If you copy that link and paste it into the Web IDE's flasher, it should work fine.

  • Wow, you're awesome, @Gordon! Unfortunately, http://www.espruino.com/tmp/espruino_1v8­5.139_pico_1r3.bin doesn't seem to exist (I get a 404).

    I can't wait to try it on pins other than B3-B8. :)

  • Strange... try:


    I just clicked on the link you pasted and it works, but mine doesn't!

    If not, just look in http://www.espruino.com/tmp for the file.

  • There's a weird non-printable character in the URLs above. (To give credit where credit is due, I used https://hexed.it/ to inspect the URLs.)

    But, anyway, http://www.espruino.com/tmp/espruino_1v8­5.139_pico_1r3.bin doesn't seem to work on my Pico. :( The red LED is on when I plug it in after uploading the firmware, and the Web IDE can't connect to it (the Ports list is missing the Pico, even).

    Any ideas? Perhaps I flashed it wrong? I can upload a screencast, if that would help.

    1 Attachment

    • hexedit-screenshot.png
  • I used curl to get it, because I have a CC3000 from the 'old', non-ESP8266 days... and the file came down with 7k... I know something was not right, but did not have time to dig deeper. Now I know...

  • Damn - sorry - I always forget about this. The Web IDE expects and image that includes the bootloader - and the image I posted didn't.

    I've just padded it out as:


    Strange about the extra character - I think it's a bug in the forum's syntax highlighting code (IIRC it's a special 'break here' character). I had to change the Web IDE so that it ignored it in pasted code - it obviously doesn't do the same with URLs :)

  • Sorry, @Gordon, no luck with espruino_1v85.139_pico_1r3_bootloader.bi­n either. Same result: red LED stays on.

    Any ideas? I don't think my Pico is busted, because I just flashed it back with the regular firmware, and works fine.

  • I just updated it with a new build. Maybe try now, with the same bootloader link.

  • espruino_1v85.139_pico_1r3_bootloader.bi­n successfully flashed this time, yay!

    I tried almost everything I could think of, including:

    1. B3-B8
    2. B3-B7, A8
    3. B13-B15, A5-A7

    Just for the record, what's the proper syntax for .connect():

    var wlan = require("CC3000").connect(SPI2, A7, A6, A5);


    var wlan = require("CC3000").connect(SPI2, {cs:A7, en:A6, irq:A5});

    Thanks so much, @Gordon! :)

  • And it works now?

    The first one is correct - I've been trying to use the second for new things as it is much more readable, but this particular bit of Espruino still uses the old way

  • Yeah, works great! I'm using custom pins and everything.

    Thank you, you're awesome.

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

weird CC3000 library behavior: .connect() works but .connect(SPI1, B6, B7, B8) hangs

Posted by Avatar for TheAlchemist @TheAlchemist