Go Down

Topic: Arduino + AY38910 (Read 7227 times) previous topic - next topic

vonkhades

Hi guys,

here is the page and info of a new project Im working in, its all in the arduino wiki. Ill try to update more info as I have it.

http://arduino.cc/playground/Main/AY38910

The whole idea of the project is to make a musical synth with a AY38910, a well known sound chip used on retro computers (zx spectrum, amstrad cpc, atari 2600) and also some retro videogame consoles and pinball machines.

Techone

Great info. I have at least 6 of those chips and others one. The use of 74HC595 interfacing 8 bits in parallel, is the way to go. 
I hope those chips are still operating.

Let the fun begin.

florinc

Great stuff, brings back memories :)
The next step should be a player for "ay" files.

Techone

Also interfacing others older chips like : SP0256A-AL2 and CTS256A-AL2 <-- I beleive these chips are for speech. The code can be modify and let the Arduino start talking. I have those chips. Genuine GI

vonkhades

#4
Feb 20, 2012, 09:07 pm Last Edit: Feb 20, 2012, 09:19 pm by vonkhades Reason: 1

Well the whole idea of this is making a small synth, ill probably pump to 2 AY38910 :).. althoug is completely possible to make a music player if you have the original atari song formats! :)


Here is the very last video I uploaded, now with pots, buttons and the "step sequecner" 16-leds Im working on sorry for the spanish audio it was to show it to my brother.

http://www.youtube.com/watch?v=FHx3vPoWzMQ

Video description:

Quote
My step sequencer is starting to growth.. sadly Im running out of pins in the arduino. The changes I made so far:

1. added 3 shiftregisters 595, to reduce the number of pins needed for controlling the 16 leds and the data-address bus on the AY38910.

2. added 3 pots, for tempo and volume of chanels A and B (where Im playing the noise drums).

3. 2 buttons to change the current playing loop.


thanks ya interest!

cmpenoob

awesome project! I just started my own with the goal of making a synth from scratch!
Thing is I don't have a 595 at the moment so I'm using 8 arduino pins for the bus. I'm just hoping I can get it to make some kind of sound at  least :)

Just wanted to mention that you only need 2 pins for the Bus Control. BC2 can be tied to 5V because 4 of the 8 bus commands are redundant. Here's a crummy chart :D

Code: [Select]
BDIR | BC2 | BC1
-----+-----+-----
 0  |  1  |  0  = inactive
 0  |  1  |  1  = read
 1  |  1  |  0  = write
 1  |  1  |  1  = latch


I hope your project is doing well, maybe you've played it live already!

vonkhades

#6
Mar 13, 2012, 11:20 am Last Edit: Mar 13, 2012, 12:11 pm by vonkhades Reason: 1
Yeah I noticed that, just need to be connected to a Pull-up resistor! :).

Well Im building the case right now ... I ordered an arduino mega because Im running out of pins in the uno.

10 pins to control 2 AY38910

3 pins to control the 16 leds of the step

5 pins to read (with multiplex) the 16 buttons of the step.


9 pins Im using 3 rotary encoders that have push button for many operations (change notes, arpegios, envelope, voice,...).

some other buttons (play/stop, mode).

and Im still missing a LCD which will need at least 3 pins.

Also im adding other buttons Im not sure their functionality yet.. this is all not yet built is in process, but Ill keep you informed if you like :).


cmpenoob

#7
Mar 14, 2012, 01:56 am Last Edit: Mar 14, 2012, 02:43 am by cmpenoob Reason: 1
well I'm having some trouble doing it on my own (i think the code is ok) because I haven't connected the outputs to a speaker, and I'm trying to test it by writing to a register and then reading back the contents... thing is, when I try to read from the PSG all the bus lines show 2.5V, so I'm not sure what's going on there...
I decided to turn to your project on the wiki to at least make sure my AY is working. I have a question about your schematic -- did you manage to get sounds out of it by hooking up a bare speaker (no amp)? what are the characteristics of that speaker hooked up to channel A?


edit: actually I have another question :) I've read the datasheet 100s of times and it doesn't say much about actually playing notes.
I see in your code, when you want to play a note on channel A you only need to write to R0 and R1 to set the period. Is that all it takes to generate output after a fresh reset? I mean, do you need to do anything to the Envelope (R13), Enable(R7), or Amplitude(R8) registers first?

2nd edit: well i answered that question, I see in your initialization you write to R7 and R8 :) now I hooked it up to an oscilloscope but it shows nothing... however my multimeter reads 3V when I try to produce a 2khz tone!! yay! I'll keep watching for more videos, I'd like to see your finished case

vonkhades


did you manage to get sounds out of it by hooking up a bare speaker (no amp)? what are the characteristics of that speaker hooked up to channel A?


Yes! a simple 8ohm speak will produce sounds, remember to plug the ground and the audio output properlly. If you are using normal computer speakers works too! The inner (most close to plastic) circle in the jack is the ground, and the center and "outer" circle will be your stereo channels.



I see in your code, when you want to play a note on channel A you only need to write to R0 and R1 to set the period. Is that all it takes to generate output after a fresh reset? I mean, do you need to do anything to the Envelope (R13), Enable(R7), or Amplitude(R8) registers first?


as you already findout, on the setup() I do the following:

Code: [Select]

    write_data(0x06, 0x00);   // turn off the noise channel
    write_data(0x07, 0x3e);   // = 0b111110  which is only enable channel A
    write_data(0x08, 0x0f);   // set max volume for channel A.


You need to write to register 07 and 08 and set them properlly!


Quote

2nd edit: well i answered that question, I see in your initialization you write to R7 and R8 :) now I hooked it up to an oscilloscope but it shows nothing... however my multimeter reads 3V when I try to produce a 2khz tone!! yay! I'll keep watching for more videos, I'd like to see your finished case


One question, are you using a TTL Oscillator (4 pins, one of them unused) or a Crystal Oscillator (2 pins)?? TTL should work just fine, the CrystalOscillator needs a couple of extra capacitors.

If the channel A keeps giving you problems, enable all 3 channels, set the volumen to all of them and write notes to all three. Then test each output channel with a speaker. Could be that the current channel you are testing is "dead" or shorted :S (hope not!).

I suggest you just hook up a speak and test with that, voltage=volume as far I know no??

cmpenoob

#9
Mar 15, 2012, 01:29 am Last Edit: Mar 15, 2012, 01:34 am by cmpenoob Reason: 1
okay, I have an 8 ohm speaker that I ripped out of a gameboy (don't worry, it was dead anyway :D) but wiring it as in your schematic doesn't produce any sound. I'll try with some other speaker & head phones to make sure it's not just a broken speaker...

Quote
You need to write to register 07 and 08 and set them properlly!

great, that's settled!

Quote
One question, are you using a TTL Oscillator (4 pins, one of them unused) or a Crystal Oscillator (2 pins)??

I'm using pin 3 on the arduino to produce a 2MHz square wave, I tested it with a binary counter and confirmed it's at the right frequency

Quote
If the channel A keeps giving you problems, enable all 3 channels, set the volumen to all of them and write notes to all three.

good idea, I didn't even think of that heheh.

thanks for all your help, I'll keep plugging away until it works or I melt some chips haha!


oh, just thought I'd add this link -- http://dev-docs.atariforge.org/files/AY-3-8910-8912_Feb-1979.pdf I don't know if you'll find it useful cause you seem to have the PSG figured out, but it has a LOT more information than the datasheet!!

Megaionstorm

Is it possible to get the wire connection picture from the playground in a much greater size ?
Mein Arduino Projekte Blog:
http://ardu-megatank.blogspot.de/

cmpenoob

Hi. Are you looking for a larger pic to see the IC pins? It looks like it was done in fritzing; I could probably make one up for you.
This page seems to be the best on the topic of controlling the AY with an arduino, with vonkhades permission I might try and flesh out the project a little more. I've seen a couple posts here asking about using the AY38910 and it would be cool to have a detailed page to point people to.

Megaionstorm

Quote
Hi. Are you looking for a larger pic to see the IC pins?


Yes, i'am looking for a larger pic to see the pin connections.
The picture in the playground is very little.
Wan't avoid failure pin connections !
Mein Arduino Projekte Blog:
http://ardu-megatank.blogspot.de/

cmpenoob

here you go, I couldn't find the part for the crystal and I don't use one so I couldn't tell you how to wire it anyway haha. I've outlined in pink the dots which show pin 1 on the ICs.

http://i44.tinypic.com/34yxwtj.png

Megaionstorm

Thanks, this picture is a very good help !
Mein Arduino Projekte Blog:
http://ardu-megatank.blogspot.de/

Go Up