2
\$\begingroup\$

I recently broke my USB port on ESP 32 ...

enter image description here

... so I need somehow program it. I have this FTDI programmer. ...

enter image description here

I tried to flash it (I pushed boot and EN button together and when Arduino IDE finished compilation and started flashing, I released EN and then boot button.)

Connection:

ESP 32 VIN ... VCC programmer (3.3 V)

ESP 32 GND ... GND programmer

ESP 32 TX ... RX programmer

ESP 32 RX ... TX programmer

After this attempt I get this error:

enter image description here

I tried to use this programmer to program Arduino nano and it works. Do you have any sugesstions about programming this ESP 32 without USB port?

\$\endgroup\$
4
  • \$\begingroup\$ You may be missing a key connection or initialization, or you may need to disconnect the on-board USB-serial chip. \$\endgroup\$ Jul 13, 2019 at 17:01
  • \$\begingroup\$ I'm not experienced with ESP32; I bought one and played with one time. I have some experience with ESP8266. I can easily program ESP8266 using an USB-to-serial adapter, BUT, when booting up ESP8266, some pins have to be grounded, and some pins connected to +Vcc. If you connected only Vcc, GND, TX and RX, ESP can't know that you want to write to it, instead of just run the written code. Also, this breakout board probably has connections made in order that the serial data goes to the ESP32 from that little squared chip (near the boot switch), which probably makes USB to serial translation. \$\endgroup\$
    – mguima
    Jul 14, 2019 at 1:14
  • \$\begingroup\$ I'm trying the same thing but with no luck (external power source used). You used the rx2/tx2 or rx0/tx0 pins? \$\endgroup\$
    – xfze
    Apr 14, 2020 at 13:09
  • \$\begingroup\$ I am used tx0. You need to push boot button then en button while you are still holding boot. After this, click upload in arduino IDE. \$\endgroup\$
    – LucasN
    Apr 14, 2020 at 13:42

5 Answers 5

5
\$\begingroup\$

It's unclear from the image if you have set the FTDI adapter to the correct voltage 5.0V or 3.3V (it should be 3.3V).

I have experience programming bare ESP32 modules in this manner, but never a break-out board like this.

Looking at your log and reading through esptool.py is seems clear that you have communication in both directions, otherwise it should have failed earlier - BUT I would verify this by disconnecting one wire (TX, RX) at a time and try a download, just make sure that the download behavior does indeed change.

How are you powering the ESP32? It looks like you are taking VCC from the FTDI adapter. The ESP32 is a bit power hungrier than many other controllers, are you sure your FTDI adapter is able to power it adequately?

Removing the USB/TTL bridge should not be necessary as it should be passive with no USB connected, and most ESP32 breakout boards include a resistor on the bridge TX output to make sure you can "override" the signal externally, like you are doing now. However, if you keep being unable to program I would remove it or cut the relevant traces just to be sure.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ The problem was in powering ESP32. You were right, FTDI adapter wasn't abe to power ESP32. \$\endgroup\$
    – LucasN
    Jul 14, 2019 at 14:45
1
\$\begingroup\$

One also needs to connect DTR and RTS pins. Below is a circuit schematic on how to achieve proper data transmission on a ESP32 MCU boards Using a CH340C SOP-16.

circuit schema

from this author here: https://en.kohacraft.com/archives/make-a-circuit-using-ch340c-for-esp32-writingsuccess.html

This can be done using the CH340K MSOP-10 (10 pin; smaller package).

To add a flash LED status one needs to connect the "EMAC_RX_DV" pin. In the ESP-32 WROOM-32x board is on GPIO 27, PIN 12. See the figure below on how is made for an ESP-32S: UART SETUP for the ESP32S


To upload a program to the ESP-32, manually, ie, without the DTR/RTS connections,

  • open the Arduino IDE Serial Monitor
  • Hold-down the “BOOT” button
  • Press the “ENABLE” button once
  • Release the finger from the “BOOT” button

Do you see the following message in your Arduino IDE Serial Monitor?

“rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download”

enter image description here

After seeing that message, press the “Upload” button in your Arduino IDE to upload a new sketch.

In those boards/with that setup, after uploading a new sketch, press the “Enable” button to restart the ESP32 and run the new sketch uploaded.

the original answer can be found here: https://rntlab.com/question/a-fatal-error-occurred-failed-to-connect-to-esp32-timed-out/

EDIT:

... in the meantime i got time to design in KiCad a fully working MCU firmware downloader that is suitable for ESP32. This one uses the CH340K IC for USB to UART TTL data sync. One can find drivers for that IC here: http://www.wch-ic.com/downloads/CH341SER_ZIP.html

enter image description here

here's the GitHub repo with the KiCad project files available to download: https://github.com/aeonSolutions/AeonLabs-MCU-Burner-USB-to-UART-TTL

\$\endgroup\$
3
  • \$\begingroup\$ If you look at the comment to the accepted answer, the problem was providing enough power to the ESP32. \$\endgroup\$ Dec 26, 2021 at 12:12
  • \$\begingroup\$ @ElliotAlderson, questions need to be read as well. \$\endgroup\$ Dec 26, 2021 at 12:15
  • \$\begingroup\$ @ElliotAlderson i've included now, a github repository with KiCad project files for a fully working firmware downloader for ESP32 xxxxxx or any other such as atmel \$\endgroup\$ Mar 30 at 8:32
0
\$\begingroup\$

I see your connections and there is a problem.

Uploading code to the ESP32 is not the same as uploading code to an Arduino or ESP8266 where we used only RX and TX pins. To upload code to the ESP32 there are some other pins that are used:

  1. RXD0
  2. TXD0
  3. GPIO 13
  4. GPIO 15
  5. GPIO IO0
  6. EN
  7. VCC
  8. GND
  • FTDI PIN ---------------> ESP32 PIN
  1. CTS -----------------> GPIO 15
  2. RTS -----------------> GPIO 13 AND GPIO IO0
  3. RX -----------------> TXD0
  4. TX -----------------> RXD0
  5. DTR -----------------> EN
  6. VCC -----------------> Vin
  7. GND -----------------> GND

After making these connections you can upload code successfully. Don't forget to press the boot button for a while, when starting to upload code.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You only need TX and RX. At least according to ESP32 schematics, the ESP32 datasheet, and my own personal experience. Also, when connected this way, you do not need to press any button to upload (with exceptions; you may be doing things in your code that disables uploading) \$\endgroup\$ Jan 2, 2021 at 19:35
  • 1
    \$\begingroup\$ that is not correct. see my answer above for more details. \$\endgroup\$ Dec 26, 2021 at 12:12
0
\$\begingroup\$

Assuming that you are using a standalone ESP32, no boot or reset button, what I would suggest is pull down GPIO 2 and GPIO 0 to ground, and the standard connection as described above (Tx to FTDI Rx and Rx to FTDI Tx)

Power OFF and ON the supply, you should read over serial (Coolterm or Serialmonitor, etc.) at 115200 baud.,

ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))

ie. you are in boot mode, if you don't power off and on again until you do!

Now, connect

EN to RTS.

GPIO0 to DTR.

GPIO 2 is still ground or floating.

and Tx and Rx as said above.

Try flashing now......

\$\endgroup\$
0
\$\begingroup\$

I connected the GPIO0 directly to the GND and used the 5v power. It worked OK.

\$\endgroup\$
3
  • \$\begingroup\$ Do you mean you used the 5 V option of the FTDI board? This might work a while, but may damage the RX pin of the ESP. \$\endgroup\$
    – Jens
    Sep 12 at 18:33
  • \$\begingroup\$ Yes. How would that damage the Rx pin? The FTDI module uses the USB power and regulates it to 5V. It also has a 3.3 V pin available. I used it to upload a FW to my ESP32 module. \$\endgroup\$
    – Givi
    Sep 13 at 22:25
  • \$\begingroup\$ OK, it sounds as if you used the 5 V pin option to upload the firmware \$\endgroup\$
    – Jens
    Sep 14 at 13:08

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.