[Wlug] Multiple RS232 Com Ports...

John Stoffel john at stoffel.org
Mon May 21 13:15:07 EDT 2007


Stephen> I'm wondering if anyone knows how many RS232 devices a
Stephen> "vanilla" Linux kernel can manage simultaneously.  I'd like
Stephen> to be able to have up to 32 going at once, with data taken
Stephen> from each device written to its own file via the standard I/O
Stephen> subsystem.  

Not a problem, Linux can handle bunches of serial devices.  But, the
question to me becomes which way is more efficient:  1) buying
multiport serial cards such as Cyclades Z series, or 2) buying a
Cyclades or Digi terminal server instead, which has the number of
ports you need.  

Stephen> As far as I know, wouldn't Linux simply fork the appropriate
Stephen> number of driver threads to read as many RS232 ports as are
Stephen> attached with each device's stream written to a "/dev" file?

There's two questions here to answer.  First, Linux is good at
supporting lots of devices on a system.  Second, reading each device
is really a per-process thing, or you could have a single process
reading each port in turn.  It's a totally seperate issue really.

Stephen> Why do I want to do this?  Glad you asked...

Actually, I was asking until you wrote this.  Thanks for the
interesting details!

Stephen> I'm investigating an issue at work that involves our
Stephen> instrumentation lab having to upload/download/calibrate
Stephen> multiple sondes and have them ready for field deployment the
Stephen> next day.  Currently, we can do three at a time and this
Stephen> takes about 8-9 hours providing everything goes well.

Ouch.  That must be some involved work you need to do here. 

Stephen> The manufacturer's software application claims to supports
Stephen> the simultaneous upload/config of up to 32 sondes.  The
Stephen> application will scan "installed" COM ports looking for
Stephen> recognizable sondes, and present those found to the user. Yes
Stephen> - this is a windows solution, so I first began looking for
Stephen> products that would play with Windows...

Ugh... run screamming!

Stephen> I began looking for hardware solutions (PCI boards, break-out
Stephen> boxes, etc.) on the net and I found a few that will provide
Stephen> 16 DB-9 RS232 ports with full pin-out support as well as
Stephen> so-called "true" interrupt and FIFO support on the host (via
Stephen> their own custom Windows driver, no doubt).

Why are you looking for this in particular?  Do the sondes require
XON/XOFF or full RTS/CTS flow control?  If they have/require full
hardware flow control, most high-end multiport boards should be just
fine.  As well as any of the multiport terminal servers.  I'm
particularly partial to the Digi CM32 model right now.  I've heard
darn good things about the Cyclades stuff as well.  Stay away from the
Legacy Avocent (who bought Cyclades...) serial port stuff, it's crap.

Stephen> And then I started wondering about how to get all of this to
Stephen> work in a Windows environment where "IT" is the only group
Stephen> allowed to install software and otherwise configure a PC for
Stephen> most users whose biggest concern is email...

The horrors of windows application support.  

Stephen> All this got me thinking about avoiding the whole Windows
Stephen> issue and instead thinking about using Linux to take care of
Stephen> the RS232 part, with the newly created files moved to a
Stephen> Windows box (sneakernet to start with), with the normal
Stephen> post-processing of the data taking place as usual in the
Stephen> Windows environment the staff is used to...

Stephen> I'm hoping an "out of the box" distro will be able to handle
Stephen> say 16 RS232 ports and that Linux-based terminal emulation
Stephen> software is available to simultaneously handle those ports as
Stephen> well so I can capture the data using the appropriate
Stephen> protocols...  Anyone know of a similar application using
Stephen> RS232 and Linux, or have some thoughts on this?

None of this is a problem.  And in terms of handling the ports, I'd
probably just write a perl or expect script to do the actually driving
of the ports and the handling of the on-sonode menus to grab the data
you want. 

Basically, you'd just have a script which takes a serial port as the
input parameter and just drives the port as needed.  For example, make
sure the Perl Expect::Bundle is installed:

 > sudo perl -MCPAN -e 'install Bundle::Expect'

And then you should be able to open up a serial port connected to a
Sonde and talk to it.  It's really pretty easy, once you get over the
humps.  :]

Good luck!
John



More information about the Wlug mailing list