ESP32-based RS232 Video Terminal
업데이트 시간: 2021-10-25 14:19:16
uTerm2-S (Mini Term2 Standalone) is an easy to build multi-emulation RS232 terminal using the ESP32-Wroom-32 module and the powerful FabGL library. In addition, using ESP32 makes it easy to use uTerm2-S in many different ways through the Arduino IDE and ESP32 kernel.
Key specifications of these uTerm2-S.
RS232 serial port.
A "transparent" port for the serial USB adapter.
Auxiliary serial port for ESP32 programming using the serial USB adapter.
RTS/CTS support between the RS232 and "transparent" ports.
On-board power supply.
Color, graphics and sound capabilities.
Multi-language keyboard support.
Various terminal emulations.
PS/2 connectors for keyboard and mouse.
On-board amplifiers for external speakers.
In the following figure, uTerm2-S (previous PCB version) connected to a common PC speaker.
COM-USB2 (J3) connector (transparent port)
The uTerm2-S has a "transparent" port for the USB serial adapter (as in the uTerm-S), so you can for example use XMODEM to exchange files with a PC (running a terminal emulator that supports XMODEM file transfer) while the uTerm2-S is in use.
Both "hybrid" power schemes (where the USB serial adapter is not powered by USB but by uTerm2-S and vice versa) are managed by hardware, so you don't need to worry about them.
In the diagram below, the serial USB adapter is connected to the transparent COM-USB2 (J3) port via a cable.
This allows the use of two keyboards and two monitors at the "same" time (one keyboard and monitor connected directly to the uTerm2-S, the other keyboard and monitor terminal emulator on a PC connected to the serial USB).
Note that the COM-USB2 (J3) port supports RTS/CTS hardware handshaking, so an RTS/CTS signal is required on the serial USB adapter.
In the following figure, a normal CP2102-based serial USB adapter has the RTS/CTS signal connected.
The following table shows how to connect the serial USB adapter to J3.
Note: Signal assignment is the same as for the SER-USB (J3) connector of the uTerm-S.
PRG-USB1 (J2) connector (programming port)
The PRG-USB1 (J2) connector is used to program the ESP32 using a serial USB adapter (it is recommended to use a model that supports the default 921600 bit/s upload speed, such as the CP2102-based adapter).
Both "hybrid" powering schemes (the USB serial adapter is not powered by USB, but by uTerm2-S and vice versa) are managed by hardware, so you don't need to worry about them.
For more information on the programming process, see the "How to Program the ESP32" paragraph.
SPK (J9) Connector
The SPK (J9) connector is used to connect optional speakers (4/16 ohm). I used recycled PC speakers.
The remaining connectors are obvious. PS/2 KB (J5) and PS/2 MOUSE (J4) are used for the PS/2 keyboard and optional PS/2 mouse. Note that many USB keyboards (and USB mice) have PS/2 compatible chips built in, so they can be used with the well-known "green adapter:"
The VGA (J1) connector is for the VGA monitor, and the RS232 (J8) connector is the RS232 serial port of the host computer. The maximum speed is 115200 bps (it is the maximum speed of the MAX232 RS232 driver).
DC-IN (J2) is the power input connector. A 9V 1A DC power supply is recommended.
RTS-HS (SW3) Switch
The uTerm2-S has an RTS/CTS signal PC for hardware handshaking between the RS232 serial port (J8) connector (for host) and the COM-USB2 (J3) connector (the "transparent port" for terminal emulation software), so it can be used for file exchange.
For clarification the following diagram shows the block diagram of the serial port of the uTerm2-S.
On the COM-USB2 (J3) side, the terminal emulation software on the PC uses the RTS signal to put communication on hold if the RX buffer on the PC side is full. the CTS signal is an input that allows the host to perform the same operation if the input buffer on the host side is full. Since the PC is usually much faster than a vintage system, it is convenient to set the RTS signal to the "always ready to accept" state (on the PC side). In this case, the RTS-HS switch (SW3) is used to turn the RTS handshake on or off.
When closed, the host connected to the serial port will see that the RST line is always active (RTS and CTS are active "low" signals). This can be handy in some situations.
The RTS-HS switch has no effect on the CTS signal.
RST Key (SW2)
The RST key (SW2) is used to reset the ESP32 module.
DFLT Key (SW1)
The DFLT key (SW1) is used to reset all terminal parameters to their default values. To activate this feature, you must press the DFLT key while holding it down until the reset is complete, then press and release the RST key (SW2) to reset the uTerm2-S.
Note: The DFLT key must be enabled in the AnsiTerminal sketch (see the paragraph "How to Program the ESP32 (J2/PROG-USB1 Connector)") to make it work.
uTerm2-S is designed to use the FabGL library, so you will first need to install the Arduino IDE and the ESP32 kernel.
Then you must install the FabGL library. Because there are many tutorials, I will not provide more details on how to set up the "toolchain" here (i.e. see the Demonstrations and Tutorials section on the FabGL site).
How to program the ESP32
The uTerm2-S can be programmed as a generic ESP32 board using the Arduino IDE (with the circuitry needed for automatic upload).
You only need to use the PRG-USB1 (J2) connector with the serial USB adapter.
The following table shows how to connect the serial USB adapter to the PRG-USB1 (J2).
Note: You can use the same adapter/cable for programming (via J2) and communicating with the transparent port (via J3) because the J2 and J3 connection tables have compatible signal assignments.
To refresh the terminal firmware, you must open the AnsiTerminal "sketch" from the FabGL library example.
Remember to first change the line containing the following.
#define user set PIN 0 to.
#define user set PIN 1
Enable DFLT key.
Now you can compile and burn the AnsiTerminal sketch.
Note 1: Do not enable HW RTS/CTS handshaking on the Flow Control terminal settings panel, because HW handshaking is reserved for the COM-USB2 (J3) "transparent" connector (see paragraph "RTS -HS SWITCH" paragraph) and the associated GPIOs are not used for this purpose.
Note 2: The maximum terminal serial port speed cannot exceed 115200 bps.
There are also some games in the FabGL library example directory that can be run with uTerm2-S.
Here are Space Invaders.
and Classic Racing.
If you have any ideas, comments or questions about this project, please leave them below.