Hi,
this is my first post, so please, forgive me if there's something not as expected.
I'm trying to build a simple 80s synth using a Phillips SAA1099 and an Arduino Mega 2560.
As clock input for the IC, I use the clock output of the Mega 2560. To write to the IC I wrote a little function with address and data as arguments.
Problem: There's nothing coming out of the headphones, other than some crackling noise when uploading the sketch and the Arduino's LEDs blink. I am quite new to circuits and electronics, so I might have missed something fundamental.
const int PIN_WR = 12;
const int PIN_AO = 13;
const int PIN_CLOCK = 11; //Clock pin 11 on Arduino Mega 2560
void chipSend(byte address, byte data) {
digitalWrite(PIN_AO, HIGH);
PORTD = address;
digitalWrite(PIN_WR, LOW);
delayMicroseconds(5);
digitalWrite(PIN_WR, HIGH);
digitalWrite(PIN_AO, LOW);
PORTD = data;
digitalWrite(PIN_WR, LOW);
delayMicroseconds(5);
digitalWrite(PIN_WR, HIGH);
}
// the setup function runs once when you press reset or power the board
void setup() {
//setup 8Mhz time on OCA1 (Mega on pin 11)
pinMode(PIN_CLOCK, OUTPUT);
//setup Timer 1
TCCR1A = bit(COM1A0); //toggle OC1A on compare match
TCCR1B = bit(WGM12) | bit(CS10); //CTC no prescaling
OCR1A = 0; //output every cycle;
//SAA1099 setup
DDRD = DDRD | B11111111; //set pins 0 - 7 to outputs, WARNING: serial won't work
pinMode(PIN_AO, OUTPUT);
pinMode(PIN_WR, OUTPUT);
digitalWrite(PIN_WR, HIGH); //write enable
//Reset/Enable all the sound channels
chipSend(0x1C, B00000010);
chipSend(0x1C, B00000000);
chipSend(0x1C, B00000001);
//Disable the noise channels
chipSend(0x15, B00000000);
//Disable envelopes on Channels 2 and 5
chipSend(0x18, B00000000);
chipSend(0x19, B00000000);
delay(1000);
}
void loop() {
for (byte ch = 0; ch < 6; ch++){
chipSend(ch+0x00, B11111111); //CH0-5 --> amplitude max D7-D4 right, D3- D0 left
chipSend(ch+0x08, 100); //CH0-5 frequency 8 bits B00000000(lowest) to B11111111 (highest)
}
//Setting octaves for CH0 to CH5
chipSend(0x10, B00110001); //X O1 O1 O1 X O0 O0 O0
chipSend(0x11, B00010101); //X O3 O3 O3 X O2 O2 O2
chipSend(0x12, B01100100); //X O5 O5 O5 X O4 O4 O4
chipSend(0x14, B00111111); //frequency enable B(0 0 CH5 CH4 CH3 CH2 CH1 CH0)
chipSend(0x15, B00000000); //noise enable B(0 0 CH5 CH4 CH3 CH2 CH1 CH0)
//chipSend(0x16, B00NN00NN); //2 bits for noise generator control
chipSend(0x18, B00000000); //envelope generator 0 disabled
chipSend(0x19, B00000000); //envelope generator 1 disabled
chipSend(0x1C, B00000001); //sound enable all channels
delay(1000);
chipSend(0x1C, B00000000); //sound disable all channels
}
There's a quite old post on this, but it doesn't say if the problem was solved, so this is more or less a repost.
Thanks
Dominik
SAA1099 datasheet.pdf (1010 KB)