ESP8266: CIPSTART failed?

Posted on
  • Manually checking version of my ESP8266's indicates they're the right version.

    (serial monitor @9600 baud):
    AT+GMR

    0018000902-AI03

    OK

    So I should be good right?

    
    Serial4.setup(9600, { rx: C11, tx : C10 });
    var wifi = require("ESP8266WiFi").connect(Serial4, function(err) {
      if (err) throw err;
      wifi.reset(function(err) {
        if (err) throw err;
        console.log("Connecting to WiFi");
        wifi.connect("(snip)","(snip)", function(err) {
          if (err) throw err;
          console.log("Connected");
          // Now you can do something, like an HTTP request
          require("http").get("http://www.pur3.co.­uk/hello.txt", function(res) {
            console.log("Response: ",res);
            res.on('data', function(d) {
              console.log("--->"+d);
            });
          });
        });
      });
    });
    
    
    
    >echo(0);
    =undefined
    Connecting to WiFi
    Connected
    ERROR: Socket error -1 while sending
    Uncaught Error: CIPSTART failed
     at line 1 col 207
    ...d 0,Error("CIPSTART failed");}
                                   ^
    in function "d" called from line 1 col 26
    {e=void 0;var b;d&&(b=d(a))?(e=g,d=b):clearTimeout(c);­void 0...
                              ^
    in function "e" called from line 1 col 291
    ...f&&(g[f](d),n=!0);n||e&&e(d)}b=b.subs­tr(a+1);"\n"==b[0]&&(b=...
                                   ^
    in function called from system
    >Uncaught Error: CIPSTART failed
     at line 1 col 207
    ...d 0,Error("CIPSTART failed");}
                                   ^
    in function "d" called from line 1 col 16
    {e=void 0;d&&d()}
                    ^
    in function called from system
    {if(a)throw a;wifi.reset(function(a){if(a)throw a;console.lo...
                 ^
    in function "a" called from line 1 col 100
    ...a("No 'ready' after AT+RST");else return c}
                                   ^
    in function "d" called from line 1 col 16
    {e=void 0;d&&d()}
                    ^
    in function called from system
    wifi.getVersion(print)
    =undefined
    null undefined
    >wifi.getVersion(print)
    =undefined
    null undefined
    
    

    Any thoughts on where to go from here, or what that error means?

  • The error means that the module didn't return "OK" after CIPSTART was called (for creating a TCP connection). You could try adding a delay between when the connection is established and when you do the first request? Maybe it's that your WiFi router takes longer than mine to give the ESP8266 an IP address?

    Maybe also try calling wifi.at.debug() - it'll show you what's getting sent and returned to the WiFi module.

  • Are you connecting to the Espruino Board or a Pico? And if it's the original Espruino do you have a voltage regulator on it?

    The fact that getVersion isn't returning anything sort of implies that the module's crashed - and a brown out might be the cause.

  • Problem solved. I was using it on the Original board with an external regulator - but I forgot the cap on the output of the regulator.

  • The peak current for those ESP8266's are quite high. Do you know if there's an option to restrict power to the RX of the RF? Seems to be when transmitting that the highest peaks occur. The range of the ESP is impressive but not really needed for many projects...

  • Glad, glad it's sorted! I should probably update the docs. When I did it I connected the regulator across the existing 3.3v line, so I guess I got to make use of those caps :)

    I'm not sure about power - there probably is an option but it may not be exposed in the AT-command firmware :(

  • Does your shim route out GPIO-0? If it does, it's kind of interesting to look at making a way to flash new firmware onto the ESP8266 from the Espruino. I think Espruino should be able to proxy/echo two serial ports at 9600 baud, no?
    Maybe you would not be interesting in hosting a fork of the SDK for little things like this.

    For now I've made a 'permanent' protoboard:

  • I'm afraid not - you'd just have to manually short it to GND (IIRC?) while powering on, but it's not that painful to do.

    But yes, firmware update would be good. We should start a post on it. I did have a very quick look at it with the Python updater, but without success... I'm not quite sure why not though.

    Personally I wonder whether we could just implement some JS code that could be added to the Web IDE for it (the protocol can't be that hard). While it'd be nice to just have an Espruino module that'd update it, there would have to be some way to stream all the data into it.

    The modules will update themselves when you get to a certain version number, but I tried this with AT+CIUPDATE on one of the modules I'm sending out for KickStarter and it bricked it - needing an update the normal way.

  • You're correct. Short it to GND while powering on will enter programming mode. The first time I tried to upload code to it I also had issues, it turned out to be the same as @DrAzzy, basically a power brownout. I have not measured the peak while programming but that may be interesting to do.

  • Based on Gordons WebIDE I created one for ESP8266 with nodeMCU firmware, a LUA version for the ESP8266. The nodeMCU version is much easier to handle and to program compared to AT-based firmware. Anyway, once you started with LUA, you will love Espruino more than ever :-)
    WebEditor is still under construction, actual version on github is here: https://github.com/jumjum123/ESP8266WebI­DE
    First introduction on youtube is this https://www.youtube.com/watch?v=6j8vAn_f­ZHU

  • Had this go south today, this time as client:

    Uncaught Error: Unlink already registered
     at line 2 col 22
    " already registered");g[a]=b}
                          ^
    in function "registerLine" called from line 1 col 171
    ...("Unlink");socks[b]=void 0});else throw socks[b]=void 0,Erro...
                                   ^
    in function "d" called from line 1 col 26
    {e=void 0;var b;d&&(b=d(a))?(e=g,d=b):clearTimeout(c);­void 0...
                              ^
    in function "e" called from line 1 col 291
    ...f&&(g[f](d),n=!0);n||e&&e(d)}b=b.subs­tr(a+1);"\n"==b[0]&&(b=...
                                   ^
    in function called from system
    
    

    then:

    >Uncaught Error: CIPSTART failed
     at line 1 col 223
    ...d 0,Error("CIPSTART failed");}
                                   ^
    in function "d" called from line 1 col 16
    {e=void 0;d&&d()}
                    ^
    in function called from system
    

    Like before, after this two attempts at initialization are required before the ESP will work again.

  • Strange - was this on the Pico, or the Espruino board?

    Were you doing anything out of the ordinary? Only thing I can think is maybe you had 2 concurrent connections? It should work, but I'm not 100% sure about that.

  • Pico.

    And it could have been multiple concurrent connections! I had it checking every 30 seconds in the background to get a status page....

  • I've had one checking every minute, but it's possible that the connection timeout is ~30 sec so occasionally you hit it.

    I'll check how it works with multiple HTTP requests at once. If there is a problem, a fix should be pretty easy.

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

ESP8266: CIPSTART failed?

Posted by Avatar for DrAzzy @DrAzzy

Actions