USB to serial adapter
This article details the process of enabling support for USB to serial (RS-232, RS-422, RS-485 etc) adapters in the Linux kernel.
Most modern, user facing hardware devices do not come with serial ports accessible from the exterior casing of the device. This becomes an issue when attempting to configure or troubleshoot certain devices that implement a console port with serial communication for data input/output. Most modern hardware devices do include at least one USB port that is accessible from the device casing.
The Linux kernel has support for USB to serial adapters. These devices can be also known as USB serial converters. Support can be enabled in the kernel, udev will configure the device, and an engineer can obtain success communicating with serial input/output via the console port.
Installation
Kernel
Enable support for USB to serial by selecting the following symbols in the kernel’s configuration: CONFIG_USB_SERIAL , CONFIG_USB_SERIAL_CONSOLE , CONFIG_USB_SERIAL_GENERIC , and CONFIG_USB_SERIAL_SIMPLE :
Device Drivers ---> [*] USB support ---> USB Serial Converter support ---> --- USB Serial Converter support [*] USB Serial Console device support [*] USB Generic Serial Driver USB Serial Simple Driver
From this point, specific drivers for each hardware device can be enabled as necessary. To reduce kernel size it is wise to build support for additional adapters as modules.
After the above options have been enabled do not forget to recompile the kernel, update the bootloader, and re-execute the new kernel. Instructions for how to do these steps can be found in related articles.
Additional software
Useful software for accessing the serial interface:
See also
USB-Serial Port adapter (RS-232) in Ubuntu Linux
There are two other articles on a serial port adapter for Windows or Linux usb serial. Below is the instructions for Linux and how to connect your serial adapter while using Linux. This should work for most people using Linux and a serial adapter or usb to rs232 driver which is being discussed.
USB to RS 232 driver Linux
1. Log into Linux under the root account;
2. Plug the USB-Serial adapter into the computer;
3. Give it a minute to discover the USB-Serial adpater;
4. Type in this command dmesg
5. The dmesg command will echo back the most recent few lines of the system message console, and you should see something like this:
- usb 2.0: new full speed USB device using uhci and address 2
- usb 2.0: configuration #1 chosen from 1 choice
6. Unplug the USB-Serial adapter to see a list of USB devices without it being plugged in.
7. Type this command to list the USB devices: lsusb
8. You should see a list of USB devices that looks like this:
- Bus 001 Device 001: ID 0000:0000
- Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard
- Bus 002 Device 006: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003
- Bus 002 Device 004: ID 15d9:0a33 Logitec-mouse
9. Then plug the USB into our device Then use the lsusb command again and observe the changes
- Bus 001 Device 001: ID 0000:0000
- Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard
- Bus 002 Device 003: ID 018a:3754 Unknown device
- Bus 002 Device 006: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003
- Bus 002 Device 004: ID 15d9:0a33 Logitec-mouse
10. Determine the vendor ID and the product ID by inspecting this additional line. In this example they are 018a and 3754. For a Trip•Lite USB-Serial adapter, they are 2303 and 067B. In this example it is a Minicom USB-Serial device. The first numbers identifies the vendor and the second numbers identifies the product.
11. Now use the following command to load the kernel module called usb serial and pass the vendor and product ID values to it. The driver can then associate itself with the correct hardware device on the USB bus.
12. Now c heck whether the new Serial Port device is available
13. You should now see something like this
- usbserial_generic 1-1:1.0: generic converter detected
- usb 1-1: generic converter now attached to ttyUSB0
- usbcore: registered new interface driver usbserial_generic
14. This tells you that the serial device has now been mapped to the /dev/ttyUSBO serial port
15. Now we want to list the devices under the /dev/ path to see if the interface is visible with this command:
18. Instruct Ubuntu to load this module automatically by including the following line in the /etc/modules file. Substitute your own vendor and product ID if they are different.
That should be about it however if you have not installed the driver then you would have to install it now. If you are installing a Minicom serial device then you would do the following:
Press A and then edit to / dev / ttyUSB 0 ( this value, see dmesg | grep ttyUSB )
Press E and then edit to 9600 8N1
Press F and the value will change from Yes to No
Once set up and finish off mode serial port setup.
Save setup as df1 finished off. Settings by Exit from Minicom
Other Issues:
This is for Ubuntu Linux for Red Hat the drivers should be in your OS however Triplite does have Red Hat drivers on their website if you do not have them on your system.
If you are trying to connect a Zigbee through this serial port you can do the following:
Make a symbolic link between ttyUSB0 and com2 by typing in terminal: (assuming you are using com2)
Then Add com2 port to X-CTU