Subject: Re: Magma 2+1HS Sp: success!
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 01/22/2002 02:03:01
>>>> My Magma 2+1HS Sp now works, at least for smoke-test values of
>>>> "works".  [...]
>> The driver used to accept any baud rate (within certain ranges).
>> I've changed it now so that (a) it rejects baud rates that it can't
>> achieve to within one part in 128 error
> You should probably allow errors below 2% or something like that.
> The async 8N1 protocol allows for more error (but that depends on how
> the receiver samples the data)

Well, yeah, if the receiver samples stupidly, it takes only a tiny
error to corrupt data. :-)  I recently built the equivalent of a UART
out of discrete logic (counters, shift registers, &c) and recall going
to some lengths to sample as close to the middle of the bit time as was
practical (I think I got it to within one part in 16) - and to end the
character as soon as I sample the stop bit, in case the sender is fast
and the next start bit begins "early".  Such techniques should allow up
to something like 5% disagreement between sender and receiver (half a
bit time of drift over ten bit times is about one part in 20).

> and it isn't uncommon that the error is 1-2% at higher baudrates
> (besides, there are devices with more limited baud generators, which
> may have "large" errors at lower rates as well).

How about one part in 64?  That's an easy enough change to make, and it
brings a request for 115200 resulting in 113636+ within tolerance
(though not by much - one part in 64 is 1.5625% error, and
115200->113636 is about 1.36% error).

> Some software (minicom, for example) doesn't let you to type in the
> baudrate, so if the only way to get 115200 bps out of your driver is
> to ask for 113636 bps, you won't be able to use minicom at all :-)

(Won't be able to use it at 115200 at all, that is.)  Well, in general,
my attitude is that that's a deficiency in minicom.  But I'd point out
that you can't get 115200bps out of the hardware, no matter what the
driver does.  (You can get speeds that are within usually-acceptable
tolerances of 115200....)

But be that as it may, I'll change my code to do one part in 64 rather
than one part in 128.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B