Arduino DUE as a FTDI programmer

Hi,

I want to use Arduino DUE board as a FTDI programmer.

The task is to program ESP32 module which is connected to the Arduino Serial port.

I can use only DUE Native port. There is no DUE programming port in my design.

Thank you very much.

Which ESP32 module?
Exactly how is it connected to the Due?

I'm using ESP32-WROOM-32 module.

Here is my code uploaded to the DUE:

void setup() {
// put your setup code here, to run once:
Serial3.begin(115200);
SerialUSB.begin(115200);
pinMode(50, OUTPUT);
pinMode(52, OUTPUT);
digitalWrite(50, LOW);
digitalWrite(52, LOW); // LOW ESP32 program
delay(1000);
digitalWrite(50, HIGH); // ESP32 EN on
delay(1000);

}
}

void loop() {
// put your main code here, to run repeatedly:
uint8_t c;

if(Serial3.available()){
c = Serial3.read();
SerialUSB.write(c);
}

if(SerialUSB.available()){
Serial3.write(SerialUSB.read());
}

}

ESP32 module is connected to the DUE serial port.
After programming DUE I select ESP32 Dev Module from the board list and trying to program ESP32 module.

I got the following error:
esptool.py v2.0-dev
Connecting...

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Any luck with this?