ESP8266 error

Hey.
i am using an ESP8266.
I am able to upload programs to it successfully but when i open the serial monitor instead of getting the desired output, i am getting ets Jan 8 2013,rst cause:2, boot mode:(1,6) .

I have tried different examples from the library. In all the cases, i am getting the same response.

What should I do now ?

Rst cause: 2 means that you pressed the reset button.
The boot mode tells you where it tries to load the program from.
Did you select the right boot mode using GPIO0, 2 and 15?


(A Beginner's Guide to the ESP8266)

Pieter

i used this code

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ArduinoOTA.h>
#include <ESP8266WebServer.h>

const char* ssid = "*****";
const char* password = "******";

ESP8266WebServer server(80);

const char* www_username = "admin";
const char* www_password = "esp8266";

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  if(WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("WiFi Connect Failed! Rebooting...");
    delay(1000);
    ESP.restart();
  }
  ArduinoOTA.begin();

  server.on("/", [](){
    if(!server.authenticate(www_username, www_password))
      return server.requestAuthentication();
    server.send(200, "text/plain", "Login OK");
  });
  server.begin();

  Serial.print("Open http://");
  Serial.print(WiFi.localIP());
  Serial.println("/ in your browser to see it working");
}

void loop() {
  ArduinoOTA.handle();
  server.handleClient();
}

and now i am getting this in my serial monitor

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld
⸮ TAq⸮⸮
⸮bb⸮@T;q⸮ ⸮⸮
P⸮@⸮a⸮пMCY)

GPIO2 needs a pull-up (missing from your schematic); GPIO0 doesn’t need one (floating or HIGH is the same for boot mode).

RST must be pulled up for reliable operation. Add a 100 nF and a 10-100 uF capacitor as close as possible to the Vcc and GND pins.

DarkL0rd:
i used this code

You do realize it is not just about your code, right ? ? ?

You need proper connection of the pins!!!!

Looks like there could be a baud rate issue as well.
GPIO2 has an internal pull-up, so you don't need an external resistor.

Pieter

PieterP:
GPIO2 has an internal pull-up, so you don't need an external resistor.

It's enabled upon boot? I've designed my circuits with external fixed pull-up, would be helpful to do away with it. Makes the port more usable for other things.
It seems I need to do some more experimenting to make sure. Official documentation is lacking badly for this device...

wvmarle:
It's enabled upon boot? I've designed my circuits with external fixed pull-up, would be helpful to do away with it. Makes the port more usable for other things.
It seems I need to do some more experimenting to make sure. Official documentation is lacking badly for this device...

The folks over at esp8266.com are anal about needing an external pull-up or pull-down as the case may be for all the pins. But Espressif's documentation leaves alot to be desired.

I can only speak for myself and say that on all five of my ESP-01S I have left GPIO0 and GPIO2 floating during boot up and they have worked.

You may be interested in reading ESP8266-01 Pin Magic How to use the ESP8266-01 pins

I'm using the ESP-12F modules (an SMD module), which have all pins available. So may be a bit different than the ESP-01 modules.

wvmarle:
I'm using the ESP-12F modules (an SMD module), which have all pins available. So may be a bit different than the ESP-01 modules.

The only pins that govern bootup are GPIO0, GPIO2, and GPIO15. The ESP-01 doesn't have the latter.

note: - GPIO2 is used as TX output and the internal Pullup is enabled on boot.

(https://github.com/esp8266/Arduino/blob/master/doc/boards.rst)

On top of that, some modules have an LED between GPIO2 and Vcc, so that’ll pull it high anyway.

The ESP-01 seems to have GPIO15 connected directly to ground. Not sure though, I haven’t found any official schematics, but you could probably test this by enabling the internal pull-up, and reading the input pin. If it reads low, then it’s probably connected to ground directly.

Pieter

ieee488:
The only pins that govern bootup are GPIO0, GPIO2, and GPIO15. The ESP-01 doesn't have the latter.

ESP-01 is a breakout module for the ESP8266 chip, and is one of a range of such modules all based on the exact same chip. That the GPIO15 is not broken out doesn't mean it's not there. It must have an external pull-down on board - after all it is involved in the boot process.

The ESP-05 only has TX and RX broken out, so all required external resistors have to be on board. It's designed to be used as WiFi shield for Arduino and indeed can't do much if anything else.

The ESP-12 I refer to is another one; with all GPIO broken out (even the ones that are used to access the internal flash and are quite useless).

There are more such modules. Most with the antenna on PCB, at least one that uses an external antenna (for better range). Also note that not all these modules are FCC approved.

wvmarle:
The ESP-05 only has TX and RX broken out, so all required external resistors have to be on board.

They're not: the only resistor on the board seems to be the 12k resistor for "RES12K". So my guess is that they are connected to Vcc/ground directly.

Pieter

Possible. Should work like that as well, I've heard that before. I will continue to add 10k resistors though, it keeps the ports usable for other things, and sometimes you can reuse those pull-ups for things that require one, like the DHT22.

It's a good idea to use 10k resistors indeed, it also prevents you from accidentally shorting those pins if you set them to outputs.


If you take a look at the PCB of the ESP-05 and ESP-01, you'll see that GPIO15 (4th pin from the bottom right) is connected to the large ground pad under the chip. So no resistors, just a direct connection to ground.
On the ESP-05, GPIO0 and GPIO2 are connected directly to Vcc.

Pieter

wvmarle:
ESP-01 is a breakout module for the ESP8266 chip, and is one of a range of such modules all based on the exact same chip. That the GPIO15 is not broken out doesn't mean it's not there.

I didn't say it wasn't there.

I meant that it wasn't broken out.

I will bow out of this since you are have I shouldn't have bothered to answer your post.