0
\$\begingroup\$

I'm working on a project which uses the Texas Instruments SN76489 integrated circuit, which was used to make sound in arcade games and Sega games from the 80's and 90's, I believe. I made a similar project with the Yamaha YM2612m which is the main sound chip from the Sega Genesis, and I have that project fully up and running and can play through vintage Sega sounds on a midi keyboard, up to 6 notes at a time. Probably not a huge deal to you guys but its the biggest project I have done so far.

So I am now working with the SN76489 and am having some issues. The way it works is that it has 8 internal 8-bit registers, and these are controlled via an 8-bit bus of data pins on the IC. In order to write data to these registers, the data is written to the pins of the IC (d0 to d7) and a separate write enable pin which is active low (/wr) gets flashed from a logic high to a logic low, and this latches the data from the data bus into the chip. Just going over things for the record.

So here is the issue I am having: I cannot seem to reliably load data into the chip on purpose. To test it out, I wrote a program which writes random values to the data pins, and then flashes that /WR pin low in order to write the data to the chip. It does this about 10 times per second, with the expected result being that the chip would generate random tones and noise sounds. And this part works absolutely as expected, so I know that my write function works, at least in this application.

However say, for example, I want to turn off channel 0. This is done by sending the byte 0b10011111) which sends the value "1111" to the attenuation register of channel 0. If I execute code which does this, and then execute the write command, it will not do what I expect it to do. 80% of the time it doens't do anything, and maybe the other 20% of the time it changes something unexpected like the frequency (pitch) of one of the other channels. I was able to get these commands working correctly briefly, but in order to do this, I had to loop that write command algorithm about 20 times in order to get it to work every time. Does anyone know why this might be?

I am very confused about several parts of this project because it seems like it should be quite simple so maybe I am quite an idiot lol. I am using a clock signal of 500 kHz (measured at 488 kHz) because I am using the SN76489N as opposed to the SN76489AN. I looked at my clock signal and it is very clean looking, and I feel that my error is somewhere in the execution of my code since it seems to work on the hardware level.

One last thing I am confused about is the READY pin (pin 5.) This pin is supposed to go high when the chip is ready to receive its next command (meaning, it has finished executing its last instruction.) However this never seems to be the case, as I put an LED on this pin and it seems to stay low the entire time, unless the current from this pin is not enough to power an LED. I should look at this under the scope. For now I have a 1.5 kΩ resistor pulling the pin down to ground, and I saw somebody explain on a forum somewhere (maybe this one actually) that this is an open-collector pin which is internally connected a 2.2kΩ resistance. I just know that the write commands will work 0% of the time if this pin is not pulled down with the resistor, but I have no idea why. I apologize if I seem very incapable to you guys, I know there are some very smart engineers on this forum.

So anybody who has worked with this chip or similar ones, I would very much appreciate some guidance from you although I do enjoy these projects and the inevitable banging my head on the desk until I can't feel my face anymore. This is the joy of engineering.

Also I will be glad to post code or schematics if they will help. I will draw up a diagram later today and post it, as well as my code after I get something to eat. I am food deprived, another sacrifice I have made for this project, haha.

Thank you Will


Thanks to everyone, especially Tony Stewart. The issue was on the ready pin, sure enough. The solution was to connect the ready pin to one of the inputs of my microcontroller (Arduino) and wait for this pin to be high before writing the next instruction to the chip. This solved the problem and I am now getting beautiful tones out of this thing, haha. Thanks again

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Minor matter - the ready line is a weak TTL, and will only source something like 30 uA with a 5 volt Vcc. So you need to buffer it with a transistor. Use a base current-limit resistor of 5 k or so, since the low output max current is rated for 2 mA. \$\endgroup\$ – WhatRoughBeast Jun 16 '17 at 23:01
  • 1
    \$\begingroup\$ General things to look for: Ensure requirements for data setup time and hold time are met. As others have said - ensure loading capabilities are known and nor exceeded. Rise and fall times are unlikely to be the problem but ensure they are "sensible". \$\endgroup\$ – Russell McMahon Jun 16 '17 at 23:41
1
\$\begingroup\$

Use the READY rising edge with 20uA max output high to enable Writes

Active low is a 100~200 ohm driver but high is more like 150k internal pullup. Fig 3 shows a PLL test loop.

Pull down load seems to be the fault on READY and not using the rising edge to confirm each write. Since delays will be small, an LED makes no sense. Maybe pullup 470 ohm min to Anode and Cathode to ready is ok but dont expect to see anything unless there is a problem.

\$\endgroup\$
1
  • \$\begingroup\$ All these answers are tremendously helpful. I understand most of what you are saying although I do not understand all of it which is fine. I can figure out most of what I don't understand by trying it out. So my next step then will be examining what is happening on the ready pin, and then instead of pulling that pin low with a 2kΩ resistor, I will use that to signal the microprocessor of when to initiate the next write instruction. So the program will force the microprocessor to wait until the ready pin is at a logic high, and then it will send the write command. I'll try it, thank you! \$\endgroup\$ – user108391 Jun 17 '17 at 0:26
0
\$\begingroup\$

Old thread, but... I'm about to start a similar project with an SN76489AN, and I've read in the specs, that the data to be latched into its registers must be present for at least 32 clocks (8 clocks for N - suppose).

The READY line is open-collector and must be pulled-up by an external resistor (anything is fine in the range of 1k-10k).

Thirdly: in the specs I found the bit order odd when you sending commands (https://retrocdn.net/images/e/e0/SN76489_Application_Manual.pdf, chapter 6). It seems you have to connect the data lines reversed. I'm a bit mixed, I've never read any reference to it on other sites. I have to check it manually...

EDIT: other sites claims the data pins reversed already compared to what I linked. That makes sense.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.