Jump to content

OPL3 Driver Issues


Sauraen
 Share

Recommended Posts

I've been working on a LPC17 driver for the OPL3 module to be used in There is a 595 shift register connected to J19 via SPI, and the other control pins on the OPL3 module are connected to J28 (reconfigured as GPIO). After squashing a number of other bugs, it appears that the OPL3 board is receiving the right data; whenever I pause execution and measure the voltages on its input pins (both the outputs of the shift register and the pins wired directly to the core), they are all correct. But the OPL3 seems to only be sporadically receiving the data. My program simply sends messages to set up one channel and its operators, and toggle the note on and off. What this results in is no sound for a while; then eventually the correct note turning on but not off; then multiple new copies of it (i.e. in different channels) turning on, out of phase with each other and sometimes not exactly the right frequency; and this continues indefinitely, with the chip making dubstep-like noises. Resetting the chip (via the reset line) does not stop the sound, but of course toggling the power does. I'm guessing that it is getting the data wrong for some reason, but intermittently, and it seems it has more problem with the address byte than the data byte! I tried adding several microseconds of delay between each segment of the write cycle in case it was a timing issue, but that has had no effect. Anyone have any idea what might be going on? Bad solder joints? I'm sort of at a loss.

Link to comment
Share on other sites

Could this be a voltage issue?

According to the datasheet, IC# has to be set with 3.5V minimum - I guess that you connected it directly to a 3.3V based J28 output?

 

No level shifter is required for the remaining pins (VIH=2.2V)

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Nope--I saw that one in advance. :smile: I have #IC connected to J19:RC2, which goes through the buffer on the LPC17 board, and that pin measures at 4.95 volts during operation. Besides, if it was stuck in reset, it wouldn't be making any noise at all, I would think.

 

But thanks for taking the time to think of that!

Edited by Sauraen
Link to comment
Share on other sites

I'm not exactly sure what I fixed, but I am now getting sound out of the OPL3. There's still a weird bug that the values for some--but not all--registers of the OPL3 have to be sent bit-flipped, or rather, that it interprets the data to be the opposite values for each pin as what I send, but only for certain registers (e.g. ADSR and volume, but my tuning system works fine). But I can work around that in software.

 

However, I cannot get a sine wave out of the OPL3. I know I am only triggering one channel at a time (because I can trigger twelve or more of them independently); I know it's not that I have the waveshape set wrong, since setting it to other values gives me something that sounds even less like a sine wave; and it's not being FM modulated by the other operator because the other operator's volume and envelope are silent and it's set to the non-FM mode. So I don't think it's a software problem, which led me to the hardware.

 

Since for my synth I don't have a +/- 12V power supply and I didn't want to add one just for the OPL3, I changed the design for the board: the first two op-amp packages I replaced with rail-to-rail op-amps like in the sammichFM and gave them 0/5V, and then kept the last one as a TL074 and gave it +/-5V. (This by itself is not the problem; the chips are getting the right voltages and there are no shorts). In between the buffer immediately after the YAC512 and the second (final) one, I added an electrolytic capacitor in series and then a resistor to ground, to take the waveform from being centered at 2.5V to 0V. I'm pretty sure all this is working fine, since the sound does not get more distorted as the volume is turned up inside the OPL3.

 

I started thinking that maybe the op-amps I used, TLV2244, actually weren't quite rail-to-rail and therefore were clipping the signals in the DAC portion (sample-and-hold or whatever it is) of the YAC circuits (not the audio out portion). I didn't use the OPA4348 from the sammichFM because they are only available as SMD. But the datasheet for the TLV2244 shows that it is legitimately rail-to-rail; the only significant difference between the datasheets is the bandwidth. The OPA4348 is 1MHz and the TLV2244 is 5KHz. Could this be the problem?

Link to comment
Share on other sites

Wow - I had to double check that GBW figure. Let's just say that the TLV2244 needs to be replaced. It's been optimised for low power (TI talks about micropower application). The low Gain Bandwidth Product and the low slew rate means that this op amp will only work on signals up to 5.5kHz at 1.0 gain. Double the gain and you halve the maximum frequency.

 

OK, so what will happen with signals with sharper edges (i.e higher frequencies)? If you're lucky they will become distorted (low pass filtered). The amount of ringing in the signals will vary, but you should consider testing an op-amp with better (ok different) specs - higher bandwidth. It will draw more power, but that shouldn't be a problem here.

Link to comment
Share on other sites

Okay, so they really mean that it won't work on signals above 5KHz! What's the use of an op-amp that can't even work on audio-frequency signals (let alone data)?! But sure, I'll buy new ones. It does sound kinda cool, though--sort of like twelve 6581 SIDs with their filters and feedback going. Maybe I'll put up a video with these while I wait for new ones to arrive.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...