0
\$\begingroup\$

I've done a USB to UART programmer board. I use Arduino IDE (macOSX)to upload a sketch. If I short RX and TX on a programmer board it works as it should. All I enter in the Serial Monitor it shows me back. But when I try to upload a sketch to my ESP8266-12e it shows me this:

trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

I connect ESP as it is written in a datasheet for UART. Tried different ways to start ESP described in lots of links available online. Seems like ESP works fine itself. The led blinks as it should. But it looks like it doesn't communicate with the CH340G. If I reset it, it shows strange chars in serial monitor at all possible speeds. I've tried to connect it to Arduino to upload a sketch and it doesn't work with Arduino Nano as well. I've tried other ESPs and they are not working. I've tried connect Arduino to my programmer board and it's not working. My mac sees CH340G serial port. I used the same schematics and components as on Arduino Nano for my programmer board. When I connect my Nano board Arduino IDE uploads the sketches to Nano fine. Also I have an ESP board with a built in CH340G and it works. But my schematics is not working. I tried to replace the CH340G by a chip from a working nano board and put my one to the board. All chips works fine on the nano board but doesn't work in my schematics. What am I doing wrong? enter image description here

I've tried to put decoupling caps. But it doesn't help. I've tried esptool in terminal to check the board. It can't connect.

\$\endgroup\$
3
  • \$\begingroup\$ Create a program which both prints some serial messages and echos back anything it receives; use something else to program that into the chip, and then see if you can get data through your newly built adapter. Probe with a scope or logic analyzer if not. Once that works, pay attention to the need to reset the target to a bootloader (and for the ESP, into bootloader mode). In the case of the ESP you might try manually resetting with the appropriate bootloader strapping input manually held - spend some time researching those requirements yourself until you thoroughly understand how it works. \$\endgroup\$ – Chris Stratton Sep 26 '20 at 15:26
  • \$\begingroup\$ When I short rx to tx on the ch340 board it works like you say in an Arduino serial monitor. It sends and receives everything I type in the send feild. As for ESP I manually reset it. \$\endgroup\$ – Anton Zimin Sep 26 '20 at 22:12
  • \$\begingroup\$ You already said that. What I said was that you should make a program which sends and receives serial data, and try that when you have already loaded the program and aren't relying on the CH340 for programming. And that if even that doesn't work, you need to check the signals with a scope. \$\endgroup\$ – Chris Stratton Sep 26 '20 at 23:28
1
\$\begingroup\$

On both devices, the TXD is an output pin, and RXD is an input pin. They should be connected so that TXD output on one device is connected to RXD input of another device.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Tried it both ways. Not working. \$\endgroup\$ – Anton Zimin Sep 26 '20 at 14:20
0
\$\begingroup\$

Sorry if I am stating the obvious. But, have you used the Reset and Burn button to bring the module to flash mode?

Connect the ESP-12E/F module directly to the CH340 IC is not enough. In order to the CH340 flash code in the ESP-12E/F module, you need to put the module in flash mode.

For that, you would use the buttons RST and GPIO0 in a combined operation. RST and GPIO0 to LOW, then release RST before GPIO0.

When you press the Upload button in the IDE, the IDE will send commands to CH340 through its D+ and D- pins. That will tell the CH340 that a flash operation is coming.Then, the ESP-12F needs to go to flash mode to be able to start the transmission

You could add additional circuitry to automatically achieve this though

This additional circuitry usually is composed by 2 NPN transistors and a couple of resistors. Or, you can use a IC which already contains all you need as UMH3 https://datasheet.lcsc.com/szlcsc/1809211024_Changjiang-Electronics-Tech-CJ-UMH3N_C62892.pdf

This is the piece of circuitry you could added to your design

enter image description here

Pay attention to the labels as RTS(Request to Send) can easily be confused with RST(Reset).

Also keep in mind that the RX and TX are inverted between the 2 devices. While 1 is transmitting the other is receiving and vice-versa.

\$\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.