MicroMinded's posterous

    • Edit
    • Delete
    • Tags
    • Autopost

    YMstream Music Player

    Well that sure didn't take long!

    I just put the finishing touches on on my Windows -> Serial -> AVR -> YM2149 music player, I call it YMstream as I like to point out the obvious. The is a very easy project to wire up and I do not have a schematic and don't think anybody will need one either. Here is how to do it:

    I use a Mega164P with 8MHz crystal in a DIP package to make breadboarding easier, in software the mega is ran at 4MHz.

    • Connect PA[0..7] to DA[0..7]
    • BC1 to PC1
    • BDIR to PC0 (Not actually needed as we only write data, tie to +5V if not used)
    • BC2 tie to +5 via a ~47k pull up
    • /SEL, A8, /A9, /RESET all left unconnected (they have internal pull up/downs)
    • CLOCK is tied to PB1 on the AVR and the CLKOUT fuse is set. (4MHz)
    • All the I/O pins are left unconnected
    • Channel A, B and C are all brought to the same tie point through ~2.2k resistors and then pulled to ground through a 100ohm resistor. If you want to run speakers you will need an opamp or some amplifier but I ran some 2ohm cheap Icemat earbuds and it worked great. Tie the tip to the 2.2k & 100ohm tie point and the ring to ground.

    Sounds much harder than it is, its only 5 resistor and 9 wires to get it working. Please note that the YM2149 cannot run faster than 4MHz so if you want to use a faster AVR then you need to supply the YM with its own oscillator. I chose not to because I have no crystals slower than 8MHz and I wanted to keep the project easy.

     

    Here is an audio clip from the project to bring back some memories!

    Captured via digicam between headphones (Very good quality sound!)

    YMstreamer_Tune.mp3

     

    Earlier on in the project (yesterday) I had planned on just sending the data address then data and bouncing between the two but when I first tried to stream it was a world of noise. The first transmission error and the registers and data would be going to the wrong locations and the SSG would freak out. The solution to this is not very elegant, I just tossed in a character check for each transmission and then allowed the next byte to goto the proper register. So when you want to send an address preceded it with 0x00, and precede data with 0x31. (eg. Tone on chA: 0x30 0x00 0x31 0xFC)

    Their is a lot of room for improvement such as decoding the *.psg file in the player, adding play/pause, allowing the +/- to adjust the delay, maybe an interface even? I move in 3 days so will not be able to play with any hardware but I might whip up an interface and try my hand at decoding the psg's as I know what format everything needs to be dumped out in. A handy tool for this is a virtual comm that allows you to re-direct say COM4 back to your on board COM1. That way you can check the output thats actually leaving the serial port without needing to dump a lot of printf's to the console.

    Another thought is that I opened a file to allow access to the comm port and apparently you can do the same for LPT's. I am unsure how you would set status and control bits but I might take a peak at that before writing anything else as it would be nice to do away with the AVR and just have a simple LPT interface. Would make the project cost nearly nothing (IF you find a SSG that is...)

     

    Source is available for download from my Sourceforge

    Tags » AVR SSG YM2149 win32 z80
    • 13 August 2010
    • Views
    • 0 Comments
    • Permalink
    • 0 responses
    • Like
    • Comment
  • uMinded's Space

    25 Years Old
    Norwegian Male
    Saskatoon, CA

    Contributed by MicroMinded

    • Contributors
    • MicroMinded

    Archive

    2011 (5)
    July (1)
    March (1)
    January (3)
    2010 (15)
    December (1)
    November (1)
    September (2)
    August (3)
    July (5)
    June (1)
    May (2)
  • About uMinded

    25 Years Old
    Norwegian Male
    Saskatoon, CA

  • Subscribe via RSS
  • Follow Me

Theme created for Posterous by Obox