Author Topic: YM3812 + YM3014 issue  (Read 11713 times)

0 Members and 1 Guest are viewing this topic.

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
YM3812 + YM3014 issue
« on: August 22, 2013, 03:13:52 am »
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.gif
Except 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?
« Last Edit: August 23, 2013, 05:29:02 am by Dajgoro »
 

Offline marshallh

  • Supporter
  • ****
  • Posts: 1462
  • Country: us
    • retroactive
Re: YM3812 + YM3012 issue
« Reply #1 on: August 22, 2013, 03:19:30 am »
Maybe you have
1. Bad/fake LM324
2. Bad/fake YM3012 (clones do exist of the OPL family)
All I can think of barring wiring mistakes/forgetting to bypass supplies
Verilog tips
BGA soldering intro

11:37 <@ktemkin> c4757p: marshall has transcended communications media
11:37 <@ktemkin> He speaks protocols directly.
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3012 issue
« Reply #2 on: August 22, 2013, 03:38:05 am »
1. Bad/fake LM324
I tryed replacing it with anoter one, no effect.
2. Bad/fake YM3014 (clones do exist of the OPL family)
Maybe, but I doubt that, since I got it from ebay recently.
All I can think of barring wiring mistakes/forgetting to bypass supplies
I 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.
« Last Edit: August 23, 2013, 05:29:15 am by Dajgoro »
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3012 issue
« Reply #3 on: August 22, 2013, 05:45:23 am »
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. :D

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?
« Last Edit: August 22, 2013, 06:05:28 am by Dajgoro »
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3012 issue
« Reply #4 on: August 22, 2013, 08:22:48 pm »
That schematic is wrong indeed.
I returned the wiring as I initially connected it.
I managed to get a signal out of the chip!  :D
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?
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3012 issue
« Reply #5 on: August 23, 2013, 01:16:41 am »
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.
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: YM3812 + YM3012 issue
« Reply #6 on: August 23, 2013, 03:40:05 am »
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.
The larger the government, the smaller the citizen.
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3012 issue
« Reply #7 on: August 23, 2013, 04:23:25 am »
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.
Ha, 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: [Select]
olp_wr(0x20,0x01); //Set the modulator's multiple to 1
olp_wr(0x40,0x10); //Set the modulator's level to about 40 dB
olp_wr(0x60,0xF0); //Modulator attack: quick; decay: long
olp_wr(0x80,0x77); //Modulator sustain: medium; release: medium
olp_wr(0xA0,0x98); //Set voice frequency's LSB (it'll be a D#)
olp_wr(0x23,0x01); //Set the carrier's multiple to 1
olp_wr(0x43,0x00); //Set the carrier to maximum volume (about 47 dB)
olp_wr(0x63,0xF0); //Carrier attack: quick; decay: long
olp_wr(0x83,0x77); //Carrier sustain: medium; release: medium
olp_wr(0xB0,0x31); //Turn the voice on; set the octave and freq MSB

SAA1099 code:
Code: [Select]
saa_wr(0x1C,0);
saa_wr(0,255);
saa_wr(0x18,0);
saa_wr(0x19,0);
saa_wr(0x14,0x11);
« Last Edit: August 23, 2013, 05:30:14 am by Dajgoro »
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3012 issue
« Reply #8 on: August 23, 2013, 04:48:06 am »
I tried writing a simple loop that iterates two registers, and the result is amazing.
Never heard such sounds! This chip is great! ;D

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.
« Last Edit: August 23, 2013, 04:58:35 am by Dajgoro »
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3014 issue
« Reply #9 on: August 24, 2013, 03:01:58 am »
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: [Select]
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?
 

Offline loscha

  • Newbie
  • Posts: 3
Re: YM3812 + YM3014 issue
« Reply #10 on: August 24, 2013, 03:04:50 pm »
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?
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3014 issue
« Reply #11 on: August 25, 2013, 12:15:50 am »
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?
I 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.
 

Offline Dajgoro

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: hr
    • hackaday.io
Re: YM3812 + YM3014 issue
« Reply #12 on: September 18, 2013, 04:21:46 pm »
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?
 

Offline Cumbayah

  • Newbie
  • Posts: 1
  • Country: dk
Re: YM3812 + YM3014 issue
« Reply #13 on: November 20, 2018, 09:04:32 pm »
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. |O

You'll still find these delays described in various Adlib programming resources on the net, fx this - 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. :)
« Last Edit: November 20, 2018, 09:09:27 pm by Cumbayah »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3800
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: YM3812 + YM3014 issue
« Reply #14 on: November 25, 2018, 10:04:56 pm »
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 text  :)

So 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.

« Last Edit: November 25, 2018, 10:07:51 pm by Yansi »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf