Sound chip help - Phillips SAA1099

So, I'm working on a project with an SAA1099 sound chip (datasheet attached). At the moment, I'm just trying to get it to make a sound, and then I'll be moving on to more complicated things. I've hit a wall, though, in that I'm having trouble figuring out the sequence of commands to make it turn on.

I can send it commands just fine: I set A0 to the appropriate bit, set the chip select active, set the data bits to the appropriate byte, set the Write Enable active, wait for the data transfer acknowledge to acknowledge the data transfer, and then set the Write Enable inactive again. And the data transfer acknowledge is doing everything it should be, according to the serial monitor. But that's as far as I've gotten. I can't get it to make any noise.

Is anyone familiar with this chip? What are the steps I need to run through to turn one one of the tone generators?

Any help is greatly appreciated.

Thanks you!

SAA1099 datasheet.pdf (1010 KB)

What are you sending to the chip at the moment?
A very quick scan of the data sheet suggests you need SE on register 0x1C set to 1 to enable any sound output.
You will probably need to set some Amplitude on addresses 0x0-0x5
Then as a start of generating sound try the noise registers. Enable noise (NEx) on all channels of address 0x15 and also alter the Nx0 & Nx1 bits on address 0x16 to alter the noise frequency.

So far I've been trying to send, in order:

  • Sound Enable (0x1C)
  • Amplitude for tone 1 (also tried tone 0)
  • Octave for tones 1 and 0 (0x10)
  • Frequency for tone 1 (0x09)
  • Noise disabled on all channels
  • Frequency enabled on tone 1

I just now tried

  • Sound Enable
  • Amplitude 1
  • Noise enabled on all channels
  • 0x16 set

Both yielded no results.

Browsing the net I found this post on connecting the chip to a Dragon computer. It also includes a sample BASIC program to test the chip is working and I think it should easily convert to C++ on the Arduino to see if you get the same results. If not then maybe you need to look at your code sequence/timings for writing to the chip and maybe the pinout.

Sample Programs

The first program producing some warbling noises across both channels 
(if you connect the device up to a stereo system, you should hear it switch channels)
and the second one creates a tone, which sounds like the hard drive on a PC taking off. 
I have included these more as a systems check to ensure your device is working rather as good examples of how to use it. 

1 HD=1
10 _DATA=&HFF3C 'DATA REGISTER - MACHINE SPECIFIC
20 _ADDR=&HFF3D 'ADDR REGISTER - MACHINE SPECIFIC
21 POKE _ADDR,20:POKE _DATA,3  'FREQUENCY 0,1 ENABLE (REG &H14)
22 POKE _ADDR,9:POKE _DATA,200 'FREQUENCY OF TONE 1 = 200 (REG &H09)
23 POKE _ADDR,&H15:POKE _DATA,0 'NOISE DISABLE (ALL CHANNELS) 
24 POKE _ADDR,&H10 'ETC,
25 POKE _DATA,&H23 'ETC
26 POKE _ADDR,&H11
27 POKE _DATA,&H04
30 POKE _ADDR,0
40 POKE _DATA,&H77
50 POKE _ADDR,28
60 POKE _DATA,1
65 POKE _ADDR,8
70 POKE _ADDR,20:POKE _DATA,&H43
85 F=100
88 FD=3
100 G=15
105 GD=45
110 FOR H=&H11 TO &H44 STEP &H11
111 F=F+FD:IF F>240 OR F<10  THEN F=240:FD=-FD
115 G=G+GD:IF G>230 OR G=15 THEN GD=-GD
116 POKE _ADDR,0:POKE _DATA,G
117 POKE _ADDR,1:POKE _DATA,G
118 POKE _ADDR,17:POKE _DATA,(&H55-H)
120 POKE _ADDR,16
130 POKE _DATA,H
131 POKE _ADDR,8:POKE _DATA,F:POKE _ADDR,9:POKE _DATA,F+10
135 WAIT 50
140 NEXT
150 FOR H=&H44 TO &H11 STEP -&H11
151 F=F+FD:IF F>200 OR F<10 THEN F=200:FD=-FD
155 G=G+GD:IF G>230 OR G=15 THEN GD=-GD
156 POKE _ADDR,0:POKE _DATA,G
157 POKE _ADDR,1:POKE _DATA,G
158 POKE _ADDR,17:POKE _DATA,(&H55-H)
160 POKE _ADDR,16
170 POKE _DATA,H
171 POKE _ADDR,8:POKE _DATA,F:POKE _ADDR,9:POKE _DATA,F+55
175 WAIT 50
180 NEXT
190 GOTO 110

  NIMBUS.BAS
  ----------

10 _DATA=&HFF3C
20 _ADDR=&HFF3D
30 POKE _ADDR,2:POKE _DATA,255
40 POKE _ADDR,10:POKE _DATA,100
50 POKE _ADDR,&H11:POKE _DATA,4
60 POKE _ADDR,&H14:POKE _DATA,4
70 POKE _ADDR,&H15:POKE _DATA,0
75 POKE _ADDR,&H18:POKE _DATA,11
80 POKE _ADDR,&H18:POKE _DATA,139
90 POKE _ADDR,28:POKE _DATA,1
100 POKE _ADDR,9:POKE _DATA,0
110 POKE _ADDR,&H10:POKE _DATA,64+16
115 POKE _ADDR,&H14:POKE _DATA,0
120 FOR G=255 TO 1 STEP -4
130 POKE _ADDR,9:POKE _DATA,G
135 WAIT 50
140 NEXT

Untested/unproven code conversion from basic to c++

SAA1099.ino (5.79 KB)

I've tried running the sample programs from the post and still got nothing. I've double-checked the breadboard connections every step of the way here and it's all hooked up the way it should be. What did you mean when you mentioned the code sequence/timings?

I think it's time to post a schematic of how you have the chip wired up and the code your using.
The last post I made was for the conversion of the BASIC code and a pseudo write routine so you would have needed to adapt the design or the code to suit your setup.

Attached are my schematic (the numbers outside of the IC in the diagram are the pins on the Duemilanove board I'm using) and the sketch I'm running.

A_440.ino (2.98 KB)

After reviewing the code you posted (and the code I posted in #4) there is a problem with the chip writing routine and a problem with using Serial that also uses pins 0 & 1.
The datasheet says the max time between WR going high and DTACK going high is 100ns so polling it will probably not catch the transition high/low/high. The alternatives are to try using interrupts to catch the transition or just ignore the transition and assume it happened.

Try the code without Serial or move the DATPIN0/1 to A0/A1

A_440a.ino (3.19 KB)

Ah, I didn't realize pins 0/1 were tied to the serial port. I'll try moving those. On a side note, would it be feasible to leave the Chip Select pin tied to ground, since I'm not planning on selecting other chips? That would open up enough digital I/O pins for the data bus.

What do you mean by using interrupts to catch the transition? That sounds like it would be a good idea.

I don't think it's worth the trouble with interrupts unless it's really necessary.
The analogue pins can be used for digital signals as well so unless they are being used for something else.