Four serial ports under the Linux operating system

Source: Internet
Author: User

There is a project that uses the PC104 board (PCM-3341), the Linux system.

But at least 3 RS232 in the project, see Datasheet, enough. The board has 3 separate RS232 and a rs232/485 multiplexing port. But in the actual test use, encountered a problem. 1 and 2 can work (later found to be problematic, reading sensor data, reading is not complete), but 3 and 4 have appeared very strange phenomenon.

The main performance is:

1. Can input output

2. Input and output rate is very slow

3. Found that the data in the cache, each time you can only output about 12 characters (indeterminate length).

Started not to find the original, and then consulted other technical staff, estimated to be interrupted problem.

Google found the following article: The original source, the problem solved, very grateful to the expert advice. It's too late to go deep.

Linux defaults to support four serial ports: COM1 (TtyS0), COM2 (ttyS1), COM3 (ttyS2), COM4 (ttyS3) (no cuax is used in newer Linux to differentiate dial-in dial-out), usually COM1 and COM3 jointly use IRQ4,COM2 and COM4 to use IRQ3 together.

Although Linux supports shared interrupt technology, it cannot discover actual physical interrupt conflicts. In these cases, COM3 and COM4 are not functioning properly because of the interruption of the conflict. This article describes how to use COM3 and COM4 in the Red Hat 8.0 environment.

Because the current development project needs to use four serial ports at the same time, and the development of the use of industrial control machine happens to have four, eliminating the trouble of buying multiple cards, direct programming using COM3 and COM4. When testing, the problem arises: COM3 and COM4 send and receive data is very slow, a few bytes data at 115.2K communication rate of ten or twenty seconds to send or receive, completely can not meet the application requirements.

Check the data to confirm that this is a typical interrupt conflict failure, using the following methods:

SETSERIAL/DEV/TTYS2 IRQ 0

Use the communication program again, the data transmission now can not see the obvious delay. This is because when the COM3 is set to Irq0 interrupts, the device does not actually use the interrupt, but instead uses the polling technology, which proves that the failure was caused by the interrupt mechanism and that there was a conflict.

The COM3 and COM4 jumpers on the motherboard indicate that IRQ5 and IRQ7 can be used, so the jumper is set and run

SETSERIAL/DEV/TTYS2 IRQ 5

SETSERIAL/DEV/TTYS2 IRQ 7

The use of communication procedures, found that the fault still, suspected there are still conflicts. For information, IRQ5 and IRQ7 are commonly used in the same port, but the current system does not use the same port. Enter the BIOS found inside the set up the mouth and occupy IRQ7, the item disable off. Seems to have little relationship with IRQ5, found that the set IRQ5 and 7 for "Pci/isa PnP", changed to "Legacy ISA" mode, restart, COM1--COM4 can be used normally.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.