Is it possible to program ESP8266 from another microcontroller

avresp8266

I am using PL2303 USB to TTL adapter to program ESP8266, but I do not want to unplug it from system and plug it into PL2303 all the time. That's why I want to program it in system, with my AVR (the AVR is already connected to ESP8266 in the device that I intended to build).

What I want to achieve is that I just restart ESP8266 in flash mode (by hand. It is not a big deal, I can do it myself) and program it using AVR.

I could not ask a clearer question, because I couldn't think of any close solution. Please tolerate my confusion.

NOTE: Uploading a code to AVR which makes AVR act like USB to TTL adapter can be an option for me. That way, I can upload the code I wrote for ESP8266 through AVR.

NOTE 2: I am seeking for a help that eliminates the requirement of PL2303 and use directly AVR to program ESP.

Best Answer

I assume you are compiling and uploading (running esptool) on the PC. What I would try is:

Connect the serial lines from the PL2303 to the ESP8266 via two series resistors (start with trying 1k). Keep the AVR (which I assume is also connected to the serial pins of the ESP) in reset while downloading to the ESP. When the AVR comes out of reset it can 'take over' the seria lines because its output is much stronger than the 1k-impedance signal from the PL2303.

Notes - the AVR is connected directly to the ESP pins - you only need a resistor in the Rx line of the ESP, but why no put one in both - you might have to lower the esptool baudrate - you can do this in a more fancy way with a real switch, a digital switch, an analog switch, or even a relay