[net.micro.cpm] Help needed with 8251 USART

@purdue.ARPA:mjs@purdue-ecn-ee.ARPA (mjs) (12/30/85)

Does anyone out there have any experiece programming the 8251 USART?  I
am using a Royal Alphatronic PC with CP/M 2.2, and want to be able to
set and change the baud rate.  I have the data sheets for the 8251, and 
through much experimentation, I am able to change the baudrate to suit
my needs.  Unfortunatly, as soon as I try to send data out the port,
the chip locks up.  Data coming in works fine.  Anyone know anything
about this?  I can send you the code that I am using if you think
that you can help me out...

                               Thanks...
                                Mike Spitzer
                                mjs@purdue-ecn
                                [decvax,ucbvax,ihnp4,inuxc]!pur-ee!mjs

jchapman@watcgl.UUCP (john chapman) (01/02/86)

> Does anyone out there have any experiece programming the 8251 USART?  I
> am using a Royal Alphatronic PC with CP/M 2.2, and want to be able to
> set and change the baud rate.  I have the data sheets for the 8251, and 
> through much experimentation, I am able to change the baudrate to suit
> my needs.  Unfortunatly, as soon as I try to send data out the port,
> the chip locks up.  Data coming in works fine.  Anyone know anything
> about this?  I can send you the code that I am using if you think
> that you can help me out...
> 
>                                Thanks...
>                                 Mike Spitzer
>                                 mjs@purdue-ecn
>                                 [decvax,ucbvax,ihnp4,inuxc]!pur-ee!mjs

I have tried to do the same thing on two different machines (one multibus
z80 based and the other an s100 8086 based) and found the same thing you
did.  What seemed to work was sending the initialization sequence twice,
e.g. write a subroutine to set up the 8251 and just call it twice in a
row. I'd be interested to know if this works for you......

-- 

	John Chapman
	...!watmath!watcgl!jchapman

	Disclaimer : These are not the opinions of anyone but me
		     and they may not even be mine.

tom@pedsgo.UUCP (Tom Gillispie) (01/02/86)

Organization : Concurrent Computer Corp. (a P-E company), Tinton Falls, NJ
Keywords: 


I have shared your frustration with programming the 8251.  Maybe I can help
some.  First, you must 'kick' the 8251 into a mode where it will recognize
and accept the control byte.  If the board you are using has a hardware
reset facility of some type, that may work.  There is a pin on the 8251
that will physically reset the chip, and put it in a mode where it is
waiting for the control byte.  If your board doesnt have that (many dont),
you must send the 8251 several 'invalid' control bytes, which will get it
into a state where it is expecting the control byte.  I have found that
outputting several bytes of 0 will work.  I have seen some code use 2
zeros, and some use 3 zeros, it may not matter.  Once that has been done,
you set up the chip the way it states in the manual.  Your code looks good,
just add the outputting of serveral bytes of zero to the command port
first. 

Second, I have found several things with the 8251.  Some of the older
ceramic-body 8251 chips are not to be trusted.  I was told and found to be
true that you should stick to the plastic parts.  My ceramic 8251s were at
least 5 years old, so maybe newer ceramic parts are ok.  Also, I found that
some of my 8251s would not work correctly (sorry, I cant remember what
wasnt correct) when you ran them with NO PARITY.

Hope this help.

Tom

cem@intelca.UUCP (Chuck McManis) (01/04/86)

> Does anyone out there have any experiece programming the 8251 USART?  I
> am using a Royal Alphatronic PC with CP/M 2.2, and want to be able to
> set and change the baud rate.  I have the data sheets for the 8251, and 
> through much experimentation, I am able to change the baudrate to suit
> my needs.  Unfortunatly, as soon as I try to send data out the port,
> the chip locks up.  Data coming in works fine.  Anyone know anything
> about this?  I can send you the code that I am using if you think
> that you can help me out...
> 
>                                Thanks...
>                                 Mike Spitzer
>                                 mjs@purdue-ecn
>                                 [decvax,ucbvax,ihnp4,inuxc]!pur-ee!mjs

Make sure the CTS (clear to send) line is either disabled or tied high.

--Chuck

-- 
                                            - - - D I S C L A I M E R - - - 
{ihnp4,fortune}!dual\                     All opinions expressed herein are my
        {qantel,idi}-> !intelca!cem       own and not those of my employer, my
 {ucbvax,hao}!hplabs/                     friends, or my avocado plant. :-}

treid@MITRE.ARPA (Thomas Reid) (01/05/86)

I may be naive, but the best place to go to school on any USART is the
overlays for MODEM7 and its descendents.  Go through the documentation
and find one that uses the USART, and download that overlay.  If the overlay
is squeezed and you can't read it, I will download it, unsqueeze it and
mail it to you. 

leisner.henr@XEROX.ARPA (01/06/86)

Mike,

Does your CP/M bios do anything with this chip?   Are you sending out a
whole sequence of command bytes started with a reset (3 40H in sequence
I think)?

Marty