• I just debugged a problem with ESP8266 v0.95(b1) firmware and the latest Espurino build in file network_esp8266.c:
    1) Sending the command AT+CWJAP="",""
    now longer seems to work, so this code now always fails:

      libs/network/esp8266/network_esp8266.c:  JsVar *cmd = jsvNewFromString("AT+CWJAP=\"\",\"\"\r\n­");
    

    I changed this command to AT+CWQAP for now to test

    2) Sending any AT commands with \r\n fails - use \r only when sending to the esp8266

    3) Looks like the esp8266_connect() timeout of 500ms is way way to fast especially when connecting to an AP (should be over 5 seconds, ie 10000)
    Adding -dESP8266_DEBUG to the defines section of the Makefile helps watch the progress of the failures

    Code I used to test: (note I have an STM32F4 (407) Discovery board)

    Serial4.setup(9600, { rx: A1, tx : A0 });
    console.log("Connecting to ESP8266");
    var wifi = require("ESP8266").connect(Serial4, function() {
     console.log("Connecting to WiFi");
      wifi.connect("your_ssid_here","your_pass­word", function() {
        console.log("Connected");
        require("http").get("http://192.168.1.1"­, function(res) {
          console.log("Response: ",res);
          res.on('data', function(d) {
            console.log("--->"+d);
          });
        });
      });
    });
    

    Debug Log so far all timeouts updated to 10000 in libs/network/esp8266/network_esp8266.c

    >Serial4.setup(9600, { rx: A1, tx : A0 });
    =undefined
    >console.log("Connecting to ESP8266");
    Connecting to ESP8266
    =undefined
    >var wifi = require("ESP8266").connect(Serial4, function() {
    :  console.log("Connecting to WiFi");
    :  wifi.connect("your_ssid_here","your_pass­word_here", function() {
    :    console.log("Connected");
    :    require("http").get("http://192.168.200.­1", function(res) {
    :      console.log("Response: ",res);
    :      res.on('data', function(d) {
    :        console.log("--->"+d);
    :      });
    :    });
    :  });
    :});
    >>> "AT+CWQAP\r"
    ={  }
    ESP8266> "AT+CWQAP"
    ESP8266> ""
    ESP8266> "OK"
    >>> "AT+CWMODE=1\r"
    ESP8266> "AT+CWMODE=1"
    ESP8266> ""
    ESP8266> "OK"
    >>> "AT+RST\r"
    ESP8266> "AT+RST"
    ESP8266> ""
    ESP8266> "OK"
    ESP8266> "D�I\x11�H\x112�\x00�a�k#��'��\"\b\x11\x­00���"
    ESP8266> ""
    ESP8266> "Vendor:http://www.ai-thinker.com"
    ESP8266> ""
    ESP8266> "SDK Version:0.9.5(b1)"
    ESP8266> "Compiled @:Dec 25 2014, 21:50:58"
    ESP8266> "ready"
    >>> "AT+CIPMUX=1\r"
    ESP8266> "AT+CIPMUX=1"
    ESP8266> ""
    ESP8266> "OK"
    Connecting to WiFi
    >>> "AT+CWJAP=\"your_ssid_here\",\"your_pass­word_here\"\r"
    ESP8266> "AT+CWJAP=\"your_ssid_here\",\"your_pass­word_here\""
    ESP8266> ""
    ESP8266> "OK"
    >>>> "AT+CIFSR\r"
    ESP8266> "AT+CIFSR"
    ESP8266> "+CIFSR:STAIP,\"192.168.200.232\""
    ESP8266> "+CIFSR:STAMAC,\"18:fe:34:9e:2d:29\""
    ESP8266> ""
    ESP8266> "OK"
    Uncaught Error: WiFi network connection failed
    

    You can see the connection works - but the return status is wrong

About

Avatar for magore @magore started