You're running into the problem I discovered a month ago,
when the combination of TS-SER4 and TS-7300 made my ETH1 port go
really, really slowly (turns out this isn't the driver related
slowdown, it's a different slowdown.)
The info I have is for the TS-7300, you'll have to verify ISA bus
interrupts and how they map to ARM interrupts for your mainboard.
The TS-SER4 (and TS-SER2) use IBM PC-style interrupt drivers, which
cannot be tri-stated, so no other device can use the same interrupt as
the TS-SER4.
Of the three ISA interrupts the TS-7300 has available (ISA 5 = ARM 22,
ISA 6 = ARM 33, and ISA 7 = ARM 40) on the expansion bus, ISA 7/ARM 40
is already used by the onboard FPGA, so is not available for any
non-tristateable expansion devices, and ISA 6/ARM 33 is used by the
BAT3 board by default. So the only possible setting for the TS-SER4
board is to use a single interrupt, ISA 5 / ARM 22, Jumpers IRQ1 and
IRQ4 ON, IRQ2, IRQ8, and 2-IRQs OFF.
I used COM1 as the base address, jumper COM1 ON, jumper COM2, COM4,
and JP3 OFF.
My "/var/lib/setserial/autoserial.conf" file looked like this:
----
###PORT STATE GENERATED USING AUTOSAVE-ONCE###
###AUTOSAVE-ONCE###
###AUTOSAVE-ONCE###
###AUTOSAVE###
#
# If you want to configure this file by hand, use
# dpkg --configure setserial
# and change the configuration mode of the file to MANUAL. If you do
not do this# this file may be overwritten automatically the next time
you upgrade the
# package.
#
/dev/tts/0 uart 16550A port 0x89c003f8 irq 22 baud_base 115200
spd_normal skip_test
/dev/tts/1 uart 16550A port 0x89c002f8 irq 22 baud_base 115200
spd_normal skip_test
/dev/tts/2 uart 16550A port 0x89c003e8 irq 22 baud_base 115200
spd_normal skip_test
/dev/tts/3 uart 16550A port 0x89c002e8 irq 22 baud_base 115200
spd_normal skip_test
----
(Make sure to do the "dpkg --configure setserial" thing that it
suggests _before_ modifying the file.)
The serial driver is apparently incapable of recognizing the 2-IRQ
setting, which is just as well, since using two IRQ lines would be
impossible in many configurations. IMHO, the driver _should_ read the
jumper settings for the board from the control register, look at its
modprobe.conf option string to see if it should enable RS-422 or
RS-485, and adjust all the IRQs accordingly, but no such luck - we
have to do it all by hand, undocumented. Sigh.
I also put together from code on this list and bits from the manuals
the following bit of C code to enable the two RS-422 ports:
----
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#define PCI_IO_BASE 0x011e00000
#define SER_IO_BOARD_BASE 0x0230
main()
{
int memfd;
volatile unsigned char *io;
unsigned char io_byte;
printf("Trying to set TS-SER4 RS485 enable bit.\n");
/*
* * Open a memory handle
* */
memfd = open("/dev/mem", O_RDWR);
if ( memfd < 0 )
{
printf("Unable to open memory handle to enable RS485
option!\n");
exit(-1);
}
/*
* * Map to the actual I/O location
* */
io = (unsigned char *)mmap(0, getpagesize(),
PROT_READ | PROT_WRITE, MAP_SHARED, memfd, PCI_IO_BASE);
if ( ! io )
{
printf("Unable to access memory to enable RS485 option!\n");
exit(-2);
}
io += SER_IO_BOARD_BASE; /* TS-SER4 Board signature */
io_byte = *io;
if (io_byte != 0x7A)
{
printf("TS-SER4 board not found at PCI address %x!\n",
SER_IO_BOARD_BASE);
exit(-3);
}
io += 3; /* RS485 option register */
io_byte = *io;
if ((io_byte & 0x40) == 0) /* Is board configured for RS485? */
{
printf("Board not configured for RS-422/RS-485!\n");
exit(-4);
}
*io = io_byte | 0x80; /* set bit 7 to enable RS485 */
if ((*io & 0x80) == 0)
{
printf("Unable to set RS485 option!\n");
exit(-5);
}
printf("RS485 option enabled.\n");
exit(0);
}
----
I made it a stand-alone file which was run in /etc/rc.local, but you
might want to incorporate it into your primary serial-using
application. It can be run before any ports are opened, no problem.
I also found major, major issues with the "bat3" program which was
supplied by Tech Systems. It _should_ be set up to be run from
/etc/inittab, so that if it terminates unexpectedly, it's
auto-respawned. It doesn't actually allow that, and it _does_
terminate at random times, often just after starting it, and it _also_
goes into "hyper" mode where it starts sucking down processor time to
the point that the system all but freezez up. So, I built the
following shell script, and put it in /etc/crontab set to run every
minute:
# m h dom mon dow user command
* * * * * root /etc/cron.scripts/checkbat3
Here's the shellscript:
---
#!/bin/sh
if /bin/ps -C bat3 >/dev/null; then
#echo "Running"
# Check for runaway bat3 process
pct=`ps -C bat3 -o c | tail -n 1`
#echo "Percent =" $pct
if (($pct>25)); then
#echo "Killing - too much"
killall bat3
fi
fi
# If no bat3 process running, start one
if ! /bin/ps -C bat3 >/dev/null; then
nohup /sbin/bat3 --shutdown 60 --charge 400 >/dev/null &
fi
---
(Tech Systems is supposed to be looking into why the BAT3 application
crashes and sucks down CPU cycles, but I haven't heard anything yet.
As it is now, there's a potential 59 second window every
who-knows-how-often that the board is vulnerable to being powered down
and not having the "bat3" software running - that may be a time window
when the SD card's file system is capable of getting corrupted, which
worries me greatly.)
I hope this helps someone else to _not_ spend the 50 hours it took me
to figure all this garbage out. I also hope this makes it into the TS
documentation, but I'm not gonna hold my breath.
- Phil Salkie
phil at how man dot com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|