SN76489 Hardware Question - Can't get this to work

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
superjoebob
Very interested
Posts: 66
Joined: Fri Oct 15, 2010 7:06 am
Location: Vancouver, Canada
Contact:

SN76489 Hardware Question - Can't get this to work

Post by superjoebob » Tue Dec 04, 2012 6:44 am

Hey guys!
So far I've proven entirely inept when it comes to electronics. What I'm trying to do, is set up a simple test with my SN76489AN to get it to generate a tone. I tried hooking it up through a microcontroller, but I decided to step back and take a simpler route:

Image

The buttons are hooked up to WE and CE on the chip, and the data pins are hooked up to the first 8 switches on the dip. READY is hooked up to an LED so I can visualize the state of the chip. I'm powering it with a 9-volt run through a regulator to bring it down to 5 volts. The problem I'm having is that I can't get the chip to do anything useful. I started by trying to get the ready light to come on in an un-clocked state by following the function table in the datasheet:

Image
The chip next to the SN76489AN is an ATTiny85 running at 8mhz that I was using to give off a 4mhz square wave as a clock for the chip. Its output pin is currently disconnected, leaving the SN in an unclocked state.

I've tried every combination of holding/not holding buttons when I plug the chip in, and I've tried spamming buttons while it's plugged in but I just can't get the ready pin to light up. I've tried a few different chips to be sure it's not the chip, and I've tried basic data writing to the chip through a microcontroller with no results.

Am I doing something wrong with this?
On a never ending quest to compose for the Genesis/Megadrive

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Tue Dec 04, 2012 9:34 am

You need pull-ups on the switch lines, floating pin toggles betwees high asd low, not really being one or the other. The lines may need debouncing too to remove rapid toggle at momonts of button press/release.

But why it is not doing anything at all I am not sure why... clock you need in all cases.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

foobat
Very interested
Posts: 92
Joined: Fri Sep 14, 2012 1:06 pm

Post by foobat » Tue Dec 04, 2012 10:04 am

Looks like you need to press the button on the right at 3.57mhz. You're probably not pressing it fast enough lol

edit: Aww it's upside down well that's a lot less funny now :(
I guess I can try to be helpful

absolute maximum rating for output current @5.5V is 2mA on pin 4 for the SN76489, is 2mA enough current to light that LED? (guessing no)

Maybe it lit it for a few nanoseconds and you didn't notice? And then your sn76489 promptly killed itself?

superjoebob
Very interested
Posts: 66
Joined: Fri Oct 15, 2010 7:06 am
Location: Vancouver, Canada
Contact:

Post by superjoebob » Tue Dec 04, 2012 9:58 pm

TmEE co.(TM) wrote:You need pull-ups on the switch lines, floating pin toggles betwees high asd low, not really being one or the other. The lines may need debouncing too to remove rapid toggle at momonts of button press/release.
Uhh, yeah, pull-ups, floating pins and debouncing! It's so obvious now how could I have missed it :shock:
foobat wrote:Looks like you need to press the button on the right at 3.57mhz. You're probably not pressing it fast enough lol

edit: Aww it's upside down well that's a lot less funny now :(

Ahaha took me a while to figure out what you meant, I guess that button would be controlling the clock pin if I had it flipped the other way XD

foobat wrote: absolute maximum rating for output current @5.5V is 2mA on pin 4 for the SN76489, is 2mA enough current to light that LED? (guessing no)
Hmm, never even thought of that. I figured in my ignorance that all the pins would output whatever voltage I put into the chip (if only). I'll bet that's it!

Since Tiido makes it sound like there's a lot more than meets the eye required to make my manual chip control method work, I guess I'll go back to trying to control it through my microcontroller. Would you guys mind giving me an idea of what I need to do with the chip to get a simple tone out of it? Reading the datasheet I have an idea, but I'm not completely sure. I think in code what I was doing is

CE = 1, WE = 1;
CE = 0, DATA = 10001110;
WE = 0; WE = 1;
DATA = 00001111;
WE = 0; WE = 1;
(thank you SMS Power for the data values)

After

CE = 1, WE = 1;
CE = 0, DATA = 10001110;
WE = 0;

I had code waiting for the ready pin to signal back on one of my inputs, but it seems it never did.
On a never ending quest to compose for the Genesis/Megadrive

Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Re: SN76489 Hardware Question - Can't get this to work

Post by Charles MacDonald » Thu Dec 06, 2012 6:11 am

READY is hooked up to an LED so I can visualize the state of the chip.
The READY pin is an open-collector output so it can only go low or tri-state. You'll need to add a 2K pull-up resistor to +5V if you want to see it toggle high and low. It can only sink 2mA and LEDs are in the 20mA range so you can't drive a LED with it.

The PSG needs a lot of time to accept data during a write, so it asserts READY for 32 clock cycles once it sees a write starting. This doesn't really indicate anything about the internal state of the chip, just that a write is in progress and the PSG needs more time to elapse. This happens for every write, so you'll see READY do the same thing each time.

Since you are using a MCU you can assert CE first, drive the data bus with the value you want to write, assert WE next, and then poll the READY pin state until it goes high. At this point 32 or more clock cycles have elapsed. Then negate WR and CE.

The PSG needs to be clocked at 4 MHz at all times for writes to work and for READY to show activity. Good luck!

superjoebob
Very interested
Posts: 66
Joined: Fri Oct 15, 2010 7:06 am
Location: Vancouver, Canada
Contact:

Post by superjoebob » Tue Dec 11, 2012 5:38 am

Thanks dude. I tried hooking it all up again quickly but didn't have any luck, I think I'll give it a better try this weekend. For the pullup resistor, should I put it on the line between the MCU and the READY pin, or run the power through it?
On a never ending quest to compose for the Genesis/Megadrive

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Dec 11, 2012 7:36 pm

superjoebob wrote:Thanks dude. I tried hooking it all up again quickly but didn't have any luck, I think I'll give it a better try this weekend. For the pullup resistor, should I put it on the line between the MCU and the READY pin, or run the power through it?
PULL UP has a specific meaning in electronics - it means the resistor goes between the line and power (5V). By the same token, PULL DOWN means the resistor goes between the line and ground.

Post Reply