ESP8266 doesn't see any APs

Posted on
  • So I finally got my ESP8266 soldered to my pico using the shim and am having a couple of issues but the one I can't get around right now is that it won't see any APs even though there are at least 10 available in my immediate area. Here is the code I'm using:

    Serial2.setup(9600, { rx: A3, tx : A2 });
    var wifi = require("ESP8266WiFi").connect(Serial2, function(err) {
      if (err) throw err;
    /*  console.log("turning on debugging");
      wifi.at.debug(); */
      wifi.getVersion(function(err, version) {
        if (err) throw(err);
        console.log("version = " + version + ", resetting wifi");
        wifi.reset(function(err) {
          if (err) throw err;
          wifi.getAPs(function(err, aps) {
            if (err) throw(err);
            console.log("APs: [" + aps + "]");
          });
        });
      });
    });
    

    and I get the following output:

    version = 0018000902-AI03, resetting wifi
    APs: []

    I also tried using my phone as a mobile hotspot and placing it immediately adjacent to the antenna in case it seemed like an antenna performance problem. Any ideas?

  • BTW, I just soldered up another one and it does exactly the same thing.

  • if I enable the debug output I get:

    turning on debugging
    ["AT+GMR\r\n"
    ] "0" <--- "0"
    ] "00" <--- "0"
    ] "0018" <--- "18"
    ] "001800" <--- "00"
    ] "00180009" <--- "09"
    ] "0018000902" <--- "02"
    ] "0018000902-A" <--- "-A"
    ] "0018000902-AI0" <--- "I0"
    ] "0018000902-AI03\r" <--- "3\r"
    version = 0018000902-AI03, resetting wifi
    ["\r\nAT+RST\r\n"
    ] "\n\r\nOK\r" <--- "\n\r\nOK\r"
    ] "\n\r\nwro" <--- "\n\r\nwro"
    ] "wrong " <--- "ng "
    ] "wrong sy" <--- "sy"
    ] "wrong synt" <--- "nt"
    ] "wrong syntax" <--- "ax"
    ] "wrong syntax\r\n" <--- "\r\n"
    ] "\r\nER" <--- "\r\nER"
    ] "ERROR" <--- "ROR"
    ] "ERROR\r" <--- "\r"
    ] "\n\r\nO" <--- "\n\r\nO"
    ] "OK\r\n" <--- "K\r\n"
    ] "D" <--- "D"
    ] "Da" <--- "a"
    ] "Da!\x1B" <--- "!\x1B"
    ] "Da!\x1B©" <--- "©"
    ] "Da!\x1B©H" <--- "H"
    ] "Da!\x1B©H" <--- ""
    ] "Da!\x1B©Hò" <--- "ò"
    ] "Da!\x1B©Hò)" <--- ")"
    ] "Da!\x1B©Hò)\x02£" <--- "\x02£"
    ] "Da!\x1B©Hò)\x02£\x12" <--- "\x12"
    ] "Da!\x1B©Hò)\x02£\x12#9" <--- "#9"
    ] "Da!\x1B©Hò)\x02£\x12#9e\x00" <--- "e\x00"
    ] "Da!\x1B©Hò)\x02£\x12#9e\x00ì" <--- "ì"
    ] "Da!\x1B©Hò)\x02£\x12#9e\x00ìø" <--- "ø"
    ] "Da!\x1B©Hò)\x02£\x12#9e\x00ìø1Ê" <--- "1Ê"
    ] "Da!\x1B©Hò)\x02£\x12#9e\x00ìø1Êë" <--- "ë"
    ] "Da!\x1B©Hò)\x02£\x12#9e\x00ìø1Êë\r" <--- "\r"
    ] "\n[Ve" <--- "\n[Ve"
    ] "[Vend" <--- "nd"
    ] "[Vendor" <--- "or"
    ] "[Vendor:w" <--- ":w"
    ] "[Vendor:ww" <--- "w"
    ] "[Vendor:http://www." <--- "w."
    ] "[Vendor:http://www.ai" <--- "ai"
    ] "[Vendor:http://www.ai-t" <--- "-t"
    ] "[Vendor:http://www.ai-thi" <--- "hi"
    ] "[Vendor:http://www.ai-think" <--- "nk"
    ] "[Vendor:http://www.ai-thinker" <--- "er"
    ] "[Vendor:http://www.ai-thinker.c" <--- ".c"
    ] "[Vendor:http://www.ai-thinker.com " <--- "om "
    ] "[Vendor:http://www.ai-thinker.com Ve" <--- "Ve"
    ] "[Vendor:http://www.ai-thinker.com Vers" <--- "rs"
    ] "[Vendor:http://www.ai-thinker.com Versio" <--- "io"
    ] "[Vendor:http://www.ai-thinker.com Version:" <--- "n:"
    ] "[Vendor:http://www.ai-thinker.com Version:0." <--- "0."
    ] "[Vendor:http://www.ai-thinker.com Version:0.9.2" <--- "9.2"
    ] "[Vendor:http://www.ai-thinker.com Version:0.9.2.4" <--- ".4"
    ] "[Vendor:http://www.ai-thinker.com Version:0.9.2.4]\r\n" <--- "]\r\n"
    ] "\r\nre" <--- "\r\nre"
    ] "ready" <--- "ady"
    ] "ready\r\n" <--- "\r\n"
    ["ATE0\r\n"
    ] "AT" <--- "AT"
    ] "ATE" <--- "E"
    ] "ATE0\r" <--- "0\r"
    ] "\r\n\r\n" <--- "\r\n\r\n"
    ] "OK\r\n" <--- "OK\r\n"
    ["AT+CIPMUX=1\r\n"
    ] "\r" <--- "\r"
    ] "\nO" <--- "\nO"
    ] "OK\r" <--- "K\r"
    ["AT+CWLAP\r\n"
    ] "\n" <--- "\n"
    ] "\r" <--- "\r"
    ] "\nE" <--- "\nE"
    ] "ERR" <--- "RR"
    ] "ERROR" <--- "OR"
    ] "ERROR\r\n" <--- "\r\n"
    APs: []

    so I'm seeing both a wrong syntax error at the top (right after printing the version) which looks like it is in response to AT+RST (though there is also an OK so I'm not sure of that) and an ERROR in response to AT+CWLAP

  • The syntax error is fine - it's just complaining about the newline before reset (which is needed just in case you reset Espruino in the middle of a command last time).

    The getAPs failure is odd though. I just tried your exact code here and it works for me:

    version = 0018000902-AI03, resetting wifi
    APs: [[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]]
    

    So I'm not really sure what the issue is. Have you tried connecting to a known access point? Does that fail as well?

    I guess it could be something to do with the state the ESP8266 comes in out of the box. I think it comes pre-configured as an Access Point, and maybe you can only list other APs by disabling that (which trying to connect to an AP first would solve?).

  • Yes, I did try to connect to two different known APs and both failed.

  • Maybe you could try the following before the getAPs?

    wifi.at.cmd("AT+CWMODE=1\r\n", 1000, print);
    

    That'll put the module into non-AP mode. The second connect should have done that automatically though, but maybe the fact that it doesn't manage to connect means that it doesn't remember after a reset.

    Also it might be worth trying call getAPs a few seconds after a reset - maybe the ESP8266 needed a few seconds to gather a list of APs (although it didn't on mine).

  • Hmm, neither changes the result. I did manage to get it to connect to an AP even though it wouldn't show it in the list. Guess it's time to dig into the code.

  • Not sure what's up now but I'm just getting gibberish:

    >Uncaught No 'ready' after AT+RST
      at line 2 col 18
       if (err) throw err;
    
     in function "a" called from line 1 col 100
     ...a("No 'ready' after AT+RST");else return b}
    
    in function "b" called from line 1 col 16
     {c=void 0;b&&b()}
    
     in function called from system
     Disconnected
    

    I added a cap (47uf) to the pads on the shim and it is still the same. I don't understand why the change in behavior...

  • Uncaught No 'ready' after AT+RST generally means that there's a problem with communication with the ESP8266. Maybe check your connections as something might have come disconnected?

    Does it actually say Disconnected without you having unplugged it or clicked the disconnect button? That implies something has happened that's made the Espruino reset... Usually when the error occurs it just returns to the prompt, so it could be a hardware issue.

  • Interesting but I'm seeing the same thing from all 3 units now. I'll go over the hardware again as you recommend, maybe I messed something up.

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

ESP8266 doesn't see any APs

Posted by Avatar for mooniac @mooniac

Actions