So given that the MiST 1.3 loses the serial pins in favor of having the MIDI built in, and given that MIDI is basically serial, has anyone done a MIDI to RS232 adaptor and gotten it to work with the Atari and Amiga cores? The Amiga is the one I'm most interested in given that the Atari claims support for USB ethernet. I have a few schematics and the hardware side of it seems simple enough, just not sure how I would properly setup the Amiga to try and "dial out" via MIDI.

Not seeing a lot of feedback on this... so I may have my first big project once my MiST gets here. Basically, I'm thinking of something like this.a schematic from compuphase to go from MIDI to serial to control a MP3 player. Seems like you could go to a modem emulator instead, so long as you could convince the Amiga/Atari to talk to it over the MIDI ports.

I wouldn't necessarily recommend building that circuit as-is, because it has a few shortcomings. The three changes I'd make would be to provide some buffering or clamping for the MIDI output and RS-232 pins (connecting a CMOS pin from the MAX232 to a connector is a bad idea). Pin 5 of the MIDI output always needs to have a 220 ohm resistor in series - I see this error a lot in hobby designs and it's completely wrong. I'd also provide a resistor on the base of the 6N138 to ground (about 4.7k) to turn it off faster. Otherwise, it may not reach 31.25k baud reliably. Alternatively, you could replace the 6N138 with a PC900 or H11L1 or H11L4 optocoupler (use a 280 ohm pull-up resistor - although Atari used a 4.7k pull-up and it seemed to work reliably).

You can drastically simplify the circuit though. Here's a design for an Amiga MIDI interface I did a while ago. NOTE: I haven't tested it yet!

Old version:

Amiga MIDI interface.png

Newer version:

Amiga MIDI interface ver2.png

The newer version is the better version for using as an Amiga MIDI interface device. The old version is better for interfacing to general RS-232 devices - because it can swing its output to -12V.

To use it stand-alone, you will need to provide +12 volts on pin 9, and -5 to -12 volts on pin 10. It should provide an acceptable degree of ESD protection. You can probably cheap out and connect pin 10 to ground instead of -12 volts, but that isn't strictly RS-232 compliant. It will work with most RS-232 devices, but not all. You can also use a regulated 5 volt supply on pin 9 by shorting resistor R3, replacing zener diode D2 with a 1N4148 and lowering R8 to 680 ohms.

The +/- 12 volt supply must not exceed 15 volts off-load.

Baud rate is mainly limited by the optocoupler. It will probably work at 38.4k. You might be able to go faster, depending on the characteristics of the particular optocoupler you use. Faster optocouplers are available like the TLP2361, but you'll need to limit the positive supply to exactly 5 volts if using a TLP2361. Don't just substitute any optocoupler because most of them aren't fast enough and/or have a too high threshold current.

You could remove the optocoupler entirely for faster speeds. In this case, instead of connecting the emitter of the 2N3906 to pin 9 of the modem port you connect it to pin 4 of the MIDI input jack. Pin 5 of the MIDI jack connects to where pin 4 of the optocoupler was. R6 needs to be changed to 3.3k. Pin 2 of the MIDI input jack connects to ground (not MIDI compliant, but should work with the MIST). You can remove D3 and R5, but you'll want a 1N4148 diode from pin 4 of the MIDI jack to ground - cathode to pin 4.

Foxie wrote:I wouldn't necessarily recommend building that circuit as-is, because it has a few shortcomings. The three changes I'd make would be to provide some buffering or clamping for the MIDI output and RS-232 pins (connecting a CMOS pin from the MAX232 to a connector is a bad idea). Pin 5 of the MIDI output always needs to have a 220 ohm resistor in series - I see this error a lot in hobby designs and it's completely wrong. I'd also provide a resistor on the base of the 6N138 to ground (about 4.7k) to turn it off faster. Otherwise, it may not reach 31.25k baud reliably. Alternatively, you could replace the 6N138 with a PC900 or H11L1 or H11L4 optocoupler (use a 280 ohm pull-up resistor - although Atari used a 4.7k pull-up and it seemed to work reliably).

You can drastically simplify the circuit though. Here's a design for an Amiga MIDI interface I did a while ago. NOTE: I haven't tested it yet!

Amiga MIDI interface.png

To use it stand-alone, you will need to provide +12 volts on pin 9, and -5 to -12 volts on pin 10. It should provide an acceptable degree of ESD protection. You can probably cheap out and connect pin 10 to ground instead of -12 volts, but that isn't strictly RS-232 compliant. It will work with most RS-232 devices, but not all. You can also use a regulated 5 volt supply on pin 9 by shorting resistor R3, replacing zener diode D2 with a 1N4148 and lowering R8 to 680 ohms.

The +/- 12 volt supply must not exceed 15 volts off-load.

Baud rate is mainly limited by the optocoupler. It will probably work at 38.4k. You might be able to go faster, depending on the characteristics of the particular optocoupler you use. Faster optocouplers are available like the TLP2361, but you'll need to limit the positive supply to exactly 5 volts if using a TLP2361. Don't just substitute any optocoupler because most of them aren't fast enough and/or have a too high threshold current.

You could remove the optocoupler entirely for faster speeds. In this case, instead of connecting the emitter of the 2N3906 to pin 9 of the modem port you connect it to pin 4 of the MIDI input jack. Pin 5 of the MIDI jack connects to where pin 4 of the optocoupler was. R6 needs to be changed to 3.3k. Pin 2 of the MIDI input jack connects to ground (not MIDI compliant, but should work with the MIST). You can remove D3 and R5, but you'll want a 1N4148 diode from pin 4 of the MIDI jack to ground - cathode to pin 4.

Also to keep some RS-232 devices happy, you might want to loop back the following pins on the RS-232 port:RTS to CTSDTR to DSRAlternatively you can just connect RTS and DTR to a +12 volt supply.

Thanks for the info, will make use of it when I find myself not being lazy enough to tackle this project. May also look at adding support for USB to serial instead... not sure which path is the one of least resistance. For when I'm lazy as I normally am, I'll just pull the SD card and load the drive image into an emulator to get online and download stuff.

Kujako wrote:Thanks for the info, will make use of it when I find myself not being lazy enough to tackle this project. May also look at adding support for USB to serial instead... not sure which path is the one of least resistance. For when I'm lazy as I normally am, I'll just pull the SD card and load the drive image into an emulator to get online and download stuff.

I don't know exactly what's involved with implementing USB to serial. USB is extremely over-complicated so I would imagine it would be a major undertaking.

Providing the Amiga core uses the MIDI I/O as a modem port, it will be much simpler just to build a suitable interface. There's few enough components that you could just build it on perfboard or a plug-in breadboard.

I've found a later version of the MIDI interface device schematic, I've updated the post with it. The old version is probably a better choice for driving RS-232 devices other than Amigas. It's a bit more compatible (but does need -12V). You could always try it with ground instead of -12V and see if your device (modem emulator?) is compatible with it.

The external power supply needs to be able to deliver about 60mA on +12V, and 10mA on -12V. Of course you don't need the power supply if it's plugged into a real Amiga because it draws power from the modem port. But using it backwards with a MIST, you'll need external power.

the old mist had its advantage in that without any additional circuitry needed, you could wire the RX/TX lines that formerly connected to the Mist's midi board directly to the GPIO serial console lines of a Raspberry Pi... Why? because the Raspberry Pi's gpio uses the same voltage levels as the Mists tx/rx lines and does not require any voltage level shifting if say you wanted to use a standard rs232 connection which does.. The direction they took by hardwiring the midi in the last rev of the mist IMHO was a mistake because it was more useful to allow the end user to disconnect the midi and use the RX/TX lines as they saw fit (or the core author specifically)

This really isn’t a mod as all I’m doing is adding a connector to the board and plugging some wires into it. What this will give me is a 3.3 volt serial connector that I can tie straight into the serial lines on the GPIO of a Raspberry Pi. This connection is supported “out of the box” in the Amiga/Minimig core, and possibly other cores as well.

It was really just a matter of taking the case apart, taking the board out, and soldering a connector to the board.

One potential pitfall to watch out for if wiring a Raspberry Pi and MIST together like that is latchup. Without looking at the datasheets for the Pi's MCU and the FPGA used on the MIST, I can't tell if it's vulnerable to latchup.

The problem occurs if one of the two devices is powered off and the other is powered on. With many CMOS ICs, there are clamping diodes from the inputs to the supply. If you drive the input to +3.3V with it powered off, current flows through the diode. This can cause two bad things to happen. First, you can exceed the current the diode is rated for and cause gradual or immediate damage to the IC. Second, if the powered-off device is then powered up the device can enter latchup. This will probably cause immediate destruction of the IC. It occurs because the parasitic SCR that's formed by the diode structures gets triggered. It then shorts out the supply, sinking amps of current. Whether the SCR actually triggers is really a matter of luck.

Some ICs are invulnerable to latchup because they lack the diodes to the supply rail. In this case, no problem with a direct connection.

One way to prevent latchup is to limit the current by putting resistors in series with the inputs on each device. The exact resistor value depends on the maximum clamping current allowed by the ICs. I've seen values from 0.5mA to 30mA before.

Too high a value resistor can be a problem if the receiving device has a pull-up resistor - it will never be able to pull it low enough. In this situation, the simplest way to make the interface is using schottky diodes and pullup resistors. The input should be pulled to the receiver's 3.3V supply, and a schottky diode is connected anode to the input. The transmitter's output is connected to the other side of the diode. The pullup resistor needs to be a fairly high value to avoid forcing too much current through the transmitter's clamping diode.

Looking at the datasheet for the FPGA and Pi MCU (if available?) would determine whether such measures are actually needed. I've looked at the datasheets for a few FPGAs, and they seem not to have the clamping diode.

Interesting related topic, found info on using STing to connect an ST to a Falcon over MIDI which is connected to a PC over serial to get both the ST and Falcon online... so there is support for IP routing over MIDI on the ST.

Hmm, is it really acceptable to run the 6N138 on a 3.3V supply? The datasheet only characterizes it down to 4.5V, so I would tend to assume it requires a 5V supply. Obviously it works for that guy, but it may not be completely reliable.

A better choice might be the H11L1. That will definitely work with a 3.3V supply, and you don't need the extra base resistor either. The MIDI spec recommends a 270 ohm pullup resistor with the H11L1/PC900, but Atari used a 4.7k resistor and it seemed to work reliably. At 3.3V you'd want to lower those values accordingly - 180 ohms to 3.3k. I don't know how much current the Raspberry Pi's power supply can deliver.

Also with either the 6N138 or H11L1 you always need a 0.1uF decoupling capacitor across the optocoupler's supply. That isn't shown in the schematic on that site, but it's quite important.

I find it slightly strange that Atari went to the trouble to implement a LAN port, yet never really seemed interested in encouraging developers to use the MIDI ports for networking. Providing all machines in the network are switched on, a MIDI loop seems like the perfect way to do networking on the cheap - much cheaper than AppleTalk. You could also design an inexpensive switch box which sucks power from the MIDI port and loops the input to the output when the machine is turned off - a bit like token ring.

I have Rasperry pi zero built into the MiST, stuck ontop of the SD card reader, and it takes 5V from the MiST power input, so the devices are turned up and down as one. And I never ever had a more stable and reliable null-model setup between two systems

kolla wrote:I have Rasperry pi zero built into the MiST, stuck ontop of the SD card reader, and it takes 5V from the MiST power input, so the devices are turned up and down as one. And I never ever had a more stable and reliable null-model setup between two systems

Kujako wrote:Yeah, more or less what I'll be trying. Got my MiST and am futzing around with it a bit before I try anything too seriously.

If you do build something like the circuit shown, then be sure to include the diode because it protects the Pi from latchup damage (the 10k resistor being as high as it is also protects the MIST from latchup).

The circuit shown omits the series resistor between the Pi's output and the MIST input. The MIST's optocoupler can easily handle the higher current, and it should deliver faster speeds. Going by the typical values published in the data book for the 6N138, a rise/fall time of about 2us could be achieved. Unfortunately, the MIST runs the optocoupler out of spec (at 3.3V supply) so who knows what will really happen. It's amazing it works at all. If you can achieve 2us, then 115.2k may be possible.