Site Information

 Loading... Please wait...


espBerry Project: ESP32 with CH9102F USB-UART Chip for Serial Speed up to 3Mbit/s

Posted by Wilfried Voss on

I have a project that involves the ESP32-DevKitC development board where the application requires the fast transport of data per USB. The onboard USB-UART bridge chip provides transfer rates of up to 3 Mbps. In addition, the ESP32 has three UART interfaces, i.e., UART0, UART1, and UART2, which provide asynchronous communication, communicating at a speed of up to 5 Mbps. This post describes the serial port programming per UART0, using the Adafruit WCH CH9102F Friend - USB to Serial Converter, which supports up to 3 Mbps. 

However, when working with the ESP32 under the Arduino IDE, you will notice that the Serial command works just fine but Serial1 and Serial2 do not. The ESP32 has three hardware serial ports that can be mapped to almost any pin. In order to get Serial1 and Serial2 to work, you need to involve the HardwareSerial class. As a reference, see ESP32. Arduino and 3 Hardware Serial Ports.

The above image shows my test setup, using our prototype board of the  espBerry (which we plan to release in June 2023). The espBerry board turned out to be the best prototyping solution to quickly test the CH9102F USB-UART converter with the ESP32 processor.

On the ESP32 Dev board, I assigned IO15 as Rx and IO16 as Tx, which are connected to GPIO16 and GPIO20 on the 40-pin header. as shown below:

On the Raspberry Pi prototyping board, I connected the Rx, Tx signals (crossed as shown below) and Gnd.

The ADafruit website does not point to a schematic of the CH9102F breakout board or the pin assignment, but below image shows the location of Rx, Tx, and ground:

A specific driver installation was not necessary under Windows 10/11 (I tested both), i.e., the OS detected the device correctly without any problems, assigning it a COM port number.

I will not get into the details of my test program, since it's a mere printout of "Hello World!" per ESPSerial1.println. The crucial part is the setup of port as shown here:

Using the above shown code enables you to access Serial1 (in above case named ESPSerieal1) using the regular Serial class functions, such as print, println, read, write, etc.

And while the program was easy to write, the hardware test turned out to be a bit more challenging. I used the regular Windows terminal apps, such as Realterm and TeraTerm. However, they accept only baud rates up to 921,600 baud. In addition, the Arduino IDE Serial Monitor may offer higher baud rates but they simply don't work.

Fortunately, a few years ago, I developed a VisualStudio C# code to simulate the Arduino IDE Serial Monitor, which allows me to modify the baud rate up to 3 Mbps and beyond:

Note: In my program, I read the COM port looking for inputs that, in turn, trigger the printout "Number One" and "Number Two."

The above image shows the communication at 3 Mbps, and I successfully tested serial data transferred in both directions. Click here to  download the Visual Studio C# code I used for the Serial Monitor replication (.zip file).

Electronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled DevicesElectronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled Devices

Copperhill Technologies highly recommends using this book for your wireless application projects. Yes, many good books and free online resources are available these days, but this is the book we are using. It made our approach to Bluetooth, BLE, and WIFI a breeze. Programming wireless applications without hassles was fun, and we will share them on this web page.

Projects throughout the book utilize the wireless functionality and processing power of the ESP microcontrollers. Projects are built in the Arduino IDE, so you don't need to download other programming software. In addition, mobile apps are now ubiquitous, making the app build projects of the book very relevant, as are the web page design projects.

In Electronics Projects with the ESP8266 and ESP32, you'll see how easy and practical it is to access information over the internet, develop web pages, build mobile apps to remotely control devices with speech recognition, or incorporate Google Maps in a GPS route tracking app.

More Information...

LIN Bus Simulation Device with USB Interface Controlled by Windows Software

The Baby-LIN-II by Lipowsky Industrie-Elektronik is a compact system for controlling a LIN BUS network via USB. The PC works as a LIN monitor, LIN Master, or LIN Slave. The system also supports operation in stand-alone mode and allows the execution of continuously running sequences without a PC. In addition, the galvanic isolation guarantees interference-free data transmission. The [...]

Read More »

Four Channel CAN Bus to USB Gateway Using The Arduino Due

In the past, I frequently received inquiries regarding the availability of a four-channel CAN Bus gateway. Such devices exist in the marketplace; however, they are usually costly, and, after all, they don't support easy customization or programming. While we at Copperhill Technologies have the ability to create such a gateway, this is primarily a matter [...]

Read More »

CAN Bus, SAE J1939, NMEA 2000 Programming With ESP32, Supporting USB, Bluetooth, BLE, And WiFi

The  ESP32 Series of modules by Espressif supports the integration of WiFi, Bluetooth, and Bluetooth LE for a wide range of applications, most prominently for IoT (Internet of Things). For instance, using WiFi ensures connectivity within a large radius. Using Bluetooth allows the user to easily detect (with low-energy beacons) a module and connect it to [...]

Read More »

USB Device For I/O Testing And Prototyping Supports, Classical CAN, CAN FD, CANopen

DAB-Embedded introduced its USB2IO interface explorer, a device that connects USB to various I/O interfaces for prototyping and functionality tests of electronic devices with CAN, CAN FD, and CANopen interfaces.The product combines a protocol analyzer, data-logger, communication interface, an embedded functional test platform, and basic signal generator. The device targets electrical engineers, firmware developers, enthusiasts, and [...]

Read More »

Testing The SAE J1939 to RS232 & USB Gateway By Copperhill Technologies

In this post, I will demonstrate the test setup of our SAE J1939 to RS232 & USB Gateway. The JCOM.J1939.SER gateway is a high-performance, low-latency, serial vehicle network adapter for SAE J1939 applications. It allows any host device with an RS232 or USB port to monitor SAE J1939 data traffic and communicate with the SAE J1939 vehicle [...]

Read More »

ARM Cortex M4 Single-Chip MCU Supports CAN Bus, USB, Bluetooth for IoT And Gateway Applications

Renesas introduced its RA4W1, an MCU with an integrated CAN Bus, USB, and Bluetooth 5.0 Low Energy (BLE). The single-chip MCU includes a 48 MHz, 32-bit Arm Cortex-M4 core, and Bluetooth 5.0 core delivered in a 56-pin QFN package.The MCU enables designers of embedded systems to develop IoT (Internet of Things) endpoint devices for Industry 4.0, [...]

Read More »

USB/CAN Interface For Direct Connection To Embedded PC Motherboards

The CPC-USB/embedded by EMS Thomas Wunsche represents a CAN Bus interface designed for use with internal USB ports. Due to its compact size, it is well suitable for applications in embedded PCs. It is installed straight at a SUB-D9 enclosure opening or a slot panel, and it is wired per included cable to a pin connector of [...]

Read More »

3.5" SubCompact Board With 8th Generation Intel® Core™ i7/i5/i3/Celeron® Processor SoC

AAEON, a designer and manufacturer of advanced industrial and embedded computing platforms, introduced its GENE-WHU6 subcompact board, powered by 8th Generation Intel Core processors. Despite its size, the board provides extended functionality, and it can deliver the versatility of a desktop system.GENE-WHU6 fuses processing power with up to 32GB of DDR4 SODIMM RAM for computing performance.Designed for [...]

Read More »

CAN FD To USB Gateway Project With Teensy 3.2 And Microchip MCP2517FD CAN FD Controller

Our Teensy 3.2 With CAN FD Breakout Board provides all the components needed to create your CAN FD to USB-Micro Gateway. The board comes with the Microchip MCP2517FD CAN FD controller, while the Teensy 3.2 provides the USB connection. It also has an onboard 5 VDC regulator and reverse-voltage protection. The MCP2517FD is a cost-effective and small-footprint CAN [...]

Read More »