When researching material for the SN76489 sound generator (documented in these previous articles) I discovered that many early microcomputer systems incorporated both the SN76489 and a YM2413 FM synthesizer. The Yamaha synthesizer looked like an interesting piece of hardware to explore. Here’s the result.
The YM2413 synthesizer IC
The YM2413, or OPLL, is a cost-reduced FM synthesis sound chip manufactured by Yamaha Corporation and based on their YM3812 (OPL2).
Its main historical application was the generation of music and sound effects in microprocessor systems. It was extensively used in early game consoles, arcade games, home computers and low-cost synthesizer keyboards.
The cost reducing simplifications created a cut down IC that allowed for one user-defined instrument and fifteen read-only hard-coded instrument profiles (violin, guitar, piano, flute, clarinet, oboe, trumpet, organ, horn, synthesizer, harpsichord, vibraphone, synthesizer bass, acoustic bass and electric guitar). The IC can operate either as nine channels of melodic instruments or six melodic channels and five hard-coded percussion instruments (high hat, top cymbal, and tom tom, snare and bass drums).
The IC comes in an 18 pin DIP or a 24 pin SOP package with the following pinout signals
|D0-D7||Register Address and Command byte inputs for OPLL command|
|/WE||Active low Write Enable (latches data)|
|/CS||Active low Chip Select (connect to GND or, if more than one IC shares D0-D7, a MCU output )|
|/IC||Chip reset (pull up to Vcc or connect to MCU reset)|
|AO||Address/Data discriminator for D0-D7|
|MO||Melody Audio Output|
|RO||Rhythm Sudio Output|
|CLK||3.579545 MHz clock signal|
|VCC||5V power input|
The block diagram for the IC provides an overview how the pins control the IC. It has an 8 bit bus interface (D0-D7) with one address line (A0) to select one of two write-only registers. One register is used to select the byte address to access a block of 8 of the 271 internal register bits, and the other is used to write the data into the the selected 8 bit register.
The IC is made active by setting /CS low, allowing more than one device (YM2413 or otherwise) to share the same data lines. The /WE line is used to latch the current data on D0-D7 into the IC address/data registers. The interaction between the bus control signals is shown in the table below:
|1||x||x||Chip not selected, inactive mode|
|0||1||x||Data bus inhibited mode|
|0||0||0||Address write mode|
|0||0||1||Data write mode|
On the analog output side there are two audio outputs, one each for the Rhythm and Melody (RO, MO) that must be amplified.
Yamaha produced an application manual for this IC documenting all the internal registers, handshake timing and model circuits. This is available for download from here.
Like the previous SN74689 project, I decided to directly connect the hardware to MCU I/O.
This time, however, I elected to design an Arduino Uno shield that includes both the synthesizer and an audio amplifier. The output from the shield can be fed directly into a speaker.
The circuit schematic is shown below (click on the image to enlarge).
There are 2 parts to the circuit
- The first is the direct digital interface interface between the MCU outputs and the YM2413 inputs. This is a straightforward connection between digital outputs on the MCU and the data and control lines of the synthesizer IC.
- The second is the sound amplifier. The audio output from MO and RO of the IC are combined into a mono signal to feed a TEA2025 amplifier. The TEA2025 circuit is based on the model circuit found on the amplifier’s data sheet.
The circuit and PCB layout were created using Eagle CAD and sent for manufacturing. The schematic and PCB layout files are available from this location.
The pictures below sown the different stages of the PCB from DEsign to fully populated. The TEA2025 warm up when the volume is turned up, so it has a heatsink attached to keep the heat under control.
In the next part we’ll start communicating with the test hardware and producing sound.
SPECIAL OFFER: I have limited number of the test shield PCBs that are surplus to requirements (minimum order was 5 boards from JLCPCB). I am able to supply partial kit consisting of 1 PCB, heatsink, audio connector and crystal for USD$8 shipped anywhere. You will need to provide all the passive components, header pins, TEA2025 and YM2413 (ICs are easy to get on eBay). If you are interested please leave a comment.