NetworkJS and http modules not found

Posted on
  • I'm trying to use an ESP8226 and I managed to screw up a couple of picos while trying to solder on the ESP8226 shim. I no longer have shims for the ESP8226 and I am now using: https://www.sparkfun.com/products/13287 There is a switch located on the sparkfun's ESP8266 shield for Software Serial and Hardware Serial. I'm using the Software Serial pins on the ESP8266 shield and used jumper wires from the Hardware Serial RX and TX to pin A2 and A3 for successful communication.

    I ran the firmware js code:

    //var serial = Serial2;
    var pins = { rx: A3, tx : A2 };
    function test(baud) {
      Serial2.removeAllListeners();
      var l="";
      Serial2.on('data', function(d) {l+=d;});
      Serial2.setup(baud, pins);
      Serial2.write("AT+GMR\r\n");
      setTimeout(function(){console.log(JSON.s­tringify(l));},800);
    }
    //digitalWrite(B9,1); // enable on Pico Shim V2
    setTimeout(function() { test(9600); }, 2000);
    setTimeout(function() { test(115200); }, 3000);
    setTimeout(function() { test(57600); }, 4000);
    setTimeout(function() { console.log("Done!"); }, 5000);
    

    Which resulted:

    "AT+GMR\r\r\nAT version:0.30.0.0(Jul 3 2015 19:35:49)\r\nSDK
    version:1.2.0\r\ncompile time:Jul 7 2015 18:34:26\r\nOK\r\n" "\x00"
    "àà\x00\x00" Done!

    I'm assuming that I should use the serial baud rate of 115200 because the ESP8226 firmware is 0.30.0.0?

    I am now attempting to get basic communication from the ESP8226 and using the code below. However, I am receiving

    Module NetworkJS not found

    and

    Module http not found

    Code:

    Serial2.setup(115200, { rx: A3, tx : A2 });
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
      //                ^^^^^^^^^^^^^^^^
      //                Use ESP8266WiFi here (and 9600 baud) if you have an ESP8266 with firmware older than 0.25
      if (err) throw err;
      wifi.reset(function(err) {
        if (err) throw err;
        console.log("Connecting to WiFi");
        wifi.connect("WiFi_Name","WPA2_Key", 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);
            });
          });
        });
      });
    });
    
  • I just updated the picos firmware through the WebIDE and I am still receiving the NetworkJS and http not found error.

  • This is strange. I am not longer receiving the NetworkJS and http not found error; however, I am only receiving this in the Console:

    Uncaught No 'ready' after AT+RST at line 1 col 16 if (err) throw err;

               ^ in function "a" called from line 2 col 100 ...a("No 'ready' after AT+RST");else return b
                              ^ in function "b" called from line 1 col 15 d=void 0;b&&b()
              ^ in function called from system
    

    The Gotchas section of the ESP8226 tutorial page says:

    Uncaught No 'ready' after AT+RST? Check you've got the correct
    firmware and baud rate, and that your wiring is correct.

    After executing the ESP8226 firmware demo code I receive:

    "AT+GMR\r\r\nAT version:0.30.0.0(Jul 3 2015 19:35:49)\r\nSDK
    version:1.2.0\r\ncompile time:Jul 7 2015 18:34:26\r\nOK\r\n" "\x00"
    "àà\x00\x00" Done!
    

    Am I correct by saying that my wiring is correct since I received the version response? I am not sure what else I can do to troubleshoot....

  • I revisited the firmware demo code and echoed out all of setTimeout code except for:

    setTimeout(function() { test(9600); }, 2000);
    

    and I received the firmware printout on the console. So the baudrate the ESP8226 chip on the sparkfun's ESP8226 shield must be 9600.

    I am now trying to execute:

    Serial2.setup(9600, { rx: A3, tx : A2 });
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
      //                ^^^^^^^^^^^^^^^^
      //                Use ESP8266WiFi here (and 9600 baud) if you have an ESP8266 with firmware older than 0.25
      if (err) throw err;
      wifi.reset(function(err) {
        if (err) throw err;
        console.log("Connecting to WiFi");
        wifi.connect("WiFi_Name","WPA2_Key", 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);
            });
          });
        });
      });
    });
    

    and received:

    Uncaught No 'ready' after AT+RST at line 1 col 16 if (err) throw err;

               ^ in function "a" called from line 2 col 100 ...a("No 'ready' after AT+RST");else return b
                              ^ in function "b" called from line 1 col 15 d=void 0;b&&b()
              ^ in function called from system
    
  • So, I'm thinking that I may need to down grade the ESP8226 Firmware to 0.25.0.0? Where can I download the 0.25.0.0 ESP8226 firmware?

  • It's probably at 9600 sine you set the jumper for software serial. That's usual run slower since software serial kinda sucks

  • Wow, I never heard of that before, but what @DrAzzy says sound right (although it should still work at 9600 baud - albeit a bit slowly).

    You could try running wifi.at.debug() to see what the module is sending back - it's possible it is working, but that after it boots it doesn't send the text ready. - for some reason they keep changing what it prints every so often!

  • ... but yes, it's quite likely that flashing to 0.25 would fix it, but ideally we could make the driver cope with 0v30 if that's what comes with Adafruit's boards now.

  • Where I have written ESP8226 I meant to write ESP8266, oops. The baud rate is 9600 :). I'm still getting the Uncaught No 'ready' error. I then tried to communicate directly to the shield via an FTDI and termite(serial terminal). I have the auto line termination set to carriage return and new line. The only command I can get an OK back is AP any other command I send to it results in an ERROR.

    I sent off a bunch of ESP v2 shims to oshpark and ordered a bunch ESP boards from sparkfun. Hopefully my luck will change once I receive those in the mail.

  • I really have no idea why i'm having so many issues with the sparkfun ESP shield. So, I stopped using the sparkfun ESP shield and switched back to soldering the shim v2 of the esp shim to the pico. I soldered 0.1" Female Headers to the ESP through hole section of the shim. Luckly I chose that method instead of soldering the ESP directory to the shim, because the first ESP I had for whatever reason wouldn't work. I swapped it out for another ESP and it worked as expected :-)

    I'm hoping that by using the female headers, it will allow me to stay up to date with the new ESPs and swap them out for future R&D.

  • Great, glad it's working now at least. I wonder if maybe the quality control isn't that good on them at the moment...

  • Hello,
    I am working with espruino and an ESP32. I am getting "module http not found" Do I need to do something to include that module? I am kind of dead in the water without http and https capabilities. My chip needs to call home.

  • It's probably just a warning from the IDE, since there is no JSON file describing ESP32 on the Espruino website at the moment. It should still work.

    But please can you avoid posting ESP32 related questions over questions about official Espruino boards in future? It'll just end up confusing people who've bought proper Espruino boards.

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

NetworkJS and http modules not found

Posted by Avatar for d0773d @d0773d

Actions