Subject: serial port questions, technical
To: NetBSD i386 <port-i386@NetBSD.ORG>
From: Jukka Marin <jmarin@pyy.jmp.fi>
List: port-i386
Date: 10/19/1996 18:59:02
Dear Gurus,

We have been trying to get two serial cards working under NetBSD.  The first
one is a Digiboard 8-port ISA card, the second one is a Turbo TC400 4-port
ISA card.  Both cards have standard 16C552 UART chips.

The problem:

The UART chips aren't interrupting the CPU.  It seems that the chips want
that their baud generator registers are written to before they start
working normally.  If I do a cold boot, start kermit on a com port and hit
a character to transmit it to the remote computer, the CPU never gets an
interrupt.  If I type several (less than 16) characters and then use an
external program to write to the baud generator registers, all the queued
characters suddenly pop out of the com port.

If I change the "#if 1" to "#if 0" in the following part of dev/isa/com.c:

        /*
         * Set the FIFO threshold based on the receive speed, if we are
         * changing it.
         */
#if 1
        if (tp->t_ispeed != t->c_ispeed) {
#else
        if (1) {
#endif
                if (ospeed != 0) {


_then_ the baud registers are initialized properly and things work as
expected.

The Question:

Where is the baud generator supposed to be initialized after a cold boot?
Should I add the initializing code to the serial card driver OR change that
#if in com.c OR call cominit() from the driver during XXXattach()?

I haven't examined the Digiboard problem that well yet, but I believe it's
a similar one to this TC400 problem.

I don't know how the other multi-serial drivers work (or IF they work).
Maybe there are many kinds of UART chips, some of which require this baud
setting while others don't?  It's weird - the baud generator _has_ to be
set up _somewhere_ for _every_ UART before using them - so either it is
not getting set at all OR it has to be set in a different way / at a
different time.

Please tell me where and how the UARTs are supposed to be initialized.
Thanks!

  -jm

-- 

                     ---> http://www.jmp.fi/~jmarin/ <---