CC3000 HTTP Server

Posted on
  • (Ugh.. this is actually "tomgidden", but I still can't get my browser to log me in reliably, and it looks like the cookie's expired. Oh well. Call me user6351.)

    I've been trying to get the CC3000 running as an HTTP server using the example code, merging the CC3000 setup code with the HTTP server code:

    var wlan = require('CC3000').connect();
    
    wlan.connect("MY_SSID", "my_wpa_key", function (s) {
        if(s == 'dhcp') {
            console.log(wlan.getIP().ip);
    
            require('http')
                .createServer(function(req, res) {
                    res.writeHead(200);
                    res.end("Hello");
                })
                .listen(8080);
        }
    });
    

    The connection initialises fine, and after a while, I get the "dhcp" followed by the IP address. I can also connect to the port from a remote machine, via telnet/nc and curl. However, nothing after that. Eventually curl will timeout. Best I can do is hit RST and start again.

    Any thoughts?
    (This is on firmware 1v46)

  • Hi. I just tried this and I think it's actually a bug in Espruino I'm afraid.

    I'll try and look at this today and figure out what's up. It turns out the CC3000 is notoriously picky, and if you (I mean Espruino here ;) get anything wrong then the CC3000 drivers TI provide will just crash :(

  • Follow up: I've just got around to confirming it now works in firmware 1v48.
    Thanks, Gordon!

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

CC3000 HTTP Server

Posted by Avatar for tom.gidden @tom.gidden

Actions