Chat freely about anything...

User avatar
By dpux
#29891 I am using an ESP-01 with a USB/UART converter http://www.seeedstudio.com/wiki/USB_To_Uart_5V/3V3 on Mac 10.10.5.

I have wired everything as per the tutorial here http://www.esp8266.com/wiki/doku.php?id=getting-started-with-the-esp8266 EXCEPT that I am not using any resistors as suggested in the post.

AT commands were not working on the chip when I got it, so I decided to flash NodeMCU firmware https://github.com/nodemcu/nodemcu-firmware using esptool https://github.com/themadinventor/esptool

I am able to flash successfully with GPIO-0 set to GND, voltage set to 3.3V and RESET high.
But still, no AT commands work on the serial monitor. I removed GPIO-0 connection from breadboard. Also tried removing RESET with no success. From the Esplorer tool, I am not even able to connect to the board after I flash and remove GPIO-0.

So I decided to upload the example WiFi server code which I had previously run on a NodeMCU 0.9 board (with ESP12). I am able to run upload that code even from the Arduino IDE. But after upload, none of my Serial.print outputs are displayed on Serial Monitor.
User avatar
By Barnabybear
#29917 Hi, you will have problems if:
GPIO 2 is low at boot or connected directly to 3.3V when runnuing.
I recomend pulling high with a resistor of your choice between 1k & 10K.

Vcc ->3.3V
Reset -> 3.3V
CH_PD -> 3.3V
GPIO 0 -> 3.3V via a 10K resistor
GPIO 2 -> 3.3V via a 10K resistor
GND ->GND
Tx -> Rx
Rx -> Tx
That should boot and run correctly. To flash, leave the resistor in place short GPIO 0 to GND, power of and back on.
User avatar
By dpux
#29952 Thanks for your reply.
I did exactly as you suggested, but no success.

For flashing, my setup is :
Vcc ->3.3V
Reset -> 3.3V
CH_PD -> 3.3V
GPIO 0 -> GND
GPIO 2 -> 3.3V via a 10K resistor (I once tried with GPIO2 left open too)
GND ->GND
Tx -> Rx
Rx -> Tx

Flashing succeeds using esptool (run as root)
Code: Select all./esptool.py --port=/dev/cu.wchusbserial1450 write_flash 0x0 /var/folders/r7/41c230xj3fz8d70lnbcbqg540000gq/T/build4549159985828382406.tmp/WiFiWebServer.cpp.bin -fs 32m -fm dio -ff 40m


The WiFiWebServer.cpp.bin is from the examples included with esptool. I just added more Serial.print statements to check initialization.
Code: Select all#include <ESP8266WiFi.h>

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

// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  delay(10);

  Serial.print("Starting up... ");

  // prepare GPIO2
  pinMode(2, OUTPUT);
  digitalWrite(2, 0);
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  server.begin();
  Serial.println("Server started");

  // Print the IP address
  Serial.println(WiFi.localIP());
}

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the request
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();
 
  // Match the request
  int val;
  if (req.indexOf("/gpio/0") != -1)
    val = 0;
  else if (req.indexOf("/gpio/1") != -1)
    val = 1;
  else {
    Serial.println("invalid request");
    client.stop();
    return;
  }

  // Set GPIO2 according to the request
  digitalWrite(2, val);
 
  client.flush();

  // Prepare the response
  String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";
  s += (val)?"high":"low";
  s += "</html>\n";

  // Send the response to the client
  client.print(s);
  delay(1);
  Serial.println("Client disonnected");

  // The client will actually be disconnected
  // when the function returns and 'client' object is detroyed
}


After flashing, I plug out the USB-FTDI, and change setup to this before plugging back in :
Vcc ->3.3V
Reset -> 3.3V
CH_PD -> 3.3V
GPIO 0 -> 3.3V via a 10K resistor
GPIO 2 -> 3.3V via a 10K resistor (I also once tried with GPIO2 left open)
GND ->GND
Tx -> Rx
Rx -> Tx

I launched Serial monitor with board as "Generic ESP8266" and correct port. But I don't see anything logged on serial monitor.
When I tried connecting from Esplorer, it doesn't even open connection (stuck up in Connecting without any errors).
User avatar
By dpux
#29954 I would like to add some more findings. I hadn't tried the Espressif ESP firmware yet. So I tried flashing some versions with different results :
1. With AI-v0.9.5.0_AT_Firmware, I was still not able to use any AT commands after flashing. Esplorer tool doesn' connect either.
2. With v0.9.2.2 AT Firmware, I see the blue light flashing brightly on the ESP chip. Esplorer does connect to the chip, but I see these error messages without stop :

Code: Select alla)!���BBB�a�� F��RbB�/VT�#��R��)��R�����R�!!qc
 ets Jan  8 2013,rst cause:4, boot mode:(3,0)

wdt reset
load 0x40100000, len 25020, room 16
tail 12
chksum 0x55
ho 0 tail 12 room 4
load 0x3ffe8000, len 3280, room 12
tail 4
chksum 0x1d
load 0x3ffe8cd0, len 6468, room 4
tail 0
chksum 0xe1
csum 0xe1
Fatal exception (0):
epc1=0x401060d1, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000


3. I also pulled the sources and built ESP-firmware on my Mac. The ran the following command to flash :
Code: Select all./esptool.py --port=/dev/cu.wchusbserial1450 write_flash 0x00000 esp_iot_sdk_v1.3.0/bin/boot_v1.2.bin 0x01000 esp_iot_sdk_v1.3.0/bin/at/user1.1024.new.2.bin 0x7e000 esp_iot_sdk_v1.3.0/bin/blank.bin 0xfe000 esp_iot_sdk_v1.3.0/bin/blank.bin -fs 32m -fm dio -ff 40m

After re-connecting, blue light on chip blinks continually as in #2. But the USB port stops showing up, so I cannot connect to Arduino or Esplorer to see if AT commands work.