Change core clock from 59.18 hz to 60 hz

User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Maybe I am mistaken, but I always though the vsync_adjust param to be related to the scaler and therefore attached to the hdmi output (unless you are using the scaler on vga). I personally don't have any issues with hdmi output on any of my lcd tvs using the original neogeo core. The tweak is aimed more at forcing 60hz for crt usage. Without this fix, on my end, I have a slight roll/wave on my sony trinitron. Now the picture is more stable at the cost of accuracy I guess.
Ganondork
Posts: 17
Joined: Sun May 24, 2020 9:47 pm
Been thanked: 6 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by Ganondork »

You are actually wrong here, vsync_adjust only applies to hdmi-output.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Ganondork wrote: Sun Apr 04, 2021 6:03 pm You are actually wrong here, vsync_adjust only applies to hdmi-output.
I think this is what I said :) vsync_adjust applies to hdmi output.
User avatar
rastan
Posts: 6
Joined: Tue May 26, 2020 4:49 am
Has thanked: 4 times
Been thanked: 1 time

Re: Change core clock from 59.18 hz to 60 hz

Unread post by rastan »

Thank you for this. This has fixed the issue of stuttering scrolling on my TCL 55R617. I'd like to try this with the double dragon core as well, as the 57hz refresh rate causes stuttery scrolling on my TV. However speeding that game up to 60hz would probably affect gameplay more noticeably than the neo's slight increase?
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

rastan wrote: Wed Apr 07, 2021 4:57 pm Thank you for this. This has fixed the issue of stuttering scrolling on my TCL 55R617. I'd like to try this with the double dragon core as well, as the 57hz refresh rate causes stuttery scrolling on my TV. However speeding that game up to 60hz would probably affect gameplay more noticeably than the neo's slight increase?
I can have a look for you. Is it the jtdd core?
User avatar
darksakul
Posts: 353
Joined: Mon May 25, 2020 4:34 pm
Has thanked: 397 times
Been thanked: 73 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by darksakul »

Insert Disk Two wrote: Sat Jan 16, 2021 6:46 pm Updates on Neogeo are done by Sorgelig himself and he does not want to include this option.
I am sure with everything else on his plate, and he understands how individual cores interface with the main framework that Sorgelig got his reasons.
Plus he is not fond of 15khz CRTs so there no motivation on his part to include the option in the core.
It is my great regret that we live in an age that is proud of machines that think and suspicious of people who try to.
User avatar
rastan
Posts: 6
Joined: Tue May 26, 2020 4:49 am
Has thanked: 4 times
Been thanked: 1 time

Re: Change core clock from 59.18 hz to 60 hz

Unread post by rastan »

uberyoji wrote: Wed Apr 07, 2021 10:35 pm
rastan wrote: Wed Apr 07, 2021 4:57 pm Thank you for this. This has fixed the issue of stuttering scrolling on my TCL 55R617. I'd like to try this with the double dragon core as well, as the 57hz refresh rate causes stuttery scrolling on my TV. However speeding that game up to 60hz would probably affect gameplay more noticeably than the neo's slight increase?
I can have a look for you. Is it the jtdd core?
Yes. thanks for offering to look at it!
Insert Disk Two
Posts: 221
Joined: Sun May 24, 2020 7:59 pm
Has thanked: 16 times
Been thanked: 28 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by Insert Disk Two »

darksakul wrote: Thu Apr 08, 2021 1:39 pm
Insert Disk Two wrote: Sat Jan 16, 2021 6:46 pm Updates on Neogeo are done by Sorgelig himself and he does not want to include this option.
I am sure with everything else on his plate, and he understands how individual cores interface with the main framework that Sorgelig got his reasons.
Plus he is not fond of 15khz CRTs so there no motivation on his part to include the option in the core.
Ummm adding a 60hz option would be beneficial to LCD screen users not CRT.
User avatar
darksakul
Posts: 353
Joined: Mon May 25, 2020 4:34 pm
Has thanked: 397 times
Been thanked: 73 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by darksakul »

Insert Disk Two wrote: Wed Jun 02, 2021 11:14 am
Ummm adding a 60hz option would be beneficial to LCD screen users not CRT.
Nothing to do with what I was talking about

15Khz is the carrier frequency not the refresh rate.
It is my great regret that we live in an age that is proud of machines that think and suspicious of people who try to.
User avatar
dataDave
Posts: 7
Joined: Thu Mar 11, 2021 9:44 am
Has thanked: 21 times
Been thanked: 4 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by dataDave »

uberyoji wrote: Thu Apr 01, 2021 10:06 pm Not too complicated honestly if you have a little xp in software devs. It is basically those steps high level:
1) install Quartus lite v17.0 (once)
2) Install git (once)
3) Get/update source code from repo
4) Modify Entity pll from 96 to 97.330180 and 48 to 48.665090
5) Compile core
6) Profit

I plan to maintain the 60hz fork forever so no worries, I will always update this thread each time there is a version in a timely fashion now that my setup is done. I put some notifications on the repo to alert myself when the master is updated.
Hello mate, any chance of 'NeoGeo_20210713.rbf' being given your magic touch? Thanks!
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Sure. But if I read the github thread correctly, sorgelig agreed to make the mvs and aes timing different. It might fix our crt problem by selecting aes. I will have to check if I can still apply the mod.
You can see the discussion here: github.com/MiSTer-devel/NeoGeo_MiSTer/pull/134
paulbnl
Core Developer
Posts: 216
Joined: Sun May 24, 2020 8:48 pm
Has thanked: 49 times
Been thanked: 285 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by paulbnl »

Since there is now a clock switch used in the core you'll have to change it to 60Hz in a different way.

There are 2 numbers here: https://github.com/MiSTer-devel/NeoGeo_ ... eo.sv#L373

Code: Select all

cfg_data <= sys_mvs_r ? 2576980378 : 2865308404;
The first is for MVS and the second for AES. The number for 60Hz should be 3148288251. So just change one or both numbers.

You might also still need to change the PLL to the higher clocks if it is unstable.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

paulbnl wrote: Tue Jul 20, 2021 10:21 am Since there is now a clock switch used in the core you'll have to change it to 60Hz in a different way.

There are 2 numbers here: https://github.com/MiSTer-devel/NeoGeo_ ... eo.sv#L373

Code: Select all

cfg_data <= sys_mvs_r ? 2576980378 : 2865308404;
The first is for MVS and the second for AES. The number for 60Hz should be 3148288251. So just change one or both numbers.

You might also still need to change the PLL to the higher clocks if it is unstable.
I finally decided to get back to this. How do you calculate the fractionnal? On my end I approximated to 3148289000 but I can use your constant instead. I am building a version and will test shortly.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Here's the latest version fixed at 60hz.
https://mega.nz/file/sxUi3BrC#CBxoZxTKy ... h3eQ9Abz44
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Updated folder with a patched version of the Sept 8th release.
https://mega.nz/folder/xlUVEIzB#vKdNV8vkMuQixxPgItnV2w
paulbnl
Core Developer
Posts: 216
Joined: Sun May 24, 2020 8:48 pm
Has thanked: 49 times
Been thanked: 285 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by paulbnl »

uberyoji wrote: Sat Jul 31, 2021 10:12 pm I finally decided to get back to this. How do you calculate the fractionnal? On my end I approximated to 3148289000 but I can use your constant instead.
I just changed the PLL to the higher clock and then the value is at Advanced Parameters -> K-Fractional Division Value (DSM).
wondermagenta
Posts: 6
Joined: Thu Jul 08, 2021 9:49 am
Has thanked: 2 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by wondermagenta »

Hi everyone, would it be possible to make a similar change to the Game Boy/GBA cores? So, adjusting the core clock from 59.7Hz to 60Hz? These systems are really the only ones giving my TV (Sony XH90) trouble, I get frequent stuttering even with vsync_adjust=2. I'm not able to build the change myself unfortunately as I'm on MacOS.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

wondermagenta wrote: Mon Sep 27, 2021 6:39 pm Hi everyone, would it be possible to make a similar change to the Game Boy/GBA cores? So, adjusting the core clock from 59.7Hz to 60Hz? These systems are really the only ones giving my TV (Sony XH90) trouble, I get frequent stuttering even with vsync_adjust=2. I'm not able to build the change myself unfortunately as I'm on MacOS.
What I do on my end is I toggle the Stabilize Video(buffer) on. Try it out and let me know.
wondermagenta
Posts: 6
Joined: Thu Jul 08, 2021 9:49 am
Has thanked: 2 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by wondermagenta »

uberyoji wrote: Tue Sep 28, 2021 3:29 amWhat I do on my end is I toggle the Stabilize Video(buffer) on. Try it out and let me know.
I do have that option turned on actually (without it, the image just completely goes haywire,) but unfortunately the stutter I mentioned is present either way. It's relatively subtle, but personally I believe it has to do with my TV deliberately dropping frames to keep pace with the GBA's 59.7Hz, so the only real fix would be to run at 60Hz I feel (like the GBA Consolizer does for example.)
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Ok I'll check over the weekend and make builds.
wondermagenta
Posts: 6
Joined: Thu Jul 08, 2021 9:49 am
Has thanked: 2 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by wondermagenta »

uberyoji wrote: Tue Sep 28, 2021 1:05 pm Ok I'll check over the weekend and make builds.
Just wanted to say thank you for looking into this, I know it's gonna be a big help for a ton of people.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Arg. I am a bit screwed. The timings are already tweaked on the pll component. I would need base timings to recalculate the ratios. Anyone knows the proper timings? Gameboy is quite far from the 96/48 baseline.

Currently this is what is set:
GBA
- 100.663296
- 50.331648

Gameboy
- 67.108864
- 33.554432
wondermagenta
Posts: 6
Joined: Thu Jul 08, 2021 9:49 am
Has thanked: 2 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by wondermagenta »

I'll try pinging Robert on Discord/Twitter.
FPGAzumSpass
Core Developer
Posts: 385
Joined: Sat May 23, 2020 12:55 pm
Has thanked: 42 times
Been thanked: 414 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by FPGAzumSpass »

For GBA:

base clock is 16.78Mhz.
Core is using 6x this clock, so 100.68 Mhz.
In total there are 280896 pixels (visible and blank), resulting in 59.73 Hz

So let's do the math other way around: 60hz * 280896 = 16.853760 mhz * 6 = 101.122560Mhz

You can probably round it a bit if the PLL cannot directly match it.


For Gameboy:
base clock is 4.194Mhz.
Core is using 8x this clock, so 33.552 Mhz. (core is actually using 33.56)
In total there are 70224 pixels (visible and blank), resulting in 59.72 Hz

So let's do the math other way around: 60hz * 70224 = 4.213440 mhz * 8 = 33.707520 Mhz
You also need to set SDRAM clock to 16 times clock: 4.213440 mhz * 16 = 67.415040 Mhz (currently 67.12)
Make sure both clocks are excatly 1:2 in ratio!


I hope i didn't miscalculate somewhere, that's why i kept the math here.

Have fun!
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Wow. By the man himself ;) thank you. I'll do the mods right away.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Updated the mega folder with 60hz gameboy and gba core test builds.
wondermagenta
Posts: 6
Joined: Thu Jul 08, 2021 9:49 am
Has thanked: 2 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by wondermagenta »

Amazing, thank you so much! (and Robert for providing the necessary math) I don't have access to my MiSTer at the moment but I should be able to report back by Tuesday at the latest.
User avatar
uberyoji
Posts: 48
Joined: Sun May 24, 2020 11:03 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by uberyoji »

Updated the latest neogeo core to 60hz. See mega folder.
User avatar
emmadness
Posts: 29
Joined: Sun May 24, 2020 6:48 pm
Location: Argentina
Been thanked: 1 time
Contact:

Re: Change core clock from 59.18 hz to 60 hz

Unread post by emmadness »

Thanks for the Toaplan "extras" I was looking for; It works like a charm.

Will you upload more stuff? Thank you in advance and a big greeting from Argentina!
User avatar
lufeig
Posts: 15
Joined: Sat Feb 12, 2022 3:29 am
Location: Brazil
Has thanked: 13 times
Been thanked: 6 times

Re: Change core clock from 59.18 hz to 60 hz

Unread post by lufeig »

Latest 20220212 core patched to 60Hz

https://mega.nz/file/qShQjAjD#5J6MJsUah ... TC_W1AVwgo
Post Reply