Oracle VM VirtualBox
VirtualBox is a powerful x86 and AMD64/intel64 virtualization product for businesses and home users. VirtualBox is not only an extremely feature-rich, high-performance product for enterprise customers but also the only professional solution available as open-source software under the terms of the GNU General Public License (GPL) version 2.
Currently, VirtualBox runs on Windows, Linux, Mac, and Solaris hosts and supports a large number of other operating systems, including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista, Windows 7, Windows 8, Windows 10). DOS/Windows 3.x, Linux (2.4, 2.6, 3.x, and 4.x), Solaris and OpenSolaris, OS/2, and OpenBSD.
With Oracle VM VirtualBox we can virtualize a Linux system and create a virtual Android serial port in the Android emulator (because the Android OS is based on Linux).
Serial debugging assistant
There are a lot of serial debugging assistants, which can be found in a quick search on Google. Here are some common tools:
Friendly serial debugging assistant (v2.6.5)
- Easy to use;
- Automatic identification of serial ports;
- Support multi-serial port debugging;
- COM numbers higher than COM 9 can be used;
- Support sending of historical records;
- Supports various baud rates up to 10 Mbps baud rate to for compatibility with hardware devices.
- Potential data loss;
- Lack of a smooth display;
- Not suitable for stability testing.
Serial debugging assistant (V2.2)
- Easy to use;
- Has the most user groups;
- Free source code.
- Due to the multi-threaded receiving technology, the number of received calls is sometimes lost, especially when the high baud rate or the USB to serial port function is used.
- It only supports a maximum of 115.2K baud rate.
- You can only select COM1~COM2. When using USB to serial port emulator, you must remap the serial port.
- Supports automatic identification of connected serial devices;
- Easy to use;
- No counting;
- Good stability;
- Simple interface that provides a good user experience.
- Plugging and unplugging the serial port program will crash your machine, resulting in a blue screen;
- The high baud rates are only 115.2K, 128K, 256K, and there is no 230.4K;
- As a console, echo is not supported;
- Save display data is not supported under Win10.
- High baud rate of up to 921.6K with no loss of reception.
- Only COM1 through COM4 is available;
- When using USB to a serial port, you need to remap the serial port.
- Strong functionality;
- Many configuration parameters;
- No reception loss.
- When the baud rate is high (such as 230.4K), large amounts of received data can cause disruption in the data sending process.
First, create two virtual ports COM2 and COM3 through Virtual Serial Port Driver. Of course, you can also create COM4 and COM5. This has no effect, as shown below:
After the creation is successful, click the Settings button, then find the serial port item and set the port 1.
The port number COM1 corresponds to the Android virtual machine, /dev/ttyS0and the COM2 port of the address (p) corresponds to our virtual COM2 port. Of course, you can also set it to COM3 because we created two virtual ports in front.
Next, we start the Android emulator, I am using Genymotion, here we should note that the emulator we created is lower than the Android 4.4 version, otherwise the emulator does not support the virtual serial port.
After starting the emulator, open the serial debugging assistant, let the serial debugging assistant connect to another port (COM2 for the emulator, so connect COM3 here), click to open the serial port after setting.
At this time, you will find that the status of the two virtual serial ports in the Virtual Serial Port Driver is active, as shown below:
Finally, we open the serial port in the apk /dev/ttyS0send analog data, you can see the received data, pay attention to both sides here you need to set the same baud rate in serial debugging assistant.