Interfacing to NES PPU using a microcontroller

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: Interfacing to NES PPU using a microcontroller

Post by blargg »

The Art of Electronics suggests the TTL-output oscillators in a can, due to issues getting discrete oscillators to run reliably.
The_YongGrand
Posts: 27
Joined: Tue Mar 19, 2013 9:30 am

Re: Interfacing to NES PPU using a microcontroller

Post by The_YongGrand »

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. :)
User avatar
TmEE
Posts: 790
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Interfacing to NES PPU using a microcontroller

Post by TmEE »

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
The_YongGrand
Posts: 27
Joined: Tue Mar 19, 2013 9:30 am

Re: Interfacing to NES PPU using a microcontroller

Post by The_YongGrand »

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_oscillator
Thanks 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. :)
The_YongGrand
Posts: 27
Joined: Tue Mar 19, 2013 9:30 am

Re: Interfacing to NES PPU using a microcontroller

Post by The_YongGrand »

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
qwertymodo
Posts: 775
Joined: Mon Jul 02, 2012 7:46 am

Re: Interfacing to NES PPU using a microcontroller

Post by qwertymodo »

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.
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: Interfacing to NES PPU using a microcontroller

Post by blargg »

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.html
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.
The_YongGrand
Posts: 27
Joined: Tue Mar 19, 2013 9:30 am

Re: Interfacing to NES PPU using a microcontroller

Post by The_YongGrand »

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.
Post Reply