PPU Voltage Levels

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

PPU Voltage Levels

Post by kevtris » Fri Sep 22, 2006 2:17 pm

As the name implies, here's my document I prepared earlier...

Code: Select all

                           NES Video Voltage Levels
                           ------------------------


09/22/06
V1.00
K.Horton
----



I got bored one day and decided to throw the NES' video up on the
scope and see what it was outputting.  I used an Agilent 54622D 
mixed signal scope for the tests.

For testing, I wrote a small palette test program that output four
solid colour bars, left to right, with a 2 pixel divider between
each coloured area.  These dividers made convenient reference marks 
when looking at the signal on the scope.

I measured the voltage on the emitter of the amplifier transistor
connected to the PPU's video output pin.  An original model top loader
was used for the tests.



                                   /-- C.B. High Level
                               ^^^^^
 Black Level ->  -----       --VVVVV
                      |     |      \-- C.B. Low Level
       Synch Level -> |_____|


           
           NES blanking/burst/black level diagram
          



The above represents the start of a scanline on the NES.  There are four
key voltages indicated:  black level, synch, and the burst high/low
voltage that it oscillates between to generate the burst.  There are exactly
10 cycles of 3.579MHz making up the burst. Because the NES inserts an
extra pixel every other frame, this forces the burst to have 1 of 2 different
phasings.  This is clearly seen on the scope.

As for the actual rendered video, there are only 8 different voltage levels.
The two grey sets, 00h and 0dh, conveniently output 4 of each voltage level. 
This made testing rather simple.  First, I output colours 00h, 10h, 20h, 
and 30h, and then colours 0dh, 1dh, 2dh, and 3dh.  The voltage levels of both 
were measured.


                                  
                     L2,L3 hi -> /-----\    /-----\
                                /       \  /       \
           L1 hi -> /------\   <         ><________/| <- L3 lo
                   /        \ | \       /           |
                  <          >   \-----/ <- L2 lo   |
L0 hi ->  -----  | \        /                       |
         /     \ |  \------/ <- L1 lo               |
  ------<- - - -> - - - - - - - - - - - - - - - - - -----  <- black level
L0 lo -> -------                                    


               Approximate relative amplitudes, somewhat.
               

The video output itself is somewhat interesting; The two voltages each
colour luminance value oscillates between are the same as the static
greys, as discussed above.  For example, colour 15h is oscillating
between colour 1dh and 10h at a 3.579MHz rate.  The phase of this 
relative to the phase of the colourburst determines the colour seen.

Interestingly, the saturation varies among the luminance values- the middle 
two luma values (1 and 2) have the same saturation, but 0 and 3 are 
"squashed".  Luminance 0 actually dips below the black level a tad, and 
this is the cause of the issues if you use colour 0dh.  This "blacker than 
black" really isn't THAT far below the black level, and it really is a long 
ways from synch.  So, on most TVs, this shouldn't be too much of an issue 
if you use colour 0dh for your black.

Luminance 2 and 3 both have the same upper voltage, which explains why
colours 20h and 30h give the same colour; bright white.  Incidentally, this
is the brightest colour the NES can produce, yielding the highest voltage.


Now for the data.  All voltage levels are indicated two ways:  absolute 
and relative.  The absolute voltage is just that- the voltage above 
ground.  The relative voltage is based off of the synch level.  No part 
of the waveform has a voltage lower than synch.  Refer to the above two
diagrams for the points measured.



            |    Normal     |   Emphasis    |
            +-------+-------+-------+-------+
Signal name |  Abs  |  Rel  |  Abs  |  Rel  |
------------+-------+-------+-------+-------+
synch level | 0.781 | 0.000 | 0.781 | 0.000 |
black level | 1.300 | 0.518 | 1.300 | 0.518 |
    C.B. lo | 1.000 | 0.218 | 1.000 | 0.218 |
    C.B. hi | 1.712 | 0.931 | 1.712 | 0.931 |
        ----+-------+-------+-------+-------+
      L0 lo | 1.131 | 0.350 | 1.043 | 0.262 |
      L0 hi | 1.875 | 1.090 | 1.593 | 0.812 |
      L1 lo | 1.300 | 0.518 | 1.162 | 0.381 |
      L1 hi | 2.287 | 1.500 | 1.906 | 1.120 |
        ----+-------+-------+-------+-------+
      L2 lo | 1.743 | 0.962 | 1.493 | 0.712 |
      L2 hi | 2.743 | 1.960 | 2.243 | 1.460 | *
      L3 lo | 2.331 | 1.550 | 1.943 | 1.160 |
      L3 hi | 2.743 | 1.960 | 2.243 | 1.460 | *
        ----+-------+-------+-------+-------+

        * these two are the same voltage level


For the "emphasis" values, I turned all 3 emphasis bits on at once and then
recorded the requisite voltages.  As was noted elsewhere, the emphasis bits
really are attenuation bits.  Turning 1 or more bits on always results in a
REDUCTION of output level, either modulated with the colour carrier(s), or
in the case of all bits on at once, a static value.  As one would guess,
the emphasis values do not affect colour burst, synch, or black level.  

In all cases, the ratio of normal to emphasis is from 1.33 to 1.35, most of
the error probably being in measurement.  So, flipping it around and making
it a percentage, turning on all of the bits will reduce the brightness by
74% to 75%.

/* this is a comment */

User avatar
Quietust
Posts: 1634
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust » Fri Sep 22, 2006 2:37 pm

Interesting that the reduction from the emphasis bits was a straight percentage based on the synch level, rather than a multiply-and-subtract based on the black level (as is documented on the wiki). This certainly simplifies calculations a bit.

What voltages were produced by colors xE/xF? Just the black level? If so, that would also agree with previous information, both voltage-wise and the fact that those colors aren't changed by emphasis - subtracting black level from each voltage and dividing by the maximum range (between $30 and black level), these voltages seem to match what's in the "NTSC Video" article over on the wiki.

All in all, nice to have confirmation and clarification of the previous information gathered.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Post by kevtris » Fri Sep 22, 2006 4:03 pm

Quietust wrote:Interesting that the reduction from the emphasis bits was a straight percentage based on the synch level, rather than a multiply-and-subtract based on the black level (as is documented on the wiki). This certainly simplifies calculations a bit.

What voltages were produced by colors xE/xF? Just the black level? If so, that would also agree with previous information, both voltage-wise and the fact that those colors aren't changed by emphasis - subtracting black level from each voltage and dividing by the maximum range (between $30 and black level), these voltages seem to match what's in the "NTSC Video" article over on the wiki.

All in all, nice to have confirmation and clarification of the previous information gathered.
Yeah, sorry I forgot to put that in. Colours 0eh and 0fh produce the black level only. No more, no less. Both appear to behave identically (which is to be expected).

I too was surprised that the emphasis stuff produced a straight 75% attenuation, almost exactly. It could be that they run the voltage from the divider string(s) through another divider that chops off 25% when the transistor is turned on. Regardless of how they do it internally, we now have 100% confirmation of what happens externally.
/* this is a comment */

NewRisingSun
Posts: 1239
Joined: Thu May 19, 2005 11:30 am

Post by NewRisingSun » Fri Sep 22, 2006 4:38 pm

Shouldn't the NTSC signal amplitude be 1.0V peak-to-peak ("from the tip of the sync pulse to 100% white")?

http://www.bkprecision.com/download/sco ... TSCCVS.pdf

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

Post by blargg » Fri Sep 22, 2006 6:05 pm

Interesting that the reduction from the emphasis bits was a straight percentage based on the synch level, rather than a multiply-and-subtract based on the black level (as is documented on the wiki). This certainly simplifies calculations a bit.
It's what you'd expect if you used a reference point that was offset from zero. It's really nice to have the video levels scoped properly! I bet it didn't take that long to do with real tools either.

How much is the signal changed from the PPU output pin to the RCA connector?

User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Post by kevtris » Fri Sep 22, 2006 7:10 pm

blargg wrote:
Interesting that the reduction from the emphasis bits was a straight percentage based on the synch level, rather than a multiply-and-subtract based on the black level (as is documented on the wiki). This certainly simplifies calculations a bit.
It's what you'd expect if you used a reference point that was offset from zero. It's really nice to have the video levels scoped properly! I bet it didn't take that long to do with real tools either.

How much is the signal changed from the PPU output pin to the RCA connector?
It's two, two, two replies in one!

As for the voltage level being high, yeah it's pretty darn high. But this is OK, since this is directly on the emitter follower of the PPU. This is going to be the cleanest place to monitor it, before it's passed through the modulator to the RF and video output jacks. I was going to scope the video out jack with a 75 ohm load on it to see exactly what we're getting in terms of absolute amplitude.

And yah, using a good scope made it pretty simple along with the test ROM. Is there anything else anyone wants me to check on the video waveform while I have it set up? I planned on getting some detailed timing analysis of it so that's already slated to occur. But as for the video waveform itself, I think this might be all we need.
/* this is a comment */

User avatar
Quietust
Posts: 1634
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust » Fri Sep 22, 2006 7:26 pm

A PAL video waveform would be nice. :)
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Post by kevtris » Fri Sep 22, 2006 10:46 pm

Quietust wrote:A PAL video waveform would be nice. :)
Got a PAL NES I can have/borrow? Actually, does anyone want to donate one to the cause? I'll give it the same treatment I gave the NTSC one.
/* this is a comment */

User avatar
Quietust
Posts: 1634
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust » Fri Sep 22, 2006 11:23 pm

Don't you have a spare PAL PPU? Any reason why you couldn't plug it into your NTSC NES (assuming the PPU is socketed) and just get a slightly odd-frequency signal, or would your scope refuse to synch to it?
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

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

Post by blargg » Sat Sep 23, 2006 3:35 am

I've got the PAL NES board donated to me by Ely Dayan a while back. Since I've been a lazy-ass and done very little with it, I could send it to Kevtris to scope the video signal if he doesn't come up with a PAL PPU hack that works.

Some other things to test:
* As you mentioned, see how the signal is affected if you measure it on the RCA output with a 75 ohm load.
* Verify the number of "pixels" in each portion of a scanline's signal:
25 sync, 4 black, 15 colorburst, 5 black, 1 pulse, 15 left border (background color), 256 active, 11 right border (background color), 9 black
* Verify that the phases of the individual emphasis channel waveforms ($2001 bit 7: same as color $x8, bit 6: color $x4, bit 5: color $xC
* Verify that the color burst has the same phase as color $x8
* When I was looking at the signal a while back, I noticed that just before the first pixel there as an extra pixel based I think on the background color. I think it might not have been the background color, just some modification of it.
* Perhaps look at the waveform during blanking?

User avatar
Quietust
Posts: 1634
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust » Sat Sep 23, 2006 10:51 am

blargg wrote:* When I was looking at the signal a while back, I noticed that just before the first pixel there as an extra pixel based I think on the background color. I think it might not have been the background color, just some modification of it.
Kevtris mentioned that on IRC, as well as the interesting fact that it was affected by color emphasis. Evidently, it's using color 00 for those 1 or 2 pixels.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Post by kevtris » Mon Sep 25, 2006 3:03 pm

Quick followup:

I measured the voltage coming out of my NES' video jack with a 75 ohm load resistor. It measures 981mv peak to peak (synch to white). That's pretty damn close to a perfect video level.

The waveform is around 62mv above ground (synch tip).
/* this is a comment */

Post Reply