nesdev.com
https://forums.nesdev.com/

Interfacing to NES PPU using a microcontroller
https://forums.nesdev.com/viewtopic.php?f=10&t=9942
Page 1 of 2

Author:  The_YongGrand [ Tue Mar 19, 2013 9:52 am ]
Post subject:  Interfacing to NES PPU using a microcontroller

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?

Author:  Shiru [ Tue Mar 19, 2013 10:25 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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).

Author:  thefox [ Tue Mar 19, 2013 10:46 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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.

Author:  The_YongGrand [ Tue Mar 19, 2013 7:07 pm ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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.

Author:  The_YongGrand [ Fri Apr 12, 2013 11:29 pm ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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? :D

Author:  lidnariq [ Sat Apr 13, 2013 12:50 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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)

Author:  The_YongGrand [ Sat Apr 13, 2013 5:31 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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?

Author:  Shiru [ Sat Apr 13, 2013 5:33 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

80/3=26.6.

Author:  tepples [ Sat Apr 13, 2013 6:35 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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.

Author:  The_YongGrand [ Sat Apr 13, 2013 7:06 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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. :)

Author:  TmEE [ Sat Apr 13, 2013 10:15 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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.

Author:  lidnariq [ Sat Apr 13, 2013 10:58 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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
1½×.png [ 979 Bytes | Viewed 4263 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.

Author:  The_YongGrand [ Sat Apr 13, 2013 10:03 pm ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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. :)

Author:  The_YongGrand [ Mon May 06, 2013 2:08 am ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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. :)

Author:  lidnariq [ Mon May 06, 2013 12:25 pm ]
Post subject:  Re: Interfacing to NES PPU using a microcontroller

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".

Page 1 of 2 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/