[comp.sys.m68k] How to cause an SCC2 interrupt on the MC68302

jwh@wgate.UUCP (Joe Hughes) (10/25/90)

	I need some expert help on how to code the mc68302 so that it causes an
SCC2 interrupt.  I am developing software for use on a custom board that uses
the mc68302.  One of my tasks is to do asynchronous i/o via the SCC2.  After
talking to our local Motorola rep, who supplied me with an example, I wrote
some code that I thought would work.  Unfortunately it doesn't.  I think I have
everything set correctly, but if anybody has had any experience with the mc68302
I would appreciate the help.  The SCC2 is set to normal operation, non-multi,
uart, with an internal 9660 baud rate.  Thanks for the help in advance.
-- 
Joe Hughes                    Wandel & Goltermann Technologies, Inc.
Home (919) 469-3851           1030 Swabia Court
Work (919) 941-5730           Research Triangle Park
uunet.uu.net!wgate.com!jwh    North Carolina 27709-3585

ron@motmpl.UUCP (Ron Widell) (11/03/90)

Joe Hughes (jwh@wgate.UUCP) writes:
>
>	I need some expert help on how to code the mc68302 so that it causes an
>SCC2 interrupt.  I am developing software for use on a custom board that uses
>the mc68302.  One of my tasks is to do asynchronous i/o via the SCC2.  After
...
>I would appreciate the help.  The SCC2 is set to normal operation, non-multi,
>uart, with an internal 9660 baud rate.  Thanks for the help in advance.
I assume you meant 9600 ^^^^ :-)
What is the value of MAX_IDL (SCC Base + 0x9c)? As described in number 6 on pg.
4-50 of the MC68302 User's Manual (Rev 1), this is the maximum amount of time
(effectively measured in character times) that the SCC will wait between
characters without generating an interrupt to the core 68000. It does an add
for each idle sequence (9-13 consecutive ones, effectively one character time)
and then compares this to the value in MAX_IDL to see if it should interrupt.
One of the more common problems is that people don't initialize this location,
or initialize it to 0 (which means the the value will have to roll over from
0xffff before the timeout ocurrs) let's see: assuming 1 start, 8 data, 1 stop=
10 bit characters, we will not get an interrupt until 1) the Rx buffer length
is reached (MRBLR) 2) an error (BREAK, overrun, framing, noise, etc.) occurs,
or 3) a timeout occurs (9600 baud approx = 960 chars. / sec, so
65536 char. times / 960 chars. per sec = 68.26 seconds).

Note that the count-up value gets reset for each valid character received, so
you will wait (assuming the Rx buffer is not full and no error occurs) 68.26
seconds after the last character is received before you get the interrupt.
This is probably *NOT* what you wanted :-).

Hope this helps.

-- 
Ron Widell, Field Applications Eng.	|UUCP: {...}mcdchg!motmpl!ron
Motorola Semiconductor Products, Inc.,	|Voice:(612)941-6800
9600 W. 76th St., Suite G		| I'm from Silicon Tundra,
Eden Prairie, Mn. 55344 -3718		| what could I know?