Hello there,
I played some NES games using Micro Genius (I'm in SE Asia) when I was just a little kid, and then much later in my life, I'm into the PC world. Plus, I did a lot of microcontroller projects in my free time too.
Unfortunately, I can't find my Micro Genius anymore, prolly it was disposed. So I happened to have bumped into eBay one day and found those PPU clones sold cheaply, which are the UMC 6538. I assumed it's the same as the NES's one, so I'm just wondering, would it ever work if I connect it to, say, an Atmega644 (or PIC18F), plus some 62256 SRAM in my drawer? Could I write some commands in the microcontroller first and coax it to display a tile/sprite or something on a TV?
Or, should I really need to pair it with the 6502?
It is certainly possible. I recall HardWareMan (he is on this forums) once connected the PPU to an old Soviet 8-bit computer (8080 based).
Brian Provinciano ("BriPro") also had a project on his old site where he connected the NES PPU to PC's ISA port.
FYI, to get started, you don't even need to connect any of the PPU address pins, because you can get some simple colors rendered by simply setting the palette and pointing the PPU address at one of the palette entries, while keeping rendering disabled.
Thanks for all the opinions. I thought it may seem impossible at start, but it's actually do-able. Right now all I can get is the new (or new old stocks) clone versions of these PPUs as the original ones are dead expensive.
I've read a bit about the 6502 - and it seems the modern 8-bit microcontrollers are much faster and convenient than this 6502, except the microcontrollers have fixed amounts of flash ROM. I may need to wait for the PPU to come as I'm buying from eBay and it ships from China.
I just got a batch of these clone PPUs too (UA6538) days ago too. However, I cannot seem to find 26.60712MHz oscillator in my place, the nearest is only 27MHz.
Should I really get the 26.607MHz oscillator, or just go for the 27MHz one?
The 26.6 (exactly 6×PAL colorburst) MHz crystal is needed for PAL colors to work correctly; if you don't use exactly that your colors will most likely be wrong (probably rainbows). But 27MHz will be enough for displaying anything at all. (1.5% error is fine for all the other video timings)
It's not clear you'll be able to find the 6× crystal; you may need to build some other circuit that rings at the requisite frequency. (e.g.: extracting odd overtones from square waves is easy)
lidnariq wrote:
The 26.6 (exactly 6×PAL colorburst) MHz crystal is needed for PAL colors to work correctly; if you don't use exactly that your colors will most likely be wrong (probably rainbows). But 27MHz will be enough for displaying anything at all. (1.5% error is fine for all the other video timings)
It's not clear you'll be able to find the 6× crystal; you may need to build some other circuit that rings at the requisite frequency. (e.g.: extracting odd overtones from square waves is easy)
Thanks for the info. I searched and searched in element14 and nearby electronic component retailers but all I ended up is a 26 or a 27MHz crystal.
Would that video synced or to lock properly on the TV with a small error?
80/3 = 26.6667 MHz is about 1 part in 400 off from the true 26.6017. That'll work great for black and white. But to avoid rainbowing at the right side, you'll need the difference in subcarrier phase to be less than (guessing) 1/20 of a cycle by the right side. Now phase is the integral of frequency, and over the 52 microseconds of each scanline, there are about 230 cycles of the subcarrier. This means the frequency difference needs to be less than about 1 part in 5000.
Hmm. Ugh, I can't seem to find any exact 26.6MHz oscillators inside. I guess I should get the NTSC variant of the PPU, as the frequency for the oscillator is much more available at my place.
Get a PLL of some sort and use on to multiply 4.433619MHz signal to 26.601712MHz. Will also work for making 3.579545MHz to 21.47727MHz.
For NTSC, you won't be able to find 6× crystals either. You're going to have to build or buy a PLL or some other frequency multiplier regardless of the PPU you use.
Here's a non-PLL solution using a 4x clock source (I know that crystal frequency is available). It divides by 2, then multiplies by three:
Attachment:
1½×.png [ 979 Bytes | Viewed 5552 times ]
If you change the frequency you drive it at (e.g. switching to NTSC), you'll need to change the LC. (2π√(L·C) = desired output frequency, and that needs to be an odd multiple of the input frequency)
You'll probably want to put a trim capacitor or trimmable inductor. A PLL should be less fiddly.
Whoa, thanks. Real tough job. But I'll still do it, the tougher it is, the better it is!
I'd try to get a cheap adjustable oscillator pack from ebay which I would tune it to 26.6MHz first and look in the oscilloscope screen.
Also, I found a couple of the 26.60MHz crystals around in Taobao, prolly will get some of these and make an oscillator from the inverter chip. I still need to ask them about the specifications first.
Sorry for bumping up the post. My interfacing attempt has been very slow due to work and stuff.
I got these 26.601712MHz crystals finally from ebay, and unfortunately it's not a direct standalone oscillator, so I have to couple this crystal with another few components to make it complete.
Would using the chip inverter (not gate) and a few caps generate the intended 26.601712MHz clock? All I know that I can't use the CD4069 because it's too slow.
Or, should I use the transistor ones for better stability?
Love to hear the opinions.
I have never actually seen a comprehensive list of "here's all the ways you could build a quartz crystal driver, and here's when you'd rather one vs another", but then again, I haven't looked at a copy of Art of Electronics in quite a while.
Sorry I'm only providing you with a "dunno".
The Art of Electronics suggests the TTL-output oscillators in a can, due to issues getting discrete oscillators to run reliably.
Hello,
Sorry for the late reply. I will get these oscillator packages, and getting myself the 21.47MHz and the 26.60MHz as well. Had a very difficult time to create my own so the oscillators will help to run these chips.
I have usually had no problems getting Pierce Oscillators work nicely. NAND, NOR or NOT gate, pair of capacitors, 1Mohm+ resistor and maybe a 1K resistor. For 3rd overtone crystals things get a bit more complex as you need a HPF to prevent fundamental oscillation. I had tons of "fun" getting some 33.8688MHz crystals work in 3rd overtone mode...
http://en.wikipedia.org/wiki/Pierce_oscillator
TmEE wrote:
I have usually had no problems getting Pierce Oscillators work nicely. NAND, NOR or NOT gate, pair of capacitors, 1Mohm+ resistor and maybe a 1K resistor. For 3rd overtone crystals things get a bit more complex as you need a HPF to prevent fundamental oscillation. I had tons of "fun" getting some 33.8688MHz crystals work in 3rd overtone mode...
http://en.wikipedia.org/wiki/Pierce_oscillatorThanks for the reply. While waiting for the oscillators to come, I experimented with these with the help of an oscilloscope. The thing is, it worked, but I had troubles getting it at 50% duty cycle as it hovers around 60% at the least.
I do not know the exact duty cycle required for the these PPUs nut I'll keep reading and checking the documents in NesDev.
Due to work and stuff, I did manage to find some time to experiment a bit with the PPU clone I have, UA6528. With the PIC18F4221, I built the circuit, connecting the /CS, D0-D7 and A0-A2 from the PPU to the microcontroller to test the output. I've also verified the output with an oscilloscope, NTSC signals are correct from the "Video Out" pin.
Using the oscillator-in-can (4-pin) ones (21.42MHz) and with the NTSC version of the PPU, I managed to coax it to display an entire background of a red, green or blue (intensify one color only) through one of the PPU registers. I got those hints from the "NerdyNights" first app tutorial (thanks to the author).
I have not connected the memory yet (that is the hardest part, to be honest) and I may be putting these up slowly. I will put some pictures of the PPU output captured from my TV framegrabber, since I do not have an accessible CRT nearby my table.
Actually, prior to all that idea, someone from Japan has made up a mini game using an AVR and the official NES' PPU, RP2C02, with another commonly used arcade sound chip:
http://www.geocities.jp/r8ctiny/avrrp2/avrrp2.html
The
74LVC1GX04 is specifically designed for driving a crystal oscillator. I built a small PCB for it, and it seems to work great, though I haven't had a chance to hook it up to an oscilloscope yet to see how clean the clock signal is or what the duty cycle is. You can
order the PCB from OSHPark if you're interested.
The_YongGrand wrote:
Actually, prior to all that idea, someone from Japan has made up a mini game using an AVR and the official NES' PPU, RP2C02, with another commonly used arcade sound chip:
http://www.geocities.jp/r8ctiny/avrrp2/avrrp2.htmlI've been getting into the AVR series lately and it's a joy to use. gcc-based toolchain that supports C and C++, USB-based programmer that can literally be had for $5 on eBay, including shipping to the US, and can program chips with just a few jumpers connected to the cable, $2 chips that have an 8 MHz internal oscillator (zero support components), and most instructions taking one clock cycle (even add immediate), some two (set an I/O bit, branch). Highly recommended.
blargg wrote:
I've been getting into the AVR series lately and it's a joy to use. gcc-based toolchain that supports C and C++, USB-based programmer that can literally be had for $5 on eBay, including shipping to the US, and can program chips with just a few jumpers connected to the cable, $2 chips that have an 8 MHz internal oscillator (zero support components), and most instructions taking one clock cycle (even add immediate), some two (set an I/O bit, branch). Highly recommended.
I loved those AVRs too, but unfortunately they are not pretty popular here in the nation I lived. In other story, I got the PPU working, right from the OAM to the palette RAM and such. I could even make an animation using a PIC microcontroller. Since this is captured using a USB capture device (NTSC signal) I will dig out the pictures and paste it here later.
The harder part is to connect this with a sound chip like the GI AY-3-8910 clone (KC89C72) due to the sharing of the data bus with the PPU. If it's connected with the NES CPU, it wouldn't be too difficult due to the integrated sound generators.