-
-
Notifications
You must be signed in to change notification settings - Fork 80
MiSTer FPGA user port connection
The MiSTer FPGA platform is an open-source project that can emulate vintage computing and gaming systems. The FPGA approach has the potential for greater accuracy and lower latency than what would be possible with traditional software-based emulation, and MiSTer provides an affordable route to benefitting from it, with community-supported hardware and emulation cores.
Many cores are available, and some are able to use external MIDI hardware, such as the AO486, Atari ST, and Minimig (Amiga) cores. This makes it possible to use mt32-pi with these cores.
Whilst MiSTer does allow you to run Munt and FluidSynth on its built-in Hard Processor System (HPS), there are severe limitations. See the FAQ for more information on why you might consider using mt32-pi with your MiSTer.
For convenience, mt32-pi and the MiSTer project have collaborated to develop a solution to directly connect the Raspberry Pi to the MiSTer, without the need for separate power, audio, or MIDI cabling.
MiSTer's I/O board provides a "user port" that provides direct access to some of the FPGA's GPIO pins, as well as power. The physical connector is a USB 3.0 Standard-A receptacle.
β Note: MiSTer's user port is not a USB port - the USB receptacle was chosen because they are inexpensive and widely available.
The user port connection offers the following benefits:
- Can power the Raspberry Pi.
- Transmits MIDI data directly to the Raspberry Pi's UART.
- Receives digital audio back from the Raspberry Pi via IΒ²S and mixes it with the FPGA core's audio output.
- Provides a control channel via IΒ²C so that mt32-pi settings can be changed from the MiSTer's OSD menu system.
- MiSTer can simulate an SSD1306 OLED display so that you can see mt32-pi's output right on your MiSTer's display!
An official MiSTer-endorsed HAT PCB design for the Raspberry Pi is available for a plug and play solution. You should soon be able to purchase one from your favorite MiSTer supplier.
If you have the means to assemble your own, you can find the PCB designs and further information over at the MiSTer hardware repository.
Whether you are connecting the Raspberry Pi to the MiSTer using an off-the-shelf USB 3.0 A-A cable and the MiSTer HAT PCB, or with home-made cabling (e.g. cutting up a USB 3.0 cable or using jumper wires), you must use a short cable to ensure reliable operation.
This is because IΒ²C is not really designed to be used over lengths of cable, and so signal degradation can occur due to capacitance in the cable and/or signal reflection. If you experience a corrupted OLED screen display or erratic synth switching behavior (e.g. as in issue #59), try a shorter cable.
The maximum USB cable length that has been tested successfully is ~50cm, and so this should be considered an "extreme" configuration. It is recommended that you try to find a cable <30cm long for a reliable connection. Anything longer is very likely to fail, so please consider this carefully when choosing a cable. Some users have used short jumper wires and still experienced failures because of poor quality of the wires and lack of shielding.
The following USB cables have been tested by users of the MiSTer HAT PCB.
Name | Length | Success? | Comments |
---|---|---|---|
AFUNTA A-A USB 3.0 adaptor | N/A | β | Sold by Amazon in several countries. Note: tested with adapter only, no cable! Tested by @bzeiss. |
deleyCON black/blue A-A | 50cm | β | IΒ²C corruption. Tested by @anakin. |
Good Connections black A-A | 50cm | β | IΒ²C corruption. Tested by @bzeiss. |
InLine USB 3.0 cable, A-A (35203) | 30cm | β | Tested by @bzeiss. |
Innov8 blue A-A | 50cm | β | Tested by @dwhinham. |
Innov8 white A-A | 30cm | β | Tested by @dwhinham. |
TUPower TP-U3-K55 | 50cm | β | Sold by Amazon DE. IΒ²C corruption/OLED screen black. Power & IΒ²S ok. Tested by @bzeiss. |
Ugreen 10369 | 50cm | β | Sold on Amazon US as "1.5ft". IΒ²C corruption. Tested by @dwhinham. |
Ugreen 80789 | 50cm | β | IΒ²C corruption. Tested by @anakin. |
USB 3.0 extension with AFUNTA A-A USB 3.0 adaptor | 15cm | β | Tested by @anakin. |
Follow the quick-start guide in the main README, but ignore the last two steps regarding MIDI and audio connections.
You must ensure the following options in your mt32-pi.cfg
are set to make the MiSTer user port interface fully functional. The rest of the settings are assumed to be set to the defaults.
[audio]
output_device = i2s
[control]
# Required for physical buttons
scheme = simple_buttons
# Required for OSD controls
mister = on
[lcd]
# Required for OSD "LCD-On" and "LCD-Auto" modes even if you don't have a real OLED display connected
type = ssd1306_i2c
# You can use either 32 or 64 pixel height
height = 64
- Connect the Raspberry Pi to the user port on the MiSTer and switch it on. mt32-pi should start up.
- If you see
Low voltage! Chk PSU
on the Raspberry Pi's LCD, see the next section. - On the MiSTer, start a core that includes mt32-pi support (currently AO486, Atari ST, or Minimig).
- You should see the MiSTer logo appear on the Raspberry Pi's LCD briefly - this means that IΒ²C communications between Pi and MiSTer are working.
- mt32-pi is now ready for use - try some games!
If mt32-pi is detected by the MiSTer, a new "MT32-pi" submenu will appear in the MiSTer's OSD.
When changing these options, remember to save your configuration to ensure they persist.
- Use MT32-pi: Enables/disables MIDI output to mt32-pi.
-
Show Info: Selects OSD information display mode.
- No: Disables information display.
- Yes: Brief "pop-up" notifications (similar to video mode/joystick notifications) are shown when mt32-pi's synthesizer/MT-32 ROM/SoundFont are changed, e.g. via button press, or sending a custom SysEx message from within the core.
- LCD-On(non-FB): Shows a copy of mt32-pi's LCD display on your MiSTer's video output (may not work for certain higher-resolution video modes).
- LCD-Auto(non-FB): As above, but automatically hides when the display is idle.
- Default Config section: Allows you to set the synth, MT-32 ROM and SoundFont you'd like the core to start up with. mt32-pi will switch immediately when you change these from the OSD, and will also switch when the core is re-loaded.
- Current Config: Shows the currently selected configuration as reported by mt32-pi. This may not necessarily match the Default Config above if you have changed the configuration from a button press or custom SysEx message.
- Reset Hanging Notes: Tells mt32-pi to switch off all notes on all synthesizers. Useful for if a game crashes and you want to silence any stuck notes.
π‘ Tip: If you reset the AO486 core using CTRL-ALT-ALT instead of CTRL-ALT-DEL, a core hardware reset will be performed, and mt32-pi will silence all notes. This may be a more convenient way to recover from a crashed system with hanging notes.
It is possible that some voltage drop may occur if the Raspberry Pi is being powered by the MiSTer, which could cause mt32-pi to display Low voltage! Chk PSU
on the LCD. Although it's not ideal, in practice there shouldn't be any issues so long as the voltage reaching the Pi isn't too far below +4.8V.
This message is triggered by the Raspberry Pi's GPU-based firmware, which will also throttle the CPU when it notices a low voltage condition. This will cause the audio to stutter. This mechanism exists to prevent data loss when using the Raspberry Pi as a computer, but for mt32-pi we should be able to safely disable it.
To do this, edit your config.txt
and add the following line above the [pi3]
section. This disables the warnings and the throttling:
avoid_warnings=2
β Note: This is not recommended; a better solution would be to find a stronger PSU that doesn't suffer as much voltage drop under load, and/or a less resistive cable between the user port and the Raspberry Pi. Please ensure your Raspberry Pi's CPU is heatsinked, as it's not known if this option disables thermal throttling!
Alternatively, you can cut the +5V connection between MiSTer and Raspberry Pi, and use a dedicated power supply for the Raspberry Pi.
Use this pinout if you'd like to build your own custom MiSTer interface.
- The leftmost five columns are for when constructing a USB cable to connect between the user port and a Raspberry Pi.
- If you want to connect a DE-10 Nano directly to a Raspberry Pi without an I/O board or USB cable, use the rightmost two columns and refer to your DE-10 Nano's manual for the pin positions.
- You can omit some of the connections if you don't want certain features. For example, if you don't want to use the MiSTer OSD integration, don't connect the IΒ²C SDA and SCL signals. If you don't want to send audio back to the MiSTer for mixing, don't connect any of the IΒ²S signals.
- You can connect a real SSD1306 OLED display too, if you'd like to have both a real display and make use of the OSD integration. Just connect your display as usual to the IΒ²C SCL and SDA signals of both the Pi and the MiSTer.
USB pin (user port) | USB signal name* | MiSTer signal name* | Wire color①| Raspberry Pi pin | DE-10 Nano Arduino pin§ |
---|---|---|---|---|---|
1 | VBUS | +5V | 2β | VCC5 | |
2 | D- | TX (MIDI out) | 10 | SDA | |
3 | D+ | IΒ²C SDA | 3 | SCL | |
4 | GND | GND | 6 | GND | |
5 | RX- | IΒ²S DAT | or | 40 | D10/SS |
6 | RX+ | IΒ²S BCLK | or | 12 | D11/MOSI |
7 | GND_DRAIN | IΒ²C SCL | Bare wire | 5 | D12/MISO |
8 | TX- | IΒ²S WS | or | 35 | D13/SCK |
9 | TX+ | RX (MIDI in) | or | 8ΒΆ | D8 |
- * Signal names are as seen from the MiSTer side (i.e. USB pin 2 is MIDI out FROM the MiSTer). The "USB signal name" is simply for cross-referencing the original purpose of the USB pin; the "MiSTer signal name" is what is actually being delivered on that pin.
- β Do not connect +5V if you want to use an external power supply for the Raspberry Pi.
- β‘ Wire colors for the RX and TX differential pairs could be swapped depending on which half of a cut USB cable you may be using.
- ΒΆ Optional, not currently used by mt32-pi.
- Β§ This column is for connecting a DE-10 Nano directly to a Raspberry Pi. Refer to page 30 of the DE-10 Nano User Manual to locate the pin positions.
Β© Dale Whinham 2020-2022. Released under the GNU General Public License v3.0.