YM3812 + YM3014 issue - Page 1
Forum section: electronics / projects

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 22, 2013, 03:13:52 am
content: Hi.I am trying to build a synth device using original synth chips, and I am using the OPL2 chip in my project.I am having problems with the output dac (YM3014), since I get no output.The YM3812 seems to work properly, it is giving signals which look good on the scope, I can see the clock signals, and serial data being shifted out. The YM3014 datasheet suggests using a 072 opamp, but since I don't have that I used the LM324. The output seems to give a very faint voltage, because when I poke the oscilloscope probe at x10 I just see a discharge peak, and the opamp (in buffer mode) is giving out a fixed voltage.I used this schematic as a reference:http://cbm.ko2000.nu/schematics/cartridges/c64/sfx/sfx-sch.gifExcept that I didn't make that output amp part like that, but rather like the one shown in the YM3012 datasheet (simpler).Is the chip defective, or did I do something wrong?

author: marshallh
author_rank: Unknown
timestamp: August 22, 2013, 03:19:30 am
content: Maybe you have1. Bad/fake LM3242. Bad/fake YM3012 (clones do exist of the OPL family)All I can think of barring wiring mistakes/forgetting to bypass supplies

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 22, 2013, 03:38:05 am
content: Quote from: marshallh on August 22, 2013, 03:19:30 amI tryed replacing it with anoter one, no effect.Quote from: marshallh on August 22, 2013, 03:19:30 amMaybe, but I doubt that, since I got it from ebay recently.Quote from: marshallh on August 22, 2013, 03:19:30 amI added bypass caps, and I checked the wiring, didn't spot anything.When I read the datasheet of both chips I got the impression that SH went to Load and SY went to Clock, but the schematics says otherwise. I tried both combinations, nothing changed.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 22, 2013, 05:45:23 am
content: I tried testing the DAC chip by glitching the serial input to some other random signal on the board, and I do get a random analog signal at the output, so the DAC is working, which means that the synth chip is always giving out the same value. So either the data bus has some issues, or the test data from the "Programming the AdLib/Sound Blaster FM Music Chips Version 2.0" has some issues (which I doubt).I am driving the bus with a ATmega162@8MHz with double bus cycle.I did try reading and writing to a ram chip, and that worked fine.Edit: One problem fond, the addresses were messed up in code.Edit2: Ok, I fixed that, now I can see the data alternating every few ms, but still no analog out.And why on that schematic do the Load and Clock look inverted? Is it a schematic error, or is it supposed to be like that?

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 22, 2013, 08:22:48 pm
content: That schematic is wrong indeed.I returned the wiring as I initially connected it.I managed to get a signal out of the chip!But only after poling the reset switch a few times.Also, I don't get the same tone every time.Sometimes I get a higher frequency, sometime a lower, sometime just a steady tone.Sounds to me like the bus is having issues, but I can't find any.What could be the cause?

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 23, 2013, 01:16:41 am
content: I took a closer look to the bus, and it looks just fine. I even slowed it down with a 4MHz oscillator.But there is something award going on between write cycles. The data on the data bus is changing every few clock cycles, and ALE is triggered 4-5 times between each write signal. I don't see why does the ATmega do that, except if it is some sort of don't care signal stuff going on.

author: Stonent
author_rank: Super Contributor
timestamp: August 23, 2013, 03:40:05 am
content: Cool! I was hoping to see someone do some circuits using older Yamaha chips.I'd also like to see someone use a YM2612 and SN76489 for some vintage Sega Genesis sounds.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 23, 2013, 04:23:25 am
content: Quote from: Stonent on August 23, 2013, 03:40:05 amHa, didn't know about the YM2612 or about the SN76489.When I started the project I just went digging on wikipedia looking for synth chips, and then I went to see what was available on ebay. In the end I decided for the YM3812 since it was in the AdLib card, and the SAA1099 since it is sorta analog, and simpler.I tried writing my own routines for driving the bus by software, and I checked all of the signals with my scope, and they are fine, but then I couldn't get anything out of the YM3812 at all.I took another look to the YM3812 datasheet, and it shows that the CS signals goes out at the same time WR goes out, so I added a bit of glue logic for achieving that, but nothing changed.I also tried building a proper reset circuit, but nothing changed.When it happen to work, if I go to adjust the tone register, the tone does change.I tried doing everything that came to my mind, and I can't figure out what is the issue.Sometimes it works, sometimes doesn't. If we suppose that the chip is not damaged, what could be wrong?Any ideas/suggestions?About the SAA1099, I didn't have much luck with him either, I can reed the dack signal being asserted during a write cycle, but that is it. I couldn't find any example data to feed it, so I looked at the datasheet and tried to figure out what registers should I activate, but I guess I messed up something there.YM3812 code:Code:olp_wr(0x20,0x01); //Set the modulator's multiple to 1olp_wr(0x40,0x10); //Set the modulator's level to about 40 dBolp_wr(0x60,0xF0); //Modulator attack: quick; decay: longolp_wr(0x80,0x77); //Modulator sustain: medium; release: mediumolp_wr(0xA0,0x98); //Set voice frequency's LSB (it'll be a D#)olp_wr(0x23,0x01); //Set the carrier's multiple to 1olp_wr(0x43,0x00); //Set the carrier to maximum volume (about 47 dB)olp_wr(0x63,0xF0); //Carrier attack: quick; decay: longolp_wr(0x83,0x77); //Carrier sustain: medium; release: mediumolp_wr(0xB0,0x31); //Turn the voice on; set the octave and freq MSBSAA1099 code:Code:saa_wr(0x1C,0);saa_wr(0,255);saa_wr(0x18,0);saa_wr(0x19,0);saa_wr(0x14,0x11);

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 23, 2013, 04:48:06 am
content: I tried writing a simple loop that iterates two registers, and the result is amazing.Never heard such sounds! This chip is great!I just have to get it to work every time...Edit: When I poke the register 0x63 in a loop it seems to work much more often.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 24, 2013, 03:01:58 am
content: After running out of ideas for the YM3812 I went to see what is wrong with the SAA1099 and I managed to get the it working. I forgot to add the pullup resistors, and there was a issue with the reset register, which I fixed now.This values will cause some sounds to be generated:Code:saa_wr(0x1C,255);saa_wr(0x1C,1);saa_wr(0,255);saa_wr(8,255);saa_wr(0x10,0);saa_wr(0x14,0x33);saa_wr(0x18,0);saa_wr(0x19,0);The YM3812 is still a misery, sometime it works, sometime it doesn't.I tried glitching the clock generator circuit, and that causes some very awkward/unheard sounds, and it even can reactivate the chip when it boots improperly. So I am now starting to thing that there might be something wrong with the chip.Any ideas/suggestions?

author: loscha
author_rank: Newbie
timestamp: August 24, 2013, 03:04:50 pm
content: I've got a few sets of YM3812 etc chips. Are you driving the board straight from PC via Controller.I've got them because I'm a synthesizer nut.Are you considering MIDI?

author: Dajgoro
author_rank: Frequent Contributor
timestamp: August 25, 2013, 12:15:50 am
content: Quote from: loscha on August 24, 2013, 03:04:50 pmI am building a system with a ATmega162 that will have a MIDI input, and a serial input for special effect control. As mentioned, the system also includes a SAA1099, and Was also planning to use a eeprom and the ATmegas pwm to generate some extra sounds. So the entire contraption is actually a MIDI device. I was also planning to add a hex keypad and a lcd display for manually adjusting the sounds. It also includes a DAC, and it will have pots in the front for fine tuning and such.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: September 18, 2013, 04:21:46 pm
content: Yesterday I got a new YM3812, and I replaced it, and I got the same thing.Sometimes it works, sometime it doesn't.So I finally ran out of things to do, so as a last resort, I just duplicated all of the write commands.And something changed, the chip behave a bit differently.So I edited the write routine to write the data byte six times, instead of just once, and it worked!So I thought, that there must be an issue with the bytes being written one too fast, so I added lots of nops between the two writes, and it didn't work again.So what could be going?

author: Cumbayah
author_rank: Newbie
timestamp: November 20, 2018, 09:04:32 pm
content: So, this thread is old, but for the benefits of future generations ending up here through google queries, as I just did:I did play routines for the OPL-2 based Adlib card back in the day and remember this issue. I ultimately found, from the programming information available, that a 3.3 µs delay after index register writes were required and a 23 µs delay after data register writes. Surprisingly annoying to achieve that timing in a portable way - at the time, repeatedly polling an I/O port, thus locking to the ISA bus speed instead of the highly varying CPU clock frequency, was generally how it was done.You'll still find these delays described in various Adlib programming resources on the net, fxthis- now that you know to look for it there.The YM3812 datasheet doesn't call attention to this explicitly; it might be evident from fig A-2, but frankly I'm too much of a new player on the hardware side of things to be able to correlate that with said delays.Hope the project worked out.

author: Yansi
author_rank: Super Contributor
timestamp: November 25, 2018, 10:04:56 pm
content: Some very neat tips here guys, thanks, very appreciated! I will be working on this beast, whenever free time or bad mood allows.I have designed this "OPL2 MIDI" thing, just because and for the sake of it. My friend is a fan of vintage computer games, loves the sounds and also unlike me can play keys. I mean those to play music, not to write textSo I have come up with this: Drawers full of old EPROMs and SRAMs, found a few 80C320 (2 UARTs and 4ck per machine cycle yaaayyyy!) in the garbage pile too so why not build a "classic" 8-bit microcomputer around the YM3812? Here's the (not yet tried and executed) prototype in its CAD form, with a little brother made as a proof of concept whether I can program the damn thing. Took two afternoons and two evenings. Heck of a beast, never had so much (so large) DIL packages on a single board, so kind of a first.