../ Serial port interfacing

13. On shared interrupts under Linux.

Under kernel 2.2.x at least, and possibly more recent ones, the opening and holding of one of the serial ports also affects the activities on the other serial port sharing the same IRQ line. Thus, since /dev/ttyS0 and /dev/ttyS2 share IRQ4, the above sleeping and signalling when applied to one of these will cause the other to be non-responsive. It seems that the waiting on input is the biggest problem. This is probably due to the way the PC hardware is constructed.

It could also have something to do with opening the ports with O_NDELAY rather than just sharing the IRQs. More investigations are needed for this.

To avoid this, have the ports only open in short intervals when actually talking to an external device. Do not sit and wait for the external device to interrupt, or arrange so that a cron-job or some such causes the program to ask periodically.

Of course, if there is only one port using some IRQ line, this may be held open indefinitely since it doesn't have the sharing problem. To implement the wire IO and event waiting, the port has to stay opened for the duration.

To 0. Introduction

To 12. USB-serial converters under Linux.

Table of ASCII codes

To index page