Saturday, July 27, 2013

Pre-Blog Projects Revisted pt. 1

I was digging through old photos on my ImageShack profile and decided to talk about them. There is no particular order, but each has a story to go along with it.

Shown below is from when I was working with the z80 (as if I ever stopped). I pulled this z80 from a dead Sega Genesis and built it onto a breadboard to test the functionality. It turns out whatever was wrong with the Genesis was not the z80. The testing circuit was simpl; executing NOPs (no Operations) by connecting all Data pins to ground via a pull resistor. This caused the Address pins to run from $0000 to $FFFF bit by bit and since each Address pin was connected to an LED, the LEDs would light up (very quickly mind you) as a binary counter. The only LEDs I couls see flashing were the high erbits becuase the lower bits were mush too fast.

Also shown is a memory chip which remained unattached, an AY-3-8910A Programmable Sound Generator IC, a CTS256A-AL2 Text-To-Speech Controller IC which has gone unused because I do not have the SPO256-AL2 companion voice synth IC. And lastly, in the bottom corner is just a simple xtal running through NAND gates to clean up the signal.

Here is one of my favorite projects! This was a simple Atmega microcontroller based logic Analyzer which I redesigned around very strict limitations. Original credit to:
The limitations were that I wanted it to fit inside of a nintendo gameboy, run on 4x AA batteries like the gameboy and use the battery contacts, battery compartment, power switch and screen location from the gameboy itself.

First came the board. The gameboy has a rather small square mainboard which has several specific mounting holes. All measurements were done very crudely with a clear mm ruler...I sure wish I had a digital caliper. Luckily, everything fit (the second time). The board shown is the board that I printed myself with the transfer method as it is called. you may print your circuit onto a clear coated paper (I use magazine pages) and then iron the image onto a copper clad board, clean and immerse into an etchant solution. Maybe I will write up a tutorial at some point, but it is pretty straight forward. Since this was not my first board to have etched myself, it turned out wonderfully. Some boards...did not. But alas; I am persevering!Notice my old logo etched on the right. ;)

Image Hosted by

Here is the same board after being populated by hand and placed into the gameboy. "BA-DING" ... just kidding. At least the LED shows power is applied. The microcontroller is on the underside since I designed it to fit into a socket. Another restriction that I just remembered was that I wanted to use the gameboy's buttons to navigate through the program. The bottom of the board is suppose to hold ordinary push buttons, but I did not fit them so that I could wire up the GB's.

Image Hosted by

LOOK IT WOR......thanks China for the crappy LCD screen. >_>
Yes, the text is indeed upside-down, but at least I managed to get it working. This happens to be the second problem with this particular LCD. The first was that it runs on 5v, not 3.3 like the datasheet stated. Also, the control pins were all sorts of switched around. With a little retrcing of my board design, I had that sorted out as well. My favorite problem (sarcasm) was that the LED backlight happened to be high-enabled rather than if I had not caught that as soon as I did, they probably would have been damaged.

Image Hosted by

Add the case and logic probes (minus one)...and...Ta-da! A working logic Analyzer!

Image Hosted by

The above mishap from China isn't true for all electronics though. The USB ISCP below works very well. The only problem is that the ZIF socket is hardly ever used. It is used for a few Serial programmable microcontrollers and eproms. The only eproms I use are parallel programmable for which I use a different programmer.

On either side of the programmer are my sockets to program the microcontrollers (written on the sides of the boards). YES, I realize that having these boards entirely kills the 'S' in ISCP, but few of my designs fit an ISCP connector...

Image Hosted by

Here is a smaller project: two guitar pedal boards. These board were suppose to use the PT2399 IC to create a variable echo effect, but I never found all of the needed components so the board were stores away in one of my many crap-boxes.

Each board controls an analog mono audio signal and connectos two potentiometers for control. on the right of the board is where a 7805 voltage regulator would fit and at the center is where the chip would have been socketed. Again, I degin all of my boards using Eagle CAD and then print them onto a PDF so that the vectorized image remains thew highest quality and static size.

Image Hosted by

This is a print of a gameboy cartidge programmer designed my Reiner Zeigler to be used with modified cartridges or other commercial carts. It allows for you to read and write not only ROMs, but also RAM data if present. This board is the reason why I built the Atmega 8515 programmer above.

Reiner designed two version of the board; one for USB and one for Serial. I tried my hand at the USB because at the time, I didn't have a serial connector on the desktop I is one of the few disappointing facts about new computers.

Image Hosted by

lastly is the board after etching. It turned out terribly! This was the first board I had ever etched so I can't really complain. It was a learning experience and nothing more. Since nearly all of the data and addressing pins bled together, the board was tossed and I tried again later on after redesigning the board to accommodate my barbaric etching methods. I think the problem was that I didn't iron it long enough and with enough pressure. Some of the plastic ink peeled off or bled together.

Image Hosted by

Thursday, July 25, 2013

Update Jul-25-13

Here I am trying to learn gbz80 ASM (or Gameboy Assembly Language) and am just having a terrible horrible day! I have programmed in assemble for classes before and loved it, but nothing wants go correctly this time. First off, the cat is being a psycho-demon and tears through the room every few seconds, next the power went out for one minute last night losing data from the programs I was running, resetting the wireless printer and shutting off the coffee pot so the water had top warm up in the morning and to top it all off, I did my egg over-hard rather than over-easy! BAHHH!

In any case, my biggest problem is that the assembler included with RGBDS, the gameboy assembling environment, refuses to load one of the THOUSAND files that all run in sequence when you initiate the assembling of a ROM. To top it all off, you have to run it through a command prompt which just adds a whole new level of fun to the project.

 I have tried setting programs to admin mode, compat mode, and all other forms of configuration and yet nothing works. Get this, the program was written for Windows 95 so I probably can't use Windows 7 x64...

 Image Hosted by

That is the error. RGBFix refuses to load after the batch file calls for it. Putting RGBFix into Admin mode just skips the error message and does nothing. I am supposed to have a *.gb file that runs on gameboy or in an emulator.

 I am not even beyond Hello-World yet because of this nonsense! If anyone knows how to get this assembler working in Windows 7 x64, let me know...

Tuesday, July 16, 2013


Just a quick run-down of how to use POV-RAY after you have installed it. I assume you have installed it.

Hit RUN at the top of your board toolbar.

Image Hosted by

Then run 3d41.ulp in the directory shown.

Image Hosted by

The setting are extensive and somewhat confusing.
The defaults will work though. Click "Create POV-File and Exit".

Image Hosted by

You will probably be prompted to add text and sockets to certain ICs. Do as you wish.

Image Hosted by

There will also be parts that cannot be rendered because you do not have the 3D part files. Thats ok.

Image Hosted by

 If there is something you would like changed for example size, angle, silkscreens, etc., change the settings a little bit. My silkscreens are in different layers than the default so I had to add these to the misc tab.

Image Hosted by

Go ahead and load your output into POVray and click run to render the image. Play around with the options until you are satisfied.

Image Hosted by

Image Hosted by

Image Hosted by

Monday, July 15, 2013

SID-Boy v1 Hardware Completion

As per the title of this post, I have completed the board. All of my necessary components are placed, routed and errors have been checked over and or fixed. I have even chosen to decorate the board a little with my QR code just because I can.

Here is the board before I corrected my errors. 855 ERRORS! Many of them were silkscreen errors where the silkscreening was too close to pads and vias. These were easily fixed.
The clearence errors were also fixed very easily by movig the traces a little farther from eachother or from vias and pads.

Image Hosted by

Here is the board in its entirety, both with and without the ground planes.

Image Hosted by

Image Hosted by

Lets view some of the board up close. Here are the two resistors, R4 and R5, that I added as described by the SwinSID website. 47Kohms between PWM and +5v and 47Kohms between PWM and the output which happens to be the Audio-IN pin on the gameboy. The board now contains both methods of audio output so that I may find out which is better.

Image Hosted by

Here is my logo as I call it. It is just a QR code that I made which leads to this blog. Adding BMPs to a board is very simple. Beside that you can see a small block of text that describes the caps and resistors above. There was limited room next to them.

Image Hosted by

My clock. This clock a larger than the clock I had been using before, but is more easily available. Pins 1 and 3 are the two terminals for the oscillation. I may need to change the sizes of caps and resistors depending on the availability of them in the future, but each has plenty of room for change.  I believe these caps were size 0603. Something of note is that the traces of the clock are distant and not of the same length from the MCU. This is something people would call poor design, but the clock speed of 24MHz is not terribly fast and the clock is isolated as much as possible from traces and other devices so that I do not believe any problems will arise.

Image Hosted by

Here are my power rails. Yes, they are round. Why? Well, because I can. ;)

Image Hosted by

The last thing to do would be to write a program that stores SID data to the RAM locations where I have placed the SID in the memory map. I will have to research the SID banks, commands and gameboy programming. Once I have my board printed and populated, I will test a known-working ROM such as mGB, the midi software just so I know the board is routed to the gameboy correctly.

LC the kitten likes my board. How nice of him to approve. :D

Image Hosted by

I really really need an oscilloscope so that I can perform extensive testing with this and other projects. I think that it is currently my greatest downfall...

Friday, July 12, 2013

SID-Boy Update Jul-12-13

In continuation of this post:

Since posting the above, I have been routing the traces and making final chip placements. Most of my connections are complete and all that is left would be to write a program and test it, scrap it, rewrite it and test, test, TEST!

Lets talk about my board thus far:

Image Hosted by

I will start from the top left and work my way across the board.

The current audio output is connected to the stereo SMT 1/8" jack. The SwinSID emulates in stereo, which is not exactly true with the SID itself and not the best for my purposes using the audio-IN pin on the gameboy, but we will manage.

Next is an array of resistors and capacitors which are part of the audio filtering.

Then is the 16-bit DAC which converts the Digital data to Analog. This damnable components is the only part which is obsolete...something that we all must try to avoid when designing something cost effective and/or to produce in high quantities. 

I did just read on the SwinSID website: "You can use 8bit PWM output to playback sound without DAC, just connect B0 AVR pin with 4,7K resistor to AUDIO OUT SID socket pin. You also need to add bias by connecting 4,7K from +5V to AUDIO OUT pin. "

Doing this should save me time and money, but I plan on trying both methods to see which sounds better.

Next in the picture is the ICSP connector and the Atmega8515. I am also looking into the Atmega88, but have not placed one to see if it a better fit. This is where I can program any updates to the SwinSID while the chip is "In-Circuit" meaning I never have to remove it.

The middle-center has a large empty area. This is good. Every component has plenty enough room and I have space for modifications or additions later on! If you recall, I planned on adding RAM later on and RAM is nearly useless if you cannot back it up, so I also hope to fit a battery backup. I can't wait!

In the near-center of the board is the clock. This little crystal will be running at 24MHz, much higher than the gameboy itself and faster than any data traversing the traces surrounding it. The plan is to isolate it from any near-by traces to prevent bleeding or interference. Maybe I am exaggerating, but you can never be too careful.

In the bottom left is the MBC1b mapper chip. This allows for the gameboy's z80 microProcessor to address more memory whether in the form of RAM, ROM, or I/O (SID). The MBC1b is the oldest mapper designed for the gameboy, only allowing for a maximum of 16Mbit ROM and 8Kbyte RAM, but it is more than I will need while I utilize no RAM. When I redesign the program and board, I will use an MBC5 mapper chip which vastly increases the addressable memory.

And lastly in the bottom right corner is the ROM itself. Because I use an EEPROM, I may erase and reprogram the cartridge as many times as I like. The unfortunate part of having such a densely populated board is that I cannot socket the ROM if I enclose the cartridge in a shell so when I come to the point where I am finished programming, I will solder the EEPROM in place.

My biggest concern is in my address or I/O map. This is for lack of a better word a map of the binary or hex addresses of each and every device; where they are accessible and to what extent they are accessible. An example of the ROM address may be from $0000 to $3FFF and the SID may be from $4000 to $7FFF. These of course are not the actual addresses, but this is how it would look. The reason I am so concerned is because of how much trouble it is for me to determine the addresses! It is very confusing IMO.

Thanks for reading


To clarify any confusion that may be looming over the project, this is not a replacement for the internal synth. This is not in place of the mysterious 5th sound channel and this will not be compatible with any official game without extensive patching. I am developing this board so that the gameboy can control 3 more channels on top of the four it already has, making it better for 8-bit musicians.

Tuesday, July 9, 2013

SID-Boy Cartridge Continuation

I could easily have written this post yesterday immediately after the last one because I was up working all night but so many components, arrangements, etc. changed. Now, I only minored in engineering at Central Michigan University but I plan on mastering in it eventually once my bills are caught up...anyhow, I decided to remove the RAM for the time being because it will make for an easier memory mapping. Both the SID and RAM are to be written to and there is no room for a battery backup, so whats the point of RAM at all? At least at this point in time.

Image Hosted by
Currently I have the SwinSID, ROM, MBC5 mapper chip, components  and ICSP all placed. The TDA1543 DAC IC will remain through-hole because these chips are difficult to locate and the SMT version happens to be larger because of 8 unused pins! I have replaced the massive crystal with a tiny surface mounted one and will replace the resistors with SMT resistors as well. The PLCC socket will be removed because it is too large to fit inside of a gameboy but for the time being, I could only locate a 29f040/49f040 library file as through-hole.

Shortly, I will remove the logic chip that was never utilized and move the headphone jack to the other side because "if" the Audio-IN pin works as I hope it does, the traces would need to be on the other side.

If design goes as planned (for future versions) I will be able to support up to 64MegaBits of ROM! can you imagine a program that large!? However, RAM will probably be placed once I figure out how to add both the SID and RAM into the same 64Kbit addressing space. I may even decide to use a memory module that requires no battery backing, which would be a little more costly but less consuming of space.Hell, my program could easily be modified to support a YM2612 version if the project pans out. Just keep reading!

Also, if I manage to create a working prototype, I will be starting a kickstarter page for this project.

Monday, July 8, 2013

Gameboy and SID Interfacing Theory: Why Not?

Driving home after visiting the family on holiday and I had a wonderful idea. I was thinking about the computer that I am working on (and will post about extensively later on) and came up with another project I should be working on. "Why hasn't anyone else began this project," I thought to myself. So I quickly tore apart the box of candy bottle caps I had finished off and drew a quick size-representation of what one such device would look like on the dusty sugar-covered cardboard.

The gameboy is an 8-bit computer in the purest of form; ROM, RAM and simple I/O communication. Other devices have been designed for use with the gameboy both officially and unofficially, by Nintendo and by other devs. Adding any device should be as simple as hooking up the Address bus, data bus and placing said device somewhere in the existing memory map.

I have also been looking into pin 31 on the gameboy cartridge slot. This particular pin as far as I know has never been implemented in an official device and just goes to waste. It is referred to as the Audio-IN pin. All I know is that it connects to the z80 uP...I do not know which direction transfers occur nor do I know what kind of audio the trace can handle, amplified or otherwise. I will get back to this pin later on, now we shall discuss the connections and board layout.

My first sketch was simply to arrange the components without worrying about logic, power, or anything else.
Image Hosted by
The second sketch realized the need to map the SID's address with logic, power the SID at +12v and add an audio ouput.
Image Hosted by
Sketch three was made when I remembered that SwinSID would be a more reasonable build. The size and power supply will both more easily be designed.
Image Hosted by
Sketch four, or version 2.1 is the board I will start to design in Eagle PCB. as you can see, I added mostly SMT components due to size restrictions. ROM will be in a socket as a PLCC. RAM and MBC (the memory mapping chip) will be the ordinary SOIC that comes in most GBC cartridges. I have yet to realize a battery backup because I have yet to determine how the ROM will be programmed; hence the socket.
Image Hosted by

I believe 4Mbits (512Kbytes) will be sufficient size for the ROM to begin with. I only have 49f040 EEPROMs on hand right now anyhow. With the MBC5 chip, I can be a little more sloppy with the glue logic since there will be plenty of addressable bits left over. And lastly if the audio-IN pin works as I hope, there will be no need for an extra 1/8" headphone jack. How annoying would that be, amirite!

A few notes about SwinSID that make it choice for my project it is drop-in, pin-compatible with the original SID; both 6581 and 8581. It also runs on +5v rather than the 12 or 9 that the SIDs run on. It does however require its very own xtal but the gameboy has a clock pin running through the cartridge slot which is very slow. I will look into whether the speed is sufficient to run the SwinSid (probably not though).

More updates soon!

Tuesday, July 2, 2013

Update: Jul-2-13

Since my last post, I have not only acquired an Apple IIe but have set myself on a journey of self-betterment and creation. (Im gonna build something)

Image Hosted by

Clearly my Apple is beaten up with keys missing and ... a makeshift floppy drive but it is one of the coolest things I have ever owned. The internals are simple enough to follow myself and the features are incredible. For the longest time I had been planning a new device to engineer and produce, but if it wasn't for the Apple II, I may still be at square one.

To begin with, the uP inside is the 6502. Quite powerful for its time and variants are still being produced today! For the device I am designing, I have chosen the 65c816 which is a higher processing faster uP than the 6502. It still keeps a certain amount of backwards compatibility too which may or may not come into play with my computer.

I am now studying the 65c816, latching process, addressing methods, etc. The thing can address up to 16Mbytes which is absolutely astounding! I have started looking into I/O options such as the DUART which I may use for MIDI and controlling an LCD module for serial output. This lead me to find the TellyMate which converts serial data to composite video. The TellyMate is in such a small package, that I have decided to fit one into the shell so that it can be put onto a television.

As for the main purpose, I am designing a computer to cater to the chiptune artist. There will be at least two synth chips (vintage of course) and an expansion port for other software. The expansion port I have decided will be not only used for software, but for addressing custom hardware devices designed by other people in the future. Gotta love them modders. I may design a docking system to connect a control board with buttons, pots and other components to control filtering, looping, controlled interference and other attributes of individual sound channels.

If you're a fan of LSDj and the DMG-01, then you may want to follow my blog. I will be starting a kickstarter eventually which will have all of the information and replace the gameboy entirely. My handheld computer will not only have more sound channels, but built-in midi control and the main focus is the modder. I will create the very most mod able toy ever.