Midi, serial ports, uart's and the compaq aero

Mikko Helin MHELIN at tne01.ntc.nokia.com
Fri Oct 9 10:57:58 CEST 1998


Dave,

You are right, it's possible to modify the serial port
for MIDI rates by changing the osc chip/crystal.
Some serial ports CAN do MIDI rates without any modifications.
You also need to convert the RS-232 port(s) to use
5-10 mA current loop (5 mA is what specs tell, but
to be sure everything works some more is needed).
I think www.midi.org is the site with electrical
circuits, there are also other sites (search altavista etc.)
with rs-232 to MIDI projects. 

Roland and Yamaha have working Windows drivers, that are
even able to use the FIFO's of 16550's, only problem is
that you can't use multiple ports with them.

I think it's not a very good idea to use 16550 based MIDI ports, 
as the FIFO's are so small (16 bytes of which some 10 are usually
employed), which means the computer have to waste some time waiting 
for the FIFOs to empty, and this will obviously kill the timing of 
your sequencer (if you read NG's, a quite common complaint is that
the MIDI timing of some sequencer, usually Cubase VST, lags).
There are some external MIDI ports which use serial port to
interface. They use faster baud rates (upto 500 kbit/s = 50 kB/s), 
which will cause less problems with timing, but I would prefer
an interface that uses parallel port, which is about five to ten times
faster. I don't know about Compaq Aero if it's got a printer port
or not. Sometimes portable's have different parallel port
than desktop machines, and then the only way is to use
the serial port.

I've been lately designing a MIDI output expander, which
will use large FIFOs (512 - 2048 bytes) connected to 6402 UARTs.
The system is comprised of an interface board with
4 Mhz osc (for logics) divided by 3 74HC74 stages  to 500 kHz
for UARTs, a 74HC138 3-to-8 decoder for chip/card selects and
a 25-sub DB connector for PC's printer port. You can connect
upto eight (8) MIDI transmitter boards to this via a single ribbon cable,
which carries the data lines, a write strobe, the reset line, 
power lines, chip selects, FIFO status (single line with
pull up on interface card, /FF condition pulls down the line with
an OC gate on transmitter board) and the clocks.

Each transmitter board has a 720x FIFO, a 6402 (I'll use COM8017,
which is a pin compatible) UART, a 74HC74 flip-flop for logics between
FIFO and UART, a 74HC00 4xNAND also for logics, and a 74HC05 hex 
inverter with open collector outputs for FIFO status (full flag output
to a common pin on parallel port), MIDI (2 MIDI outs/card)
and LED buffering, and couple of resistors and 0.1 uF bypass caps.
 
Software (=Windows drivers) will be modified from MROUTER source code
available somewhere in the internet (?). As the UARTs are $5 ($1 = 5 FMK),
and the FIFOs $6, the costs will be about $20/board, $180 for 8 channels.
There are less expensive ones commercially available.

-Mikko
-----------------------------------

I've been looking into using my compaq aero for midi
lately: controller, sequencer, composer, etc.  Of
course, I'm also looking for the most elegant solution
(read minimum external hardware).  The problem with using
the serial port directly is usually incompatible baud rates.
Midi uses 31.25 kHz.  In between the standard 28.8 and 33.6.
Serial ports are basically a UART chip (parallel to serial 
converter for the most part)  The aero uses a 16550 UART.

1. The clock on a 16550 runs at 16 times the baud rate.
   For Midi we would need 500 kHz.
   
2. This 16X rate is selected by setting a 16 bit register
   in the 16550.  The number stored in this register
   is used as a divisor against the clock being fed into the
   16550.


The most common clock frequencies for the 16550 are 1.8432
and 18.432 MHz.  This is the real problem.  There's no
integer divisor to get 500 kHz.  However,  after a quick
look inside the aero yesterday (I was actually thinking 
about changing the crystal), I believe the aero uses a
24 Mhz crystal.  24 Mhz / 48 = 500 kHz -> 31.25 kHz baud.

So it appears a little programming is all that's needed to
use the serial port for midi data.  This of course extends
to any computer with a 16550 running at 24 MHz.  I must say
though that I was a bit rushed when I made this discovery,
so if anyone can offer some validation or contradiction it 
would be appreciated.

These doubts arise due to the fact that getting 14.4, 28.8
etc from 24 Mhz doesn't work out to perfect integers.
But seeing as this is a portable with a pcmcia slot, the 
designers could have been thinking that a modem would usually
be in the slot and not on the serial port.

Hope this isn't a screw-up....dave moylan






More information about the Synth-diy mailing list