PPU Clock Circuit

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderator: Moderators

Post Reply
timali
Posts: 4
Joined: Wed May 05, 2021 11:41 pm

PPU Clock Circuit

Post by timali »

I'm making a graphics adapter based on the PPU for an old single-board computer, and I'm wondering what to do about the clock circuit for the PPU. My first thought was to copy the clock circuit in the NES verbatim and use it, since we know it works. For a reference point, used my scope and my NES to look at the clock signal on PPU pin 18, and I have some questions about it.

The NES PPU clock signal ranges from -0.7 V to +3.0 V, which I find odd (see attached scope capture). I would have expected a clock signal going from 0 V to closer to 5 V, and more square than the triangle-like clock the NES generates. Does anyone know if there is anything special about the NES clock circuit, and the waveform it generates, or could I use my own clock circuit -- perhaps one that generates a 0-5 V square wave, instead of the odd shape and voltage range I'm measuring on the NES?
Attachments
NES PPU Clock.png
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: PPU Clock Circuit

Post by lidnariq »

timali wrote: Thu May 06, 2021 6:41 am The NES PPU clock signal ranges from -0.7 V to +3.0 V, which I find odd (see attached scope capture).
For reference, what's the bandwidth of your oscilloscope?
I would have expected a clock signal going from 0 V to closer to 5 V,
The NES CPU and PPU are NMOS devices and use 5VTTL voltages, so don't need a rail-to-rail clock
perhaps one that generates a 0-5 V square wave, instead of the odd shape and voltage range I'm measuring on the NES?
You don't want a square wave. That'll increase accidental RF emissions at the odd multiples of the fundamental. Ideally it'd be a sine wave instead of the triangleish that you see.
User avatar
krzysiobal
Posts: 1036
Joined: Sun Jun 12, 2011 12:06 pm
Location: Poland
Contact:

Re: PPU Clock Circuit

Post by krzysiobal »

It's just the simplest generator that can be done with a crystal, single transistor (Q2), configured as common emiter, and a few discrete elements. Q3 is just an common collector, which amplifies by current the the clock for CPU.
nes.png
nes.png (6.61 KiB) Viewed 4620 times
viewtopic.php?t=18861

You don't need beautiful square 5vpp signal.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: PPU Clock Circuit

Post by lidnariq »

Because it amused me, I took the screencap you have there, transformed it into numbers, and then calculated the spectrum of it. You have something that's equivalent in spectrum to a sawtooth wave, which is a little worse than a square wave for accidental RF radiation. (It contains all the even harmonics as well, at the same 1/n attenuation)
timali
Posts: 4
Joined: Wed May 05, 2021 11:41 pm

Re: PPU Clock Circuit

Post by timali »

For reference, what's the bandwidth of your oscilloscope?
350 MHz.

Out of curiosity, I dug out a second NES and compared the PPU clock signal to the first one. Both NES PPU clocks seem to have the same basic shape, but the second NES PPU clock has lower peak-to-peak amplitude, and it doesn't drop below 0V like the first one. Not sure why the two would be different, other than component variances, but they both seem to work just fine.
Attachments
Two NES PPU Clocks.png
timali
Posts: 4
Joined: Wed May 05, 2021 11:41 pm

Re: PPU Clock Circuit

Post by timali »

Thanks for all the feedback. Based on it, I thought I would try starting with the NES clock circuit and stripping away what I thought I didn't need (I'm not using the NES CPU), and built a prototype with the parts I have on hand:
Trial Circuit.PNG
Trial Circuit.PNG (20.38 KiB) Viewed 4531 times
It seems to give a reasonable waveform, 0-4.7 V PP:
Trial CLK.png
Does anyone see any major issues with me using this? (Please ignore the incorrect frequency -- I'm using a ~22 MHz crystal because my 21.47727 MHz crystals haven't arrived yet).
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: PPU Clock Circuit

Post by lidnariq »

That topology doesn't isolate the crystal from the load of the PPU, so you may have some kind of problem from that. Maybe.
timali
Posts: 4
Joined: Wed May 05, 2021 11:41 pm

Re: PPU Clock Circuit

Post by timali »

krzysiobal wrote: Thu May 06, 2021 10:27 am It's just the simplest generator that can be done with a crystal, single transistor (Q2), configured as common emiter, and a few discrete elements. Q3 is just an common collector, which amplifies by current the the clock for CPU.
nes.png
viewtopic.php?t=18861

You don't need beautiful square 5vpp signal.
Thanks for the schematic! I compared it to my NES, and it mostly matches, but there is one difference I am curious about: unless I'm mistaken, on my NES's, R10 is connected differently from your schematic. Not sure if this is a mistake, or a difference in hardware.
NES PPU Circuit - R10.PNG
User avatar
aquasnake
Posts: 515
Joined: Fri Sep 13, 2019 11:22 pm

Re: PPU Clock Circuit

Post by aquasnake »

try 1M ohm
Post Reply