Can an Arduino be used to upload code to an ESP8266?


I had purchased a nodeMCU, and I (by accident) fried the cp2102 chip that allowed the esp to communicate with my pc by exposing it to higher than recommended voltage. I had some old code on there that allowed it to connect to my wifi, and when I powered the nodemcu with my arduino via the pins, I could see it appear on my network. So essentially, the esp chip still works, but the cp2102 does not. Could I use my arduino to upload code to the esp?

Thanks in advance,


Well, you didn't mention what Arduino you have. Something like an Uno has a USB-to-serial chip on it. You could remove the ATmega328P from the board and you would essentially just have a USB-to-serial board left. Or if you put a jumper between reset and ground, it would hold the ATmega328P chip permanently in a state of doing nothing, which is similar to removing the ATmega328P. Then you could use the RX, TX, and GND pins to communicate with something else.

I have a Mega 2560. After connecting the pins, how would I go about uploading the code? Current wiring: Mega TX0 -> NodeMCU TX Mega RX0 -> NodeMCU RX 5v -> Vin GND -> GND GND -> RESET

I have tried just simply using the upload button, but it says error: espcomm_open failed error: espcomm_upload_mem failed By the way, I am receiving serial output from the esp on the serial monitor, so that much works.

It looks like your wring is OK, and it is good you are getting info on the serial monitor. So, I think you are almost there. I don't have firsthand experience with NodeMCU so somebody else may need to answer. One thing I don't know is how the NodeMCU knows an upload is coming in. On an Uno, the serial adapter's DTR pin is connected through a 0.1uF capacitor to create a short reset pulse to reset the MCU and therefore run the bootloader. I don't know how that sort of thing works on NodeMCU. If it works the same way, you would be missing that auto reset signal. If you remove the ATmega328P from the Uno and do not connect reset to ground, the reset pin on the Uno will output a short reset pulse at beginning of serial communication.