Date: Wed, 15 Jul 87 22:36:06 MEZ From: Bernhard Nebel Subject: A 2nd RS232 port Comment: Extracted from digest info-atari16 87-283 To: INFO-ATARI16@score.stanford.edu HOW TO GET A SECOND RS232 PORT FOR YOUR ATARI It might happen to you that you need a second RS232 port for your ATARI ST. Perhaps you have a printer with a serial port and a telephon modem, as I do. The first idea might be to go to your dealer expecting that he has an extension card for a few bucks. He hasn't, and you get curious about whether the ATARI can be regarded as a real computer. Anyway, you need a solution and don't want to trade your ATARI for one of those clones and are even more upset about the idea of exchanging the connectors any time you use another peripheral. This can be the point when you consider looking more seriously into the hardware detecting that there is this MIDI port you never spent any thought about. It is just there for those people who cannot play piano properly and compensate for this by buying a lot of electronic parts hoping that they can improve their music by it :-). You may even have a different opinion about them. You know, however, for sure that *you* won't use this port. Therefore it seems to be a good idea to use it for your own purposes. The above describes precisely my thoughts leading to the modification of my ATARI described below. It's just an easy, quick and cheap hardware hack -- it doesn't meet the RS232 standards -- but it works! I used a RS232 receiver to receive *and* send the signals, because this was the chip I found somewhere in my old computer (a 6800 !!) where it served the same purpose. However, note that nowadays RS232 tranceivers are available which should be used instead. Note that the description below applies *only* to the ATARI 520 ST and things may be different for the 1040. Additionally, the description can be, of course, incorrect. Therefore you should verify that the modifications described below are correct by consulting the proper sources. In any way, modifications according to the description below carried out by you are on your own risk. In particular, you should be aware that the warranty for your computer will expire after opening it. 1) A COMMUNICATION PORT The first thing you have to decide is what communication port you like to use. I chose the MIDI IN port for three reasons: - I won't use MIDI after the modification. - Connectors for this communication port are easily available and cheap. - Three of the five pins aren't used. The drawback of this solution is that you might easily confuse the MIDI IN port with the MIDI OUT port when plugging in your connector which can result in blowing up your peripheral. I use the following pin assignment: Pin 1 = RS232 OUT Pin 2 = GND Pin 3 = RS232 IN Note that pin 4 & 5 are already used. Pin layout of the communication port seen from inside: 1 3 4 5 2 NOTE: In a lot of sources including my ATARI manual I found a different pin layout which, however, seems to be wrong. SOLDERING: Pin 2 of MIDI IN has to be connected with pin 2 of MIDI OUT. NOTE: These pins are only accessible from the bottom side of the board. 2) REWIRING THE MIDI ACIA The wiring of the MIDI ACIA has to be changed. We have to rewire the Tx-Data and Rx-Data pins, because we want to use a different driver. Additionally, the Tx-Clk and Rx-Clk must be connected to a different clock, because a fixed baud rate of 7812.5 is probably not appropriate. In the ATARI 520 ST the 6850 sitting next to the sound chip -- the YM 2149 -- is the right chip. CUTTING: Pin 2 (Rx Data), pin 3 (Rx Clk), pin 4 (Tx Clk) and pin 6 (Tx Data). 3) A NEW BAUD RATE GENERATOR Timer A of the MFP 68091 is not used and can be employed as a baud rate generator for our ACIA. A tiny assembler program setting the correct baud rate is given below. I usually run this program at boot time from my AUTO folder. A more sophisticated solution could be to write an accessory to set the baud rate. SOLDERING: Connect pin 3 (Rx Clk) and pin 4 (Tx Clk) of the MIDI ACIA with pin 13 (Timer A Out) of the MFP. 4) A RS232 DRIVER As I said above, I used a RS232 receiver (SN 75189) for both transmitting and receiving. That means that the outgoing signal does *not* conform to the RS232 voltage level specification. However, this cheap kludge always worked. SOLDERING: - Mount a 75189 (RS232 receiver) on a small circuit board. - Connect pin 14 (Vcc) of the 75189 with Vcc, e.g., with pin 14 of a 7404. - Connect pin 7 (Gnd) of the 75189 with Gnd, e.g., with pin 7 of a 7404. - Connect pin 13 (4A) of the 75189 with pin 3 (RS232 In) of the MIDI IN port . - Connect pin 11 (4Y) of the 75189 with pin 2 (Rx Data) of the MIDI ACIA . - Connect a resistor (1K Ohm, probably 10K works as well) with pin 11 (4Y) of the 75189 and Vcc. - Connect pin 3 (1Y) of the 75189 with pin 1 (RS232 Out) of the MIDI IN port. - Connect a resistor (1K Ohm) with pin 3 (1Y) of the 75189 and Vcc. - Connect pin 1 (1A) of the 75189 with pin 6 (Tx Data) of the MIDI ACIA. - Finally, you should install the circuit board somewhere on the motherboard. These are all hardware modifications in order to get a second RS232 port. There is, however, some software necessary before you actually can use the new port. First, the baud rate has to be programmed into timer A. A small assembly program is given below. Second, the ACIA registers have to be set up to the proper values. At boot time they get set to 8-Bit, no-parity. Third, you have to write programs which actually use the port. I, for my part, changed GEM-KERMIT and my TERMINAL accessory in order to work with the MIDI port. SETTING THE BAUD RATE: * Initialize Timer A as baud rate generator for MIDI ACIA * * Bernhard Nebel 14.12.86 * * valid values for data and control are: * baud control data * 19200 1 1 * 9600 1 2 * 4800 1 4 * 3600 1 5 * 2400 1 8 * 2000 1 10 * 1800 1 11 * 1200 1 16 * 600 1 32 * 300 1 64 * 200 1 96 * 150 1 128 * 134 1 143 * 110 1 175 * 75 2 64 * 50 2 96 gemdos equ 1 bios equ 13 xbios equ 14 Pterm0 equ $00 Cconws equ $09 rsconf equ 15 setprt equ 33 xbtimer equ 31 modem .equ * move.l #-1,-(sp) vector move.w #64,-(sp) data move.w #1,-(sp) control move.w #0,-(sp) timer = A move.w #xbtimer,-(sp) trap #xbios add.l #12,sp move.l #mess,-(sp) move.w #Cconws,-(sp) trap #gemdos addq.l #6,sp move.w #Pterm0,-(sp) trap #gemdos * strings .even mess dc.b "MIDI port initialized (300 baud, 8-Bit, Nosync).",$0D,$0A,0 Have fun - Bernhard } MAILER STANFORD 7/15/87 v Mail Delivery Subsy NEBEL@DB0TUI11.BITN 7/15/87 Returned mail: User unknown Acknowledge-To: $