YM2413/UM3567 Interfacing to a microcontroller?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
YM2413/UM3567 Interfacing to a microcontroller?
by on (#110888)
Some days ago I just got these YM2413 clones which are the UM3567, and tried to interface it with a microcontroller with no luck, which is no sound at all. Even double checked the basic connection schematics for the YM2413. As the UM3567 has 24-pins, I have to refer to the http://www.msxpro.com/fm.html for the pinouts.

I even tried to connect the output (right now testing only the Melody-Out) to an op-amp buffer, and an LM386 amp, and got no sound.

Any ideas on how to interface the YM2413 and/or its clones? I have tried the other clone chips such as KC89C72 (which is the clone of GI's AY-3-8910) and it's much easier to get an output compared to the YM2413.

Thanks.
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110889)
The OPL family chips are really picky about not using too fast of a delay between register writes—in the OPLL applications manual it claims you may have to wait up to 12 (address→data) and 84 (data→address) oscillator cycles between writes to the OPLL.

The only game to use the sound in the VRC7 (which is a custom second-source OPLL) enforces delays of 24 and 122 oscillator cycles, respectively.
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110891)
lidnariq wrote:
The OPL family chips are really picky about not using too fast of a delay between register writes—in the OPLL applications manual it claims you may have to wait up to 12 (address→data) and 84 (data→address) oscillator cycles between writes to the OPLL.

The only game to use the sound in the VRC7 (which is a custom second-source OPLL) enforces delays of 24 and 122 oscillator cycles, respectively.


Hello,

Thanks for the fast reply. Yeah, I actually did let a long delay (more than 100 microseconds) for each data transfer. I'll try rewiring these again as I'm doing it on a breadboard and a PIC microcontroller. The UM3567 has a different pinouts, but I assume most of the registers on the thing is the same as the one in the YM2413. In other story, the KC89C72 (clone of AY-3-8910) has a slight difference in the registers compared to the original one by GI/Microchip.

I know this is a funny attempt since one can just make an FM synthesizer using dsPIC w/ DAC (I actually did for a contest, but using a PIC32) but I'm kinda curious on how does the "retro" meets the modern. :)
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110896)
Maybe your write strobe pulses are too short ?
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110898)
TmEE wrote:
Maybe your write strobe pulses are too short ?

Is there any requirement for how long the strobes must be compared to the chip's own clock frequency?
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110899)
I was trying to reply hours ago, but my connection was a bit wonky, so didn't get to send this until now.

Finally, I got the thing to work. At first I dumped random values, and there I hear noises. So I confirmed these chips are working on my hand. So, one by one, I tested each register to see whether the UM3567 is different compared to the YM2413. Results, it is almost the same, that UM3567 is 24-pins and has a different pinout.

Up to the level that I managed to coax the thing to play a note or two on it, using the pre-set instrument values. It worked but I don't hear anything after I put a value more than 0x04 or 0x05 in the "volume section" in the addresses 0x30~0x38. I had to put it to 0 and that is the loudest. On the datasheet, putting the "f" into that nibble means maximum volume. Either the engineers there might have intentionally flipped the values, or it is a defective one. I have to try the other chips to confirm this one.

The strobes and the delays are more than the required one in the datasheet, so it's still OK.

I'll update the post should I find something interesting about that chip.
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110904)
The volume is attenuation, which means 0 is max and F is silence.
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110910)
TmEE wrote:
The volume is attenuation, which means 0 is max and F is silence.


Thanks. Hmm, I found it strange that in the application manual it means only "Volume". Some examples like that YM2413 shield for Arduino (custom made) uses "F" as the maximum volume.

On other news, the sound coming out from the clone is a bit too soft. I'm connecting this to a TDA7052 without much improvements as well. Could it be the output impedance problem?
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110929)
EDIT: Whoops, the register is "volume" indeed, I checked some of my SMS code and I am assuming F is max and 0 is silence

According to a friend of mine that clone chip definitely has different output stage. I don't have any personal experience with it so I cannot really comment. Real YM2413 is quiet and you do need some amping stage. The output is muxed (channels one after other) which produces a ton of really high freq components in the signal (up to and beyond 1MHz) so you need to experiment with some filtering or the opamp is gonna have hell of a hard time doing proper output.

You can see my output stage for the YM2413 here :
Wide picture
Re: YM2413/UM3567 Interfacing to a microcontroller?
by on (#110950)
TmEE wrote:
EDIT: Whoops, the register is "volume" indeed, I checked some of my SMS code and I am assuming F is max and 0 is silence

According to a friend of mine that clone chip definitely has different output stage. I don't have any personal experience with it so I cannot really comment. Real YM2413 is quiet and you do need some amping stage. The output is muxed (channels one after other) which produces a ton of really high freq components in the signal (up to and beyond 1MHz) so you need to experiment with some filtering or the opamp is gonna have hell of a hard time doing proper output.

You can see my output stage for the YM2413 here :
Wide picture


Thanks for the info. You have been extremely helpful. I got a decent volume out of the TDA7052 right now because I forgot to put the 5K resistor between the inputs in the amplifier. :)

Prior to that, I passed the thing to a first order LPF, which cuts off on at least 54kHz. The sampling frequency in the datasheet was around 50kHz. Haven't experimented with multi-orders as I had lost touch on those things since many years ago. Had to read up on it and to speak to my colleague (he's an expert in this) for opinions.