Oulu, Finland 1.1.-89 Kari Alakuijala (C) (Copyright)
Atraintie 6
90550 Oulu
Finland, Europe
This archive contains thorough instructions of how to install a COMPLETE SECOND RS-232 PORT into your ST. And it is made cheap; all parts you need cost LESS THAN 3$. However, the author (Kari Alakuijala) doesn't take any responsibility of possible damages made to your computer during installation, so you'd be better read instructions carefully.
You may give a copy of this archive to your friend. You can upload it to BBSes; this archive is PD. Do anything you want with this archive, but please don't modify it. There might be a small bug in these instructions, but the best way is to ignore it (if you can). Letting the author know of the possible bug is the thing you can do to help.
If you want to install this archive/part(s) of it to a commercial BBS package, please contact the author. Also, if you want to release an article based upon this archive or to earn money with the help of this archive, you'll need to contact the copyright owner first, so we can agree
ttl -level RS-232 -level
1*ON-ON -type ---------- -------------
switch |----------| 2|----|3
|-->|3rxclk 6|>--------|1488|--> TXD (10)
|----| |-->|4txclk | |----|
|-| |--< variable fq; | | |
| | SW | 1.2- 307.2kHz | | | 4|----|6
|-| IT |------------------| | MIDI 5|>--------|1488|--> DTR (13)
| CH | | ACIA | |----|
| |--< 500 kHz | 6850 | a diode
|----| | (u20 | / 6|----|4
| on 2|<--D|----|1489|<-- RXD (11)
| ST) | |----|
| |
| |
| |
|----------|
Then lets go right to the point, parts needed for installation are:
amount part name description/purpose
------ --------- -------------------
1 MC1488 TTL -level to RS -level conv.
1 MC1489 RS -level to TTL -level conv.
1 1N4148 a diode
1 1*ON-ON sw. a SWITCH to swap between MIDI and
RS usage of ST's midi chip MC6850.
2 metres isol. wire to connect chips
enough solvent to solder
Let's go on now, if you have these parts already. Otherwise I'll
have to wait until you come back from grocer's...
Take the chip mc1488 (from your parts collection) into your hand. Look at it at the top of the chip. The top left pin is number one, and the top right is number 14.
Look at picture below:
---\/--- ---\/---
(-12V) 1 O|o |O 14 (+12V) O|o |O 14 (+5V)
O| |O 13 O| |O 13
O| 1488 |O 12 O| 1489 |O 12
O| |O 11 O| |O 11
O| |O 10 O| |O 10
O| |O 9 O| |O 9
(gnd) 7 O| |O 8 (gnd) 7 O| |O 8
-------- --------
both chips looked from top of them
Bend all the pins individually horizontally except the numbered ones. (They are power, gnd and other pins). Find similar chips (1488 & 1489) on your ST. They should be located near the RS -port. Use your soldering station to solder these chips on the ones found in ST. Make sure that only the numbered pins (17 pieces) are soldered. The other pins (11 pieces) should be bent to horizontal position, and should have no contact with anything. From now on, when I talk about 1488/1489 or MC1488/MC1489 I mean these ones you have just installed, not those suckers found on ST originally.
Before attempting any further operation, you should know some datas of the 1488/1489 pins which you have just bended. Have these pictures near during the installation. In text there will be for example "connect a wire between pin 2 of 1488 and pin 6 of 6850", so it's handy to have these near, if you can't remember which pin is which.
---\/---
O|o |O
pin2: TTL-input #1 O| |O
pin3: RS-output #1 O| 1488 |O
pin4: TTL-input #2 O|----, |O
pin5: TTL-input #2 O|--,_| |O
pin6: RS-output #2 O|-o|&| |O
O| |O
--------
ttl to rs converter chip looked from top of it
---\/---
pin1: RS-input #1 O|o |O
O| |O
pin3: TTL-output #1 O| 1489 |O
pin4: RS-input #2 O| |O
O| |O
pin6: TTL-output #2 O| |O
O| |O
--------
rs to ttl converter chip -sight from above
The two chips above are used to convert signals from TTL to RS-232 and back.
The chip below a serial transmitter/receiver. It contains all circuitry to communicate with modems, altough normally in ST only the RXD/TXD pins are in use. (In MIDI usage we don't actually need DCD/DTR, do we.)
-----\/-----
O|o |O
pin2: RX-data > O| |O
pin3: RX-clk -> O| |O
pin4: TX-clk -> O| |O
pin5: DTR <---- O| |O
pin6: TX-data < O| ACIA |O
O| 6850 |O
O| |O
O| |O
O| |O
O| |O
O| |O
------------
on-board-MIDI -chip u20 (chip number 20 on ST) looked from top of it
Now, cut the pins 3 and 4 on 6850 (u20) and bend them to horizontal position (the same manner we did with 1488/1489). Be veeeeery careful when cutting & bending pins. Don't cut pins 2, 5 and 6! Again, after doing this, the pins 3 and 4 on 6850 (u20) should have no contact at all neither with motherboard nor with any other pin.
Connect the pins 3 & 4 on 6850 (u20) to each other with solder. This means, that the TX and RX clock speeds are the same.
There is a MFP 68901 -chip somewhere on the motherboard. Find it: there is a _variable_ clock rate at unused pin 13 of 68901. That's just what we need for RS!
Also, there is another 6850 (chip number u21) that is used for keyboard controlling. Find it: there is a clock rate of _500kHz_ at pins 3 & 4.
Take the switch (from your parts collection). Bring the _variable_ frequency to the UPPER pin of the switch and the _500kHz_ frequency to the LOWER pin. The center pin of the switch is connected to MIDI-chip's (u20 on ST) pins 3 & 4. Doing so lets you change between the variable frequency and 500kHz. Install the switch somewhere, where you can flick it easily (without opening your ST). This provides you with an ability to use RS in position "variable" and MIDI in the position 500kHz (remember, that the clock rate is divided by 16 in 6850 --> MIDI speed is 31250 bps). With a help of 68901's internal, unused TIMER A you can choose any clock rate resulting RS -speeds between 75 and 19200bps. (More about that on document softrs2.txt). This was the clock rate for transmitter & receiver -installation. (Again, overlining the lines you have read will make the installation far easier!)
Connect a wire between pin 6 of 6850 (u20= chip number 20, i.e. MIDI -chip on the Atari ST) and pin 2 of 1488. This moves the TX -data signal to RS -encoder chip MC1488.
Connect a wire between pin 5 of 6850 (u20, midi chip) and pin 4 of 1488. This moves the DTR (hangup) -signal to RS -encoder MC1488.
Connect the diode (from your parts collection) to pin 2 of 6850 (u20 on ST) The coloured ring around the diode must point away from 6850 (u20). (Also, the anode (+) of the diode is connected to pin 2 of 6850)
Connect a wire between pin 6 of 1489 and the cathode of the diode we've just installed. (The ring around the diode (=cathode) should point towards the wire.) This was the RXD connection.
INSTALLATION IS NOW COMPLETE, altough there is a matter of agreeing which line is to be connected to which of NC-pins on RS-port. I have them connected to NC pins 9-12 of RS-port, and since these pins are easily available to the user, I recommend that you use them too. You can even saw a hole for the 2nd RS -port and use a standard 25-pin male connector recommended for the RS-232, but why make it the hard way, anyway.
The new pins on your ST's RS-port respectively (all are RS-232 level):
Pin 9 Ground -as pin7 on RS-232.
Pin 10 TXD_2 -transmit data. (works as p2 on RS-232)
Pin 11 RXD_2 -receive data. (works as p3 on RS-232)
Pin 12 DTR_2 -data terminal ready: used to hangup modem
and to prevent auto answer. (as p20 on RS)
In ST-basic this port can be read from port inp(3) and status from inp(-3). The original RS-232 is inp(1), when the keyboard is inp(2).
Use the VT-52 terminal programme "MIDITERM.TOS" to test drive the 2nd RS-232 interface. Miditerm.c shows some programming 'examples' to use with language C.
The sending and receiving from this port is similar to sending and receiving MIDI or RS -data. Also the transmit/receive buffers are provided by the bios. Even the speed control is provided by bios. The only thing that is missing is the (DCD/)DTR -control and the word lenght & parity control over the interface. These can be achieved by poking the values directly into registers on ACIA 6850. Enter the supervisor -mode (see your language manual on this) and alter the settings on the MIDI ACIA - CONTROL REGISTER found on $FFFC04 (this register is 8-bit). If you want to alter 2nd RS -speed, do it with multi function peripheral MFP68901 and the till now unused timer A of it.
2nd RS speed is changed by timer A of MFP68901. See your language manual on how to do it. For example (using language C):
Xbtimer (0, 1, n, -1);
where:
bit 1 bit 0 description/purpose
----- ----- -------------------
0 0 RX/TX clock rate/1 (don't use, for synchronous only)
0 1 >RX/TX clock rate/16 (don't care)
1 0 RX/TX clock rate/64 (don't care)
1 1 Reset (don't care)
>) default. The RS-232 speed is changed by timer A. At the beginning
of this memory map -list there was a description of TIMER A on the
multi function peripheral 68901. Change the speed from there, not
here.
bit 4 bit 3 bit 2 description/purpose
----- ----- ----- -------------------
0 0 0 7E2 (7 databits, even parity, 2 stopbits)
0 0 1 7O2 (odd parity)
0 1 0 7E1 (1 stopbits)
0 1 1 7O1
1 0 0 8N2 (8 databits, no parity, 2 stopbits)
1 0 1 >8N1 (This is the most usual on BBSes)
1 1 0 8E1 (even parity)
1 1 1 8O1 (odd parity)
>) default (and mostly used).
bit 6 bit 5 description/purpose
----- ----- -------------------
0 0 >DTR low, transmitter IRQ off
0 1 DTR low, transmitter IRQ on
1 0 DTR* high, transmitter IRQ off
1 1 DTR low, transmitter IRQ off. Sends BREAK.
*) When you put DTR high and back low again, the caller will be logged
off. DTR must be LOW (= default), if you want your modem to answer
incoming calls. DTR must also be connected to modem to enable auto
answer.
>) default (auto answer enabled in default position).
bit 7 description/purpose
----- -------------------
0 Receiver interrupt disabled (used to silence the port)
1 >Receiver interrupt enabled.
>) default.
The same register can also be read from. When read, it is called the STATUS REGISTER (i.e. the memory location is the same as the one of the control registers). Again THERE ARE MANY UNIMPORTANT BITS described to the interested reader:
bit 0: when RXD register is full, this bit is set. (don't care,
bios will handle)
bit 1: when TXD register is empty this register is set. (don't care,
bios will handle this)
bit 2: a low -high -transition at DCD sets this input (however, this
input can't be used, since a low-high transition causes also
an interrupt and jams ST totally until a character is received
via MIDI or 2ND RS port).
YOU CAN ALSO DETECT THE INCOMING CALLER BY CHECKING THE STATUS
OF THE RECEIVER BUFFER OF THE MIDI INTERFACE.
bit 3: status of CTS (not used in this circuit, don't care)
bit 4: show frame error. (sets when incorrect amount of stop bits.
Usually, don't care...)
bit 5: Sets if you forgot to read characters from rx data buffer
(overrun). (don't care, reading is handled by bios)
bit 6: Sets on parity error. Usually (when word= 8N1) don't care.
bit 7: Sets on interrupt. With a help of this line you can connect N
SERIAL PORTS to your ST (N>>2). Just place N pieces of 6850's
into different memory locations and hook them into same interrupt
line. On IRQ, poll the 6850's through and check whether this bit
is set. You will have to write a new interrupt driver for this.
Also, the serial ports should each have a buffer of at least 2k,
since the ST's processing capasity is pulled to the limits when
there are many users using one ST. There won't become a circuitry
for this from me, because I am normally using an Intel ?86 based
computer, sorry. (For standard users: don't care neither about
bit #7, nor any other of those seven above.)
DATA REGISTER (you can read and write this) is at $FFFC06. This
register contains the received data and when you write into it, you
"send" data. You must, of course, check, that it's empty before trying
to send something. Normally you don't need to get involved with this
memory location, but just in case you want to write a new interrupt
driver for the second RS-232 interface, so it's there for you.
Width 8 bits. (Standard sysops/users: don't care about this memory
location, bios will handle it.)
There is a Multi_User_BBS -software, GURFF_ST done by my brother utilizing circuitry described here. It will be available in major BBSes after about 6-12 (?) months of hard (??) programming. Also the C sources of that BBS will be tried to make available. The programme will be made so small in size, that there can be 3 USERS ON A STANDARD 1040 ST; also 3 programmes running simultaneously under MT C -shell (that is UN*X like C shell, a PD multitasking environment). Also a quick hard disk (faster than the 65ms SH204 or SH205) is recommended. On a 520 ST three simultaneous users is a problem. You with a 520 ST should build the 1 MB memory expansion IMMEDIATELY :-)
When this document was released (1.1.-89) Noitarumpu_BBS using the test version of GURFF_ST only had one telephone line, because one costs about $850 here in Oulu.
However, we can test drive GURFF on three sessions, since we have a test terminal attached to the second RS -port. You can try to tell the sysop at Noitarumpu_BBS to hurry the project up a little, as long as you don't tell him I advised you to do so. ;-)
Let's hope, that this software project doesn't prevent you from making a multiuser software of your own (a real UN*X?). When you have written the sources yourself, it's much easier to expand the software. If you make it a Public Domain multitasking system, you can add these documents (as long as you add the whole archive RS232-2.ARC) with no cost & permission.
Trouble Shoot
------- -----
Any -Check the circuitry, especially
the solderings. Check wirings too,
if you didn't find any faults.
Check with installation manual
HARDRS2.TXT.
ST doesn't boot -Check all circuitry for bad
solderings. If none found, remove
all circuitry installed and try
to do the installation all over
again and try to be more careful
when doing it.
MIDI -interface doesn't work (properly) -You are propably receiving
characters via 2ND RS -port
simultaneously, or check that
the switch is in the correct
position (i.e. 500kHz).
2ND RS -interface doesn't work properly -You are propably receiving
characters via MIDI -port
simultaneously, or check that
the switch is in the correct
position (i.e. variable fq).
2ND RS -interface doesn't work -A 1488 (transmitter don't work)
or a 1489 (receiver don't work)
you've installed might be broken.
If nothing else helps, buy new
ones, these are cheap chips.
Keyboard of ST doesn't work! The clock rate 500kHz may be short
circuited. Check. Or, what even
worse: You have done the whole
installation to the wrong chip!
Physically the keyboard chip is
similar to midi chip, but their
functions on an ST differ
dramatically. Again: on the
instructions there is mentioned
that only the clock rate is taken
from the keyboard chip. All other
solderings and changes are done to
MIDI -chip, which is u20 (chip
number 20) on ST. Check the printed
circuit board layout to find the
text "u20" near 6850's. You will
notice that the keyboard chip is
a "u21". So you must start the
whole installation process all over
again after repairing the keyboard.
(Or perhaps you should disassemble
the whole circuit and let someone
other do it for you!)
/* MIDITERM.C copyright 1989 by Kari Alakuijala */ #include#include #define CON 2 #define MIDI 3 int i, j; /* i contains speed,j 6850 ctrl reg. */ long tmpstck; char *k = 16776196; /* $FFFC04 = MIDI ACIA CTRL register */ main() { logo(); handle_RS_port(); terminal(); } logo() { clearscreen(); printf(" Miditerm.C\n"); printf(" ----------\n"); printf("\n\nThis is a sample terminal programme for use with MIDI or the 2nd\n"); printf("RS-232 interface. A compete multitasking BBS programme under MT C-\n"); printf("shell will come out after 6 months. This file is only added to show\n"); printf("some programming examples and to test the 2nd RS-232 interface.\n\n"); printf("Enter some parameters:\n\n"); } handle_RS_port() { getspeed(); /* Get datas from console and */ setspeed(); /* set them to timer A of 68901. */ clearscreen(); getparms(); /* Get datas from console and */ setparms(); /* set them to MIDI ACIA ctrl reg. */ } terminal() { char c, d; clearscreen(); printf("VT52 -terminal mode activated. Press CONTROL-A to enter commands:\n\n"); menu(); while(d!='x') { d=0; while(d!=1) { if(Bconstat(MIDI)) { c=Bconin(MIDI); Bconout(CON,c); } if(Bconstat(CON)) { d=Bconin(CON); if (d!=1) Bconout(MIDI,d); } } Cursconf(3,0); /* jamms cursor */ while (Bconstat(CON)); d=Bconin(CON); Cursconf(2,0); /* resumes blinking cursor */ if(d!='b' & d!='l' & d!='h' & d!='x' & d!='v' & d!='p') { Bconout(MIDI,1); Bconout(MIDI,d); } if (d=='b') { supervise(96,10); } if (d=='l') { supervise(96,150); } if (d=='h') { supervise(64,120); } if (d=='x') { printf("\n\nReturn to Desktop!\n"); delay(60); } if (d=='v') { getspeed(); setspeed(); } if (d=='p') { printf("\n"); getparms(); setparms(); } } } getspeed() { while (i<75 || i>19200) { i=0; printf("\nGive me the 2nd RS speed in bps (75, ... ,4800,6400,9600,19200): "); scanf("%d",&i); } i=19200/i; /* 75-19200 --> 256-1 */ i=i&255; /* 256 --> 0 */ delay(60); } getparms() { printf("Give me the settings for word lenght/stop bits/parity\n\n"); printf(" 1) 7 databits, 2 stopbits, even parity\n"); printf(" 2) 7 databits, 2 stopbits, odd parity\n"); printf(" 3) 7 databits, 1 stopbit, even parity\n"); printf(" 4) 7 databits, 1 stopbit, odd parity\n"); printf(" 5) 8 databits, 2 stopbits, no parity\n"); printf(" 6) 8 databits, 1 stopbit, no parity\n"); printf(" 7) 8 databits, 1 stopbit, even parity\n"); printf(" 8) 8 databits, 1 stopbit, odd parity\n"); while(j<1 || j>8) { j=0; printf("\nGive me (1-8): "); scanf("%d",&j); } j=(j-1)*4+129; delay(60); } setspeed() { Xbtimer(0,1,i&255,-1); /* start timer A of 68901 Value of 68901's Timer A ctrl register: 1 Value of 68901's Timer A data register: i */ } setparms() { tmpstck=Super((long)0); *k=j; Super(tmpstck); /* set integer J to 6850 control register at $FFFC04 */ } clearscreen() { Bconout(CON,27); Bconout(CON,'E'); } delay(loops) int loops; { int loop; for(loop=1;loop<=loops;loop++)Vsync(); } menu() { printf(" b) Send break.\n"); printf(" l) Send long break.\n"); printf(" h) Drop DTR (hangup).\n"); printf(" x) Return to Desktop.\n"); printf(" v) Set 2nd RS speed.\n"); printf(" p) Set 2nd RS other parameters.\n\n\n"); } supervise(add,dely) int add,dely; { j=j+add; setparms(); delay(dely); j=j-add; setparms(); }