0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ What communications type or parameters are required for programming? Assuming you have a uart connection, and it is one that can utilize an appropriate baud rate (could be an issue if you are using "soft" serial on a single-uart AVR) then it's not obvious what the issue here would be. \$\endgroup\$ – Chris Stratton May 25 '15 at 19:40
1
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ I am upvoting the answer. A digital switch is a good idea. However I will keep looking for an answer, for a while, that eliminates the requirement of PL2303. \$\endgroup\$ – Zgrkpnr May 25 '15 at 20:43
  • \$\begingroup\$ Did you google for an USB-to-serial app or library for your particular AVR? That would require a two-step programming sequence, but without the PL2303. \$\endgroup\$ – Wouter van Ooijen May 25 '15 at 21:24
0
\$\begingroup\$

The ESP protocol is pretty straight forward. Not reason why you couldn't implement it in the AVR. You might want to add an SD card to the AVR to act as storage, so you can send the binary files up to the AVR in their entirety then tell it to program them to the ESP.

You could start by understanding how the python version of esptool works and implementing the parts that you need in C++.

\$\endgroup\$

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.