What's new

Do you understand a PCBs real pixel count? If so, please read and reply!

XtraSmiley

Legendary
Joined
Sep 18, 2016
Messages
5,057
Reaction score
4,491
Location
Washington DC
Team, I'm hoping you can help. I am trying to make a perfect picture profile for the RetroTink 4K for Arcade PCBs and the first series I'd like to do is Cave CV1000 boards. I started to follow this tutorial by FirebrandX here:

View: https://www.youtube.com/watch?v=vVqdLPazLi4&t=278s

He is doing a profile for the MegaDrive/Genesis in the 320x224 resolution. At 2:52 in the video you can here him say that to dial in the optimal timing you have to know the true "Total Pixels Per Line" of the 320 mode, which is 427.6 (later he realizes this is incorrect and it is 427.5), based on the fact that there is a horizontal blanking period which moves it from 320 to 427.5.

What I need is the true, Total Pixels Per Line of a Cave CV1000, which has a resolution of 320x240, however to dial it in properly for perfect pixel display, I need the horizontal blanking period (or the total true pixels per line). These extra pixels may be listed as the h-blank and v-blank area as well.

Alternatively, we can have the RT4K auto detect the true pixels per line, but you would need the Master Sample Rate to do so, and I have no idea how these are determined at all or even what it is. Here they are published for major home consoles, but no Arcade PCBs other than MVS. With the Master Sample Rate the RT4K Pro has a setting that will arrive at the Total Pixels Per Line, but of course that's useless unless you know one or the other!

https://consolemods.org/wiki/AV:RetroTINK-4K/System_Specific_Settings

Two years ago @Paranoid_Andy was doing something similar for the OSSC and his results were incredible (see page two for images), but I've given away my OSSC and can't remember all the things I did with it (old man brain). I think he was basically doing the same thing on the OSSC using math to determine the best pixel image. Here is that thread:

https://www.arcade-projects.com/thr...t-clock-of-an-arcade-game-for-the-ossc.27176/

I am sure @invzim correctly identified the needed information in that thread that we still need now. Paranoid Andy, if you ever upgraded to a RT4K, have you made any progress here?

I do have a small oscilloscope that is probably a beginner one that is probably limited in capability and not a pro-level measuring device, however if it is not to difficult to learn how to do this, I don't mind doing some work, I just need help getting started!

Thanks so much for any and all help anyone can give. Even if someone (like @buffi said next time he had time he would provide the CV1000 numbers based on his prior measurements) I would still like to know HOW to find it for many of the other PCBs I would like to create profiles for and to document the information online for others in the future.

I was also told it might be in MAME, but I couldn't see it or figure out how to extract it, so I'm not sure about that.

Thanks so much!
 
Ok, so this is my understanding of how you would measure this, but I am NOT an expert in this so feel free to fact check me.

For a aproximately 15khz game, running at about 60hz you can assume that aproximately 250 horizontal lines (hsync pulses) will be generated per frame. Games will not run at exactly 15khz nor 60hz so you will need to check the exact number.

First by only looking at sync, you can easily-ish measure:
- FPS: Number of vsync pulses per second.
- Number of hsync pulses per frame: From start of a vsync pulse to start of next vsync pulse, how many hsync pulses trigger.

Then for each horizontal line, you can easily find the hsync length by just measuring it.

Then by looking at a color signal, and sync while an image is drawn across full width you can see how much of the non-sync time that colors are displayed. If you know the expected width of the rendered area (check in mame), you can divide the time that colors are active with the width in pixels and get a pixel clock. Then you can use that to get the pixels per line by dividing the per-line time with the pixel clock. Not sure if you need the pixels between sync pulses or including them.

Probably possible to do this with an oscilloscope. I've used a Saleae Logic Pro 16 logic analyzer for it though, which does analog stuff quickly enough.
 
Holy crap, that logic analyzer is expensive as hell! Let's say I'm crazy though, and DID buy it, how easy is it for me to learn to do what you are saying. I barely can tell if you're speaking English there Buffi!

Any tutorial on how I could do this with my crappy little scope?
 
My understanding of how to calculate this aligns with buffi's but I've got no experience in attempting this myself. (though I'm highly interested in it's relevance in a future project with light gun tracking).

The Saleae Logic Pro 16 is a fantastic Logic Analyzer, but WAY WAY overkill for this. and even quite expensive for what it is. I use one of these all the time at my job designing and building Satellites, so yeah a really great tool but more than you'd need for this project. Even if you're going to buy a Saleae you can get away with the Logic 8 (half as many channels, and you only need 2 channels for this project!).

If you want to be a super cheap bootlegger you can buy a $10 Chinese logic analyzer off of eBay and run the old Saleae Logic 1 software like this one: https://www.ebay.com/itm/124238666414
these are basically dirt cheap bootlegs of Saleae's older model. Their biggest drawback (other than the cheap construction) is they're quite slow. I have a couple and they're effectively much slower than their advertised speed since you really want a sampling rate far above what you're trying to measure. Should still be fast enough for this project though.

A good middle ground is the Logic Analyzers by Digilent: https://digilent.com/shop/digital-d...logic-analyzer-and-digital-pattern-generator/
it has more channels than the Saleae and they can be paired up to actually double the sampling speed (making it faster than the Saleae) but it doesn't support analog capture like the Salae, you need to buy a completely separate device from Digilent if you want that... though even buying both devices is cheaper than a Saleae... and that feature wouldn't be needed for this project anyway.

As for doing this with a scope. you could, though I wouldn't; the process would be a much bigger pain. To be honest I'm not familiar enough with scopes to advise on the best way through using that tool.
 
My understanding of how to calculate this aligns with buffi's but I've got no experience in attempting this myself. (though I'm highly interested in it's relevance in a future project with light gun tracking).

The Saleae Logic Pro 16 is a fantastic Logic Analyzer, but WAY WAY overkill for this. and even quite expensive for what it is. I use one of these all the time at my job designing and building Satellites, so yeah a really great tool but more than you'd need for this project. Even if you're going to buy a Saleae you can get away with the Logic 8 (half as many channels, and you only need 2 channels for this project!).

If you want to be a super cheap bootlegger you can buy a $10 Chinese logic analyzer off of eBay and run the old Saleae Logic 1 software like this one: https://www.ebay.com/itm/124238666414
these are basically dirt cheap bootlegs of Saleae's older model. Their biggest drawback (other than the cheap construction) is they're quite slow. I have a couple and they're effectively much slower than their advertised speed since you really want a sampling rate far above what you're trying to measure. Should still be fast enough for this project though.

A good middle ground is the Logic Analyzers by Digilent: https://digilent.com/shop/digital-d...logic-analyzer-and-digital-pattern-generator/
it has more channels than the Saleae and they can be paired up to actually double the sampling speed (making it faster than the Saleae) but it doesn't support analog capture like the Salae, you need to buy a completely separate device from Digilent if you want that... though even buying both devices is cheaper than a Saleae... and that feature wouldn't be needed for this project anyway.

As for doing this with a scope. you could, though I wouldn't; the process would be a much bigger pain. To be honest I'm not familiar enough with scopes to advise on the best way through using that tool.
As an example from when I did this for old Psikyo boards:
  • Dot clock 7.15905 MHz
  • Total: 456 dots
  • Visible: 320 dots
  • Sync: 50 dots (~11% of 456)
For looking at color value you need analog signal support. I dont think those cheap chinese ones are a good match for this.

There probably are cheaper devices than the Saleae I have though, but I just know what I used :)

You want to have a higher sample frequency than pixel clock, but probably dont need 4x it (like for digital signals) since you mainly care about any color being present when detecting visible area.
 
I guess you can probe the digital color signals that goes into the DAC instead to not have to deal with analog signals though.

That should make it easier to use cheaper tools
 
I guess you can probe the digital color signals that goes into the DAC instead to not have to deal with analog signals though.

That should make it easier to use cheaper tools
Actually maybe its possible to get pixel clock by just looking at the DAC, and scoping when it latches color signals to outputs? Should be a pin for that probably. Have not looked at datasheet. That would make things fairly trivial.
 
color value you need analog signal support. I dont think those cheap chinese ones are a good match for this.
you're right I didn't consider the color values. the chinese logic analyzers don't support that unfortunately.
 
As an example from when I did this for old Psikyo boards:
  • Dot clock 7.15905 MHz
  • Total: 456 dots
  • Visible: 320 dots
  • Sync: 50 dots (~11% of 456)
For looking at color value you need analog signal support. I dont think those cheap chinese ones are a good match for this.

There probably are cheaper devices than the Saleae I have though, but I just know what I used :)

You want to have a higher sample frequency than pixel clock, but probably dont need 4x it (like for digital signals) since you mainly care about any color being present when detecting visible area.
OK, so for a Psikyo board, the total pixels is 456, with visible at 320. This sounds like the exact numbers I am looking for. Which Psikyo board is this? If I have the board I can test via the RT4K right now.

Why do I need the color value? Is the above information not sufficient for what we're trying to do?


Finally, let's say I'm very stupid with money and am willing to spend $1500 on a logic analyzer. Would I be able to, with some coaching, be able to measure the number I need fairly easily, or is this very difficult for an inexperienced person.

At the end of the day, I have a lot of PCBs and would like to slowly get a database built with these numbers so people can have a perfect picture on their games!
 
@XtraSmiley have you looked over at the R3 site?
http://r3.fyi/Main/HomePage

I know it mainly focuses on console stuff but they break down the math on aligning stuff with pixel count both horizontal and vertical lines.
Just my small high school two cents.
This is interesting. Could this capture device break it out as shown here on the optimally phased section? After all, that's what we're trying to do right? Maybe I just need to buy this device?

http://r3.fyi/Datapath/Capture240p
 
OK, so for a Psikyo board, the total pixels is 456, with visible at 320. This sounds like the exact numbers I am looking for. Which Psikyo board is this? If I have the board I can test via the RT4K right now
Iirc all boards on the early psikyo hardware that strikers 1945 and tengai are on have that timing.

The later hardware that strikers ii and so on uses have other timings
 
Here are my OSSC CPS2 settings I’ve literally spent months tweaking. You be the judge with how sweet this looks even with my crappy iPhone 13 camera:

IMG_5167.jpeg

IMG_5178.jpeg

IMG_5175.jpeg

IMG_5177.jpeg

IMG_5174.jpeg

IMG_5168.jpeg
IMG_5169.jpeg


Here are my settings:

Video LPF - 9 MHz
YPbPr in ColSpa: Rec. 601
R/Pr offset: 128
G/Y offset: 128
B/Pb offset: 128
R/Pr gain: 20
G/Y gain: 20
B/Pb gain: 20
Pre-ADC Gain: 8

Sampling option:
480p in sampler: DTV 480p
Allow TVP HPLL2x: off
Allow up sample 2x: on

Adv. timing (380 x 240):

H. Samplerate: 512.15
H. S.rate adj: 512.15
H. synclen: 37
H. Backporch: 57
H. Active: 384
V. synclen: 3
V. backporch: 23
V. Active: 224
Sampling phase: 270 deg

Sync options:

Analog sync LPF: Off
Analog sync Vth: 78 mV
Hsync tolerance: 0.92 us
Vsync threshold: 10.46 us
H-PLL Pre-coast: 1 line
H-PLL post-coast: 0 lines

Output option:

240p/288p proc: Line5x
Line5x mode: 384 x 240 optim.
Line 5x format: 1600 x 1200
TX mode: HDMI (RGB)
HDMI ITC: On

Scanline option:

Custom SL:

Sub-line 1 str: 31%
Sub-line 2 str: 0
Sub-line 3 str: 0
Sub-line 4 str: 0
Sub-line 5 str: 43%

Sub-column 1, 2 & 3 str: 0
Sub-column 4 str: 12%
“ 5&6: 0

I didn’t touch anything else in the OSSC menus. Again, I obsessed over getting every single picture detail as accurately depicted (ratio/square pixels) as much as possible.

My firmware is old (0.92 I believe) & it’s running with a HAS 4.2.

You’re welcome if these settings work as well for you as they do for me.
 
Last edited:
Back
Top