*BSD News Article 32846


Return to BSD News archive

X-Mailer: CrossPoint v3.02
Message-ID: <5ShJnqRLVPB@pro-042.proline.gun.de>
References: <1994Jul4.130216.19263@bruce.cs.monash.edu.au>
X-Gateway: ZCONNECT KY key.gun.de [DUUCP BETA vom 07.07.1994]
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
From: d.vanheukelum@proline.gun.de (Dietmar van Heukelum)
Subject: Re: SIO/COM driver 16550A limitations?
Date: 12 Jul 1994 14:11:00 +0200
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!xlink.net!rz.uni-karlsruhe.de!subnet.sub.net!flatlin!flyer.GUN.de!teralon!easix!key.gun.de!proline.gun.de!d.vanheukelum
Newsgroups: comp.os.386bsd.questions
Distribution: world
Lines: 97


From article by maurice@bruce.cs.monash.edu.au (Maurice Castro):

m>> The man pages for SIO and COM both allude to problems with cheap
m>> clone 16550A serial boards (which I have).  What is the failure
m>> mode for these?  When I do: "cat </dev/tty00" on a stock system,
m>> the consoles freeze (no keystrokes do anything), and it appears
m>> that the system goes dead (I don't actually know what the CPU
m>> is doing, since I have no bus analyzer).
m>>
m>
m>Before concluding that your serial card is at fault use kermit to
m>try and set the line. If your system does not quickly respond
m>try the following:
m>
m>	/bin/stty -f /dev/tty00 clocal
m>
m>Then try to use kermit to verify the presence of a serial device.
m>If kermit responds quickly to the set line command add the line to your
m>/etc/rc.local file to ensure the convenient operation of the serial port
m>each time you boot.
m>
m>	Maurice
m>

As far as cheap 16550 clones are concerned, the problem with my Texas  
Instrument version was that it wasn't recognized at bootup because of a  
lacking interrupt. I corrected it with the following patch to sio.c:

*** /sys/i386/isa/sio.c.orig	Thu May 12 08:13:34 1994
--- /sys/i386/isa/sio.c	Fri May 13 07:31:10 1994
***************
*** 362,368 ****
--- 362,381 ----
  	 *	o an output interrupt is generated and its vector is correct.
  	 *	o the interrupt goes away when the IIR in the UART is read.
  	 */
+ 	/*
+ 	 * The following three lines are neccessary on some versions of the
+ 	 * 16550 chip, especially the Texas Instrument version TI16550AN
+ 	 * doesn't work without setting the baud rate first.
+ 	 * The effect is that the chip doesn't generate the TXRDY interrupt
+ 	 * without it. The same may apply to other versions of the chip.
+ 	 * And it won't harm any other, I think.
+ 	 * Dietmar van Heukelum, 53840 Troisdorf, Germany
+ 	 */
+ 	outb(iobase + com_cfcr, CFCR_DLAB|CFCR_8BITS);
+ 	outb(iobase + com_dlbl, 3);		/* The value is unimportant */
+ 	outb(iobase + com_dlbh, 0);
  	outb(iobase + com_cfcr, CFCR_8BITS);	/* ensure IER is addressed */
+ 	outb(iobase + com_fifo, 0);		/* ensure fifo is really off */
  	outb(iobase + com_mcr, MCR_IENABLE);	/* open gate early */

As you can probably see, I'm still using FreeBSD V1.0.2 because I haven't  
got any later version yet :-(.
But nevertheless the same may apply to V1.1.5.

But still kermit didn't work on my system even with the "stty -f /dev/ 
tty00 clocal" stuff ("device not configured" error).

The following quick and dirty lines did the job. Running the little piece  
of code during startup made everything work.


#include <unistd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/termios.h>

struct termios  term;

main()
{
	int tty;
	

	tty=open("/dev/tty01", O_RDWR|O_NONBLOCK);
	if (ioctl(tty, TIOCMSBIDIR, 1) < 0) goto out;
	if (ioctl(tty, TIOCGETA, &term) < 0) goto out;

	term.c_ispeed = B57600;
	term.c_ospeed = B57600;
	if (ioctl(tty, TIOCSETA, &term) < 0)
	{
out:
		printf("Setting failed!\n");
		close(tty);
		exit(1);
	}
	close(tty);
	exit(0);
}

Hope that helps:-).

Regards, Dietmar
## CrossPoint v3.02 ##