This allows Greg Taylor's OPL3-FPGA to be controlled from a PC using USB-MIDI. The main purpose is to allow the use of OPL3-FPGA with modified versions of ScummVM and DOSBox through a USB connection.
-
Install Vivado 2016.1 and PetaLinux 2016.1.
-
Set up the environment:
source /path/to/vivado/settings64.sh source /path/to/petalinux/settings.sh
-
Download Greg Taylor's OPL3_FPGA BSP
-
Create a new PetaLinux project:
petalinux-create -t project -s ZYBO_OPL3_FPGA_2016_1.bsp
-
Change to the new project directory and clone this repository:
git clone https://github.com/waltervn/opl3_fpga-apps.git components/apps
-
Edit subsystems/linux/configs/device-tree/system-top.dts and add the following:
/{ usb_phy0: usb_phy@0 { compatible = "usb-nop-xceiv"; #phy-cells = <0>; }; }; &usb0 { dr_mode = "otg"; usb-phy = <&usb_phy0>; };
-
Configure the kernel:
petalinux-config -c kernel
Enable the following options:
- Device Drivers > USB support > NOP USB Transceiver Driver (*)
- Device Drivers > USB support > USB Gadget Support -> MIDI function (*)
Then exit and save the configuration
-
Configure the apps:
petalinux-config -c rootfs
Enable the following options:
- Apps > midi (*)
- Apps > opl3d (*)
Then exit and save the configuration
-
Build Linux:
petalinux-build
-
Use petalinux-package to generate BOOT.BIN:
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/opl3.bit --u-boot
-
Copy BOOT.BIN and image.ub (from images/linux) onto a MicroSD card and insert it into the ZYBO
-
Set JP5 to SD to enable booting from the MicroSD card
-
Remove JP1 to enable OTG mode
-
Power on the ZYBO and log into PetaLinux with root/root
-
Configure the MIDI gadget:
/etc/init.d/midi start
-
Use a Micro-USB cable to connect J9 (on the bottom side of the ZYBO!) to your PC.
You should see a configfs-gadget message pop up on the ZYBO. If it does not, try removing and reinserting the USB cable. If that doesn't help, turn off the ZYBO and try again. Sometimes it just refuses to work and I have no idea why that is. If anyone has any idea, please let me know.
-
Now start the OPL3 daemon:
/etc/init.d/opl3d start
-
Clone https://github.com/waltervn/scummvm.git and build the 'opl3-fpga' branch.
-
In the ScummVM launcher, go to Options > Audio and select "OPL3 FPGA" in the Adlib emulator list box. Click OK to save. Any games set up for AdLib will now use OPL3-FPGA.
-
Clone https://github.com/waltervn/dosbox.git and build the 'opl3-fpga' branch.
-
Edit dosbox.conf and make the following changes:
-
Under [sblaster] set oplmode to 'opl3fpga'.
-
Under [midi] set mididevice and midiconfig to point to the OPL3-FPGA midi device.
For Linux, try the following: Run 'aconnect -l' and look for "MIDI function". Use the client number you see there to set 'midiconfig'. E.g. if your client number is 28, set midiconfig to "28:0".
Other operating systems should work as well, as long as DOSBox has MIDI support for that platform, and you can point DOSBox to the OPL3-FPGA.