Taken from YouTube - Tech Studycell "How to program ESP8266 ESP-01 with Arduino Uno and FTDI232"
The guide says to press the reset button when the "connecting....____....." shows up in the terminal of the Arduino. When I press the button, sometimes, nothing happens and the Arduino keeps trying to connect until it times out:
A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
But sometimes, upon pressing the reset button, the Arduino seemingly connects to the ESP but the following error is given:
A fatal esptool.py error occurred: Invalid (unsupported) command 0x8
I understand replicating this error is near impossible but if you have any suggestions on how to troubleshoot/fix this error, please let me know.
I had a link to a decent tutorial, but since then the same tutorial has been modified, and i do not support it anymore. (so now i'll end up typing out again, mind you there are still decent tuts out there probably
Basically if you have an Uno just like me and you want to upload a code to an ESP-01.
Upload an Empty sketch onto the Uno (or blink or something, nothing that uses the UART)
This will leave the USB to TTL converter to be used by us. If it a genuine UNO the USB to TTL should be a 16U2, but it may be a clone i guess. In that case the 3.3v regulator may or may not provide enough power to connect to WiFi but that is a different matter.
Connect as follows
UNO ESP
3.3v Vcc
3.3v CH_PD
3.3v RST
GND GND
TX TX (we are using the converter, not communicating with the 328P)
RX -> 1K -> RX ->1K -> 1K -> GND (this is the voltage divider, it belongs to the 3.3v device)
Now if you connect GPIO 0 to GND and reboot the ESP, it will go into upload-boot mode,
Now you can upload using the UNO as a USB to TTL converter.
The messages that the ESP sketch is producing should be visible in the serial monitor.
What goes for the UNO in this also goes for the Mega.
Keep in mind that the internal LED on an ESP-01 is on gpio 1 (TX) so modify blink to use that pin.
Thanks for the suggestion. I tried the setup you mentioned (voltage divider and reset set to high) but the problem persists. I assume with your setup, the reset button was removed entirely and the reset line was set to HIGH (3.3V)? Having done so, the Arduino prints the connecting message for a few seconds and then times out with the following error:
Connecting........_____..
A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
I should also mention that I am using a genuine Arduino Mega and have tested the 3.3V line which showed it being stable.
Yes of course, If you power up with GPIO 0 pulled LOW the esp-01 will go into upload mode.
First we need to try and upload. Are you sure you have a program on the Mega that does not use Serial ?
Do you have the correct board & port settings ?
Can you show me a picture of the ESP-01 you have ?
Are you connecting the TX & RX pins correctly ?
So just to make sure you also have GPIO connected to GND (i see i didn't put it in my list)
You could try 'generic ESP8285' as a board, those are a version of ESP-01 that uses a different type of Flash chip. I have a whole bunch of those and i know they are being sold. They look almost identical to esp8266 ESP-01
Yours actually doesn't look like it is, but try it and if that doesn't work, at least we have excluded that as a possible cause.
Yes, the GPIO is connected to ground. I tried using generic ESP8285 but the same thing happens. I also ordered a new ESP-01 just to make sure it wasn't a hardware issue. But, the same thing happens with the new ESP also.
Ok there must be something wrong in what you do. You have uploaded 'blink 'to the Mega ? (or empty sketch.
the ESP's GPIO 1 (TX) is connected to the Mega pin 1 (TX0->)
The ESP's GPIO 3 (RX) is connected to the Mega Pin 0 (RX0<-) Via a voltage divider (make sure the resistor values are not to High, it won't work with 10K at upload speed)
3.3v comes from the Mega 3.3v, should be fine.
Shared GND.
GPIO 2 is free-floating or pulled up, GPIO 0 is pulled LOW.
CH_PD & RST are both pulled HIGH (3.3v)
Have have swapped the USB cable (should not be the issue if you can upload to the Mega) And have the correct COM port (it disappears from the list when you unplug it)
You are most likely using the newest core, should be fine, most older cores are also ok (i still use 2.4.2 for it's size) And anyway doesn't interfere with the upload.
I don't know what to tell you, other than, disconnect everything and re-connect everything, test every connection with a multimeter. Show us a picture of your setup.
In the end the only thing i haven't suggested is to grab a different USB to TTL converter. You seem to have everything else the way i think it should work (and works for me !)
After many attempts and debugging, I couldn't get the above method for programming and ESP-01 to work. So, I ended up buying the ESP-01 programmer and soldered a push button between GPIO0 and GND. By holding this button when plugging the programmer into the PC, you can enter programming mode. Then, you simply just select the board ("Generic ESP8266 Module") and the COM port and press upload. This worked for me.