I’m trying to create a portable Serial Monitor using a CYD. It works perfectly using the ESP32 TX & RX UART. Now I want to use the the USB To TTL Converter UART Module CH340 which I have bought so I can just plug it into the USB-C port of the ESP32 and convert the serial data into TTL. I’ve tried the USB To TTL Converter on my MacBook and it works fine, sending and receiving. When it’s plugged into the ESP32 no data is being transmitted.
I’ve put my oscilloscope on the D+ and D- but nothing is being displayed on the scope. Does the ESP32 wait for a command on a USB pin before it will try and send data?
Do I need to tell the ESP32 to transmit data whether the USB cable is connected or not?
When the USB To TTL Converter is connected to the Mac, the TX and RX LEDs flash when transmitting and receiving data so the converter works. I can send data and it’s received and displayed in the serial monitor of the IDE. When sending data from the Mac through the converter to the CYD it’s displayed on the CYD so it definitely works. When connected to the ESP32 I have to power it from ESP32 using 3v3 and ground but nothing. I’ve also tried 5v.
I might be wrong here, but it looks like the ESP32 isn’t actually sending anything over the USB-C port unless USB-CDC is enabled in the firmware.
So the CH340 doesn’t see any USB traffic at all that’s why D+ and D– stay completely silent on the scope.
Since the CH340 isn’t a USB host, plugging it into the ESP32 USB port won’t convert the ESP32 UART into USB automatically.
As far as I understand it, you’d still need to tap into the ESP32’s TX/RX pins if you want the CH340 to read the serial data.
@lexter333 The serial data that is transmitted or received via the usb to the Arduino serial monitor already goes through a serial ttl to usb converter mounted on the esp32 breakout in most cases.
You can access that ttl tx/rx signal without any converter on two of the esp32 pins which is dependent on the model, I have a dev kit which uses gpio1 and gpio3 for txd_0 and rxd_0.
Any connections made to the esp32 gpio should not exceed 3.3v so if you intend using your converter on the esp32 make sure its a type that is ttl 3.3v
It would be nice to see a schematic of the hardware you are using and a code sample I am saying the above based on the picture you posted.
which CYD are you using?
using a CYD_4_inch_FREENOVE_ESP32 I used Serial on GPIO32 Rx and GPIO25 Tx (labelled I2C port) to connect to a RS485 module then to a RS485 bus
I don’t think I have explained myself clearly enough. I already have the portable serial monitor working via the TX/RX on the CYD. What I’m after is plugging the portable serial monitor into the USP port of existing projects (without alterations to the code).
I want to plug the USB To TTL Converter UART Module CH340 into the USB port of the ESP32 and convert it to TTL and read the data on the TX/RX pins of the CYD (which works via TX→RX etc).
In the above diagram, socket 1 is used for power and connects to P5 of the CYD to use the TX/RX of that socket. Socket 2 connects to pins 22 and 27 of CN1 socket on the CYD which are configured as TX and RX also. I connect socket 2 to TX/RX of the ESP32 to the right of the image. That all works great. Now, what I want is to remove lead 2 and connect the TX & RX of converter 3 to socket 2.
How can I do this? I know I have to connect the grounds and power the converter but as stated in the initial post there is no activity on the D+ and D- of the ESP32 USB-C socket.
You can’t do this.
The USB port on the ESP32 is not outputting TTL serial.
It’s a USB device, same as the CH340.
A USB-to-TTL adapter cannot “read” D+/D-, because it needs a USB host, not another USB device.
That’s why there is no activity on D+ / D- the ESP32 isn’t sending raw UART there.
Your only option is to keep using the real TX/RX pins, or add a board that provides USB-host capability.