Trouble with uploading ESP8266 through Leonardo CDC port

Hi,

I want to use an Arduino ProMicro as USB to serial adapter (which works well) to program an ESP8266 with the Arduino IDE (which does NOT work directly).
I believe there is an issue with how the Arduino IDE handles the USB CDC port of an Arduino ProMicro when switched to "Generic ESP 8266 board" for the following reasons:

  1. When switched to "Arduino Leonardo ETH" the Arduino IDE Serial Monitor works flawlessly with the ProMicro CDC port, I can send and receive serial data.
  2. After switching to "Generic ESP 8266 board" Arduino's serial monitor no longer works on the very same port. Data is being sent and received by the device, but serial monitor no longer shows incoming data.
    I suspect that this is linked to the handling of DTR/RTS signals inside the Arduino IDE as I can provoke the same behavior with a terminal program like hterm by deactivating DTR/RTS handshaking.
  3. When actually trying to program the ESP through the ProMicro, by monitoring the hardware uart lines going from ProMicro to ESP, I see that the IDE is sending data that comes through and that the ESP is answering, but the answer doesn't make it back to the IDE.
  4. By using a virtual nullmodem cable (com0com software) and some PC code that virtually connects the ProMicro CDC port to the virtual nullmodem cable, the intended ESP uploading actually works when I connect the Arduino IDE to the other end of the virtual nullmodem cable. My PC code takes care that DTR/RTS is properly handled on the ProMicro side. So, this works but it is very inconvenient.

Any chance to get this fixed?

  1. how is it wired?
  2. what code do you use in Micro to bridge data from USB port to the esp8266 module?

Juraj:

  1. how is it wired?

Very straight forward:
Leonardo TX to ESP RX and vice versa.
But the trouble is on the USB side.

Juraj:
2) what code do you use in Micro to bridge data from USB port to the esp8266 module?

/*
  leo_usb2serial
  Allows to use an Arduino Leonardo as an usb to serial converter.
 */

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  
  // copy from virtual serial line to uart and vice versa
  if (Serial.available()) {
    char c = (char)Serial.read();
    Serial1.write(c);
  }
  if (Serial1.available()) {
    char c = (char)Serial1.read();
    Serial.write(c);
  }
}

there is no DTR connection on ATmega32u4 boards.
did you select 115200 as upload speed to esp8266?
change the both if to while. the communication with the esp8266 bootloader is in request/response blocks of bytes.

if it runs, you can make it convenient by letting the ATmega control the esp8266 resets:

there is no DTR connection on ATmega32u4 boards.

I know that. Handshaking is going on deep in the USB firmware by means of software.
But fact is that a terminal program must operate DTR/RTS in order to receive data from the USB CDC port and the Serial Monitor of the Arduino IDE does not receive data if switched to Generic ESP8266.

So, clearly a bug in the IDE.

And as said uploading works with a software patch, so this is not a problem of my hardware or my settings.

Is this the right place to post a bug in Arduino or should I post it someplace else?

tom_iphi:
I know that. Handshaking is going on deep in the USB firmware by means of software.
But fact is that a terminal program must operate DTR/RTS in order to receive data from the USB CDC port and the Serial Monitor of the Arduino IDE does not receive data if switched to Generic ESP8266.

So, clearly a bug in the IDE.

And as said uploading works with a software patch, so this is not a problem of my hardware or my settings.

Is this the right place to post a bug in Arduino or should I post it someplace else?