0

I am trying to program an ESP8266-01 WiFi module using an Arduino Uno as a USB to TTL programmer. I have removed the ATmega and grounded the RESET pin (quite useless without the uC though). Then, using esptool.py I tried to upload a Bare minimum sketch with the Arduino IDE and later using the following:

python esptool.py -b 57600 -p /dev/cu.usbport write_flash 0x000000 "nodemcu.bin"

However, both ways give me the same output:

A fatal error occurred: Failed to connect to ESP8266: Invalid head of packet ('\x08')

I have tried sending AT commands to the ESP01 like "AT" or "AT+GMR" and everything works fine, but I cannot upload any sketch because of that error.

I also followed esp8266 official forum advice to edit the Python script according to the following, but without success.

Line 43 ESP RAM BLOCK = 0x1800 //change this to 180
Line 44 ESP RAM BLOCK = 0x400 //change this to 40

The level conversion from 5v TTL to 3.3v is done through simple resistor node (2k and 1k), while RST is kept at Vcc through 10k pull-up resistor and a push button to ground it.

Wiring

asked Feb 15, 2017 at 23:47
2
  • Are you sure 57600 is the correct baud rate? Wasn't it 115200? Commented Feb 16, 2017 at 0:12
  • I have tried both, nothing changes Commented Feb 16, 2017 at 0:17

2 Answers 2

0

Your wiring sounds wrong.

Tie CHPD to Vcc (3.3v) to enable the device.

Tie GPIO0 to ground as you power up, to put it into programming mode.

RST can be left floating, or PULL (not tie!) up to Vcc through a resistor, say 10k.

That diode level shifter arrangement is unusual. A potential divider on the ESP's RxD is all you need - say 1k and 2k.

answered Feb 16, 2017 at 17:40
5
  • I tried and I still get the same error Commented Feb 25, 2017 at 17:18
  • Could you post a circuit diagram of what you tried, please? Commented Feb 25, 2017 at 18:32
  • Sure, check it out now Commented Feb 25, 2017 at 20:14
  • According to your new schematic, RST is tied to GND. Is that just a mistake in the drawing? Commented Feb 25, 2017 at 20:52
  • Yes it was a mistake, RST goes to Vcc through a 10k resistor as you suggested and to GND via push button Commented Feb 26, 2017 at 0:16
0

An addition to Mark's answer, from Uploading sketch to ESP8266

Before download, pull both GPIO0 and RST to ground. Release the pull down on RST, but keep GPIO0 low. When the IDE has finished uploading, release GPIO0 from low.

answered Feb 26, 2017 at 15:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.