SN76489 Help (can't seem to write to internal registers)

Hi, i'm currently trying to get an SN76489 sound chip working with an Arduino Mega 2560.

my problem is that i cannot seem to get any sound out of it, other than the random startup tone.

here is how i wired up the whole thing:


the 4MHz clock is a simple 4 pin oscillator. and the "AMP" is one of those cheap Arduino Amplifier Modules.
I don't even know if i need one or if i can just hook up a speaker directly to the audio output (after a 22pF capacitor).

checking with my Logic Probe i can see the WE and Data lines are doing stuff, so i know it's writing... something.

here's my code:

byte WE = 40;

void setup() {
	
	DDRL = 0xFF;				// Set up the Port L to be an output
	pinMode(WE, OUTPUT);		// Write Enable for the Chip
	digitalWrite(WE, HIGH);
}

void loop() {
	delay(1000);
	WriteByte(0b10001111);		// Channel 0, Freq. 1023
	WriteByte(0b00111111);
	WriteByte(0b10011111);		// Channel 0, Vol. 15 (silent)
	
	WriteByte(0b10101111);		// Channel 1, Freq. 1023
	WriteByte(0b00111111);
	WriteByte(0b10111111);		// Channel 1, Vol. 15 (silent)
	
	WriteByte(0b11001111);		// Channel 2, Freq. 1023
	WriteByte(0b00111111);
	WriteByte(0b11011111);		// Channel 2, Vol. 15 (silent)
	
	WriteByte(0b11100000);		// Channel 3 (Noise), everything 0
	WriteByte(0b11111111);		// Channel 3, Vol. 15 (silent)
	
	while(true) {}
}

void WriteByte(byte VAL){
	PORTL = VAL;				// Set the Data bus
	digitalWrite(WE, LOW);
	delay(1);					// Strobe the WE pin low for 1ms
	digitalWrite(WE, HIGH);
	PORTL = 0x00;				// Set the Data bus to 0
}

I'm just directly sending data to the Sound chip, i don't really get why it wouldn't work, is the AMP or the chip itself busted? or is it just not possible to make it completely silent? but then it wouldn't explain the fact that i cannot get any sound change from it.

overall this is just really confusing to me and i'm hoping someone here could help out a bit. It's very late (or early technically) and I'll post a bit more info tomorrow.

if i can just hook up a speaker directly to the audio output

No. The output is capable of only 10 mA maximum. An amplifier is required and the 22 pF coupling cap shown in your diagram is FAR too small, suggest 10 uF.

You are not doing the data transfer correctly. You need to control /CE as described in the data sheet. Study the timing diagram carefully, and note that it takes 32 clock cycles to load a register (8 usec at 4 MHz).

Consider having a timer pin on the Arduino output the clock signal. No need for the oscillator can.

jremington:
No. The output is capable of only 10 mA maximum. An amplifier is required and the 22 pF coupling cap shown in your diagram is FAR too small, suggest 10 uF.

hmm, i tried replacing it with a 10uF ceramic and then electrolytic cap and the output just became much louder.
i already have the volume control of the Amp module to almost 0. so something about this seems wrong...

jremington:
You are not doing the data transfer correctly. You need to control /CE as described in the data sheet. Study the timing diagram carefully, and note that it takes 32 clock cycles to load a register (8 usec at 4 MHz).

that doesn't make sense though, if it works like any other CE pin you should be able to just ground it without issue. none of the tutorials i saw online used the CE pin and the datasheet mentions that CE just has to be low for a write to occour, it doesn't need to be high at any point for a complete transfer.

also the i know it needs some time between WE going low and the data being latched, that's why it's waiting 1ms between setting WE low and high.

jremington:
Consider having a timer pin on the Arduino output the clock signal. No need for the oscillator can.

eh, using a can is much easier than to add more code that could be faulty.

.

well i think i found the issue before posting this, basically TI had a stroke of genius when they made the datasheet and labeled all bits in reverse order. meaning that D0 on the chip is actually D7, and vise versa.
so i had the data bus connected the wrong way around.

it seems to work now.

even my other code i wanted to test this with had some issues (i used || and && instead of | and &)
i also send the values i wrote into the chip via Serial so i checked them manually and it seems correct.

Wow. It does say D0 is the MSB. It’s been a long time since I’ve seen big endian bit numbering!

I vaguely remember old TI controllers of the same weird bit numbering in the 80s.