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

migrated from electronics.stackexchange.com Feb 16 '17 at 16:08

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Are you sure 57600 is the correct baud rate? Wasn't it 115200? – anrieff Feb 16 '17 at 0:12
  • I have tried both, nothing changes – Anelito Feb 16 '17 at 0:17
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.

  • I tried and I still get the same error – Anelito Feb 25 '17 at 17:18
  • Could you post a circuit diagram of what you tried, please? – Mark Smith Feb 25 '17 at 18:32
  • Sure, check it out now – Anelito Feb 25 '17 at 20:14
  • According to your new schematic, RST is tied to GND. Is that just a mistake in the drawing? – Mark Smith Feb 25 '17 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 – Anelito Feb 26 '17 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.