Welcome, Guest. Please login or register.

Author Topic: NTSC MiniMig  (Read 12563 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
NTSC MiniMig
« on: July 27, 2007, 02:39:28 PM »
Even though I live in the UK and dont care about an NTSC MiniMig I thought that I would look into what would need to be done.

I have to say that I am not 100% upto speed on the guts of either the Amiga hardware OR MiniMig but I thought that I would have a go and perhaps Dennis would read and help correct a few things.

I think the first thing to do is to change the master clock (mclk) crystal from a 4.433619MHz PAL crystal to a 3.579545MHz NTSC one.

These crystals are standard very common, should be easy to source.

The next thing to do is change the FPGA DCM (Digital Clock Module) which is a feature of the FPGA which can create clocks with zero skew.

If you look in minimig1.v (the top level) you can see where the DCM is instantiated and thanks to Dennis's great comments you can see that all the clocks are derived from a 28MHz clock (c_28). The DCM generates this 28MHz clock by multiplying mclk by 32 and then dividing by 5.

Now that we've changed mclk to 3.579545MHz we need to change the DCM so that it generates it by multiplying by 8.

Nothing needs to change in the file minimig1.v except the comments

Code: [Select]

//Master clock generator for minimig
//This module generates all necessary clock from the 3.579545 NTSC clock
module clock_generator(mclk,c_28m,c_7m,cq_7m,e);
input mclk; //3.579545 MHz master oscillator input
output c_28m; //28.63636 MHz clock out
output c_7m; //7.15909  MHz clock out
output cq_7m; //7.15909  MHz qudrature clock out
output e;   //0.715909  MHz clock enable out

reg ic_14m; //14.31818 MHz intermediate frequency
reg ic_7m;
reg icq_7m;

reg [3:0]ediv; //used to generate e clock enable

// Instantiate the DCM module
// the DCM is configured to generator c_28m from mclk (multiply by 8)
clock_dcm dcm1(
    .CLKIN_IN(mclk),
    .RST_IN(1'b0),
    .CLKFX_OUT(c_28m),
    .CLKIN_IBUFG_OUT(),
    .LOCKED_OUT()
    );

//generator ic_14m
always @(posedge c_28m)
ic_14m<=~ic_14m;

//generate ic_7m
always @(posedge ic_14m)
ic_7m<=~ic_7m;

//generate icq_7m
always @(negedge ic_14m)
icq_7m<=ic_7m;

//generate e
always @(posedge c_7m)
if(e)
ediv<=9;
else
ediv<=ediv-1;
assign e=(ediv==4'b0000)?1:0;


//clock buffers
BUFG buf1 ( .I(ic_7m),
               .O(c_7m) );
BUFG buf2 ( .I(icq_7m),
               .O(cq_7m));

endmodule
[/font]

Next you have to change the DCM parameters to make it multiply by 8. The Xilinx FPGA Webpack has a GUI tool called Xilinx Architecture Wizard to do this but you can sort of get the idea if you look at the clock_dmc.v file.

You can see that you need to change the multiplier from 32 to 8 and the divider to 1. (Use the GUI in case other values need to change)

These changes alone are not be enough.

You need to change some constants (horbeam and verbeam comparisons) in agnus.v for NTSC timing. Perhaps some other register values also.

If you look in agnus.v for the module "beamcounter" this is where the constants are encoded.

Again Dennis's brilliant comments make it relatively easy to change the constants. Bear in mind when changing the constants that the clk frequency is no 7.15909MHz

I'll research the values and post the *suggested* changes here later.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #1 on: July 27, 2007, 02:49:59 PM »
The first thing is the SOF (Start of Frame) signals.

In PAL they are on lines 312 & 313, and in NTSC they are on 262 and 263.

So I think this change would be required.

Code: [Select]
//generate start of frame signal
always @(verbeam or lof or sol)
if((verbeam==261) && !lof && sol)//end of short frame
sof=1;
else if((verbeam==262) && lof && sol)//end of long frame
sof=1;
else
sof=0;
[/font]
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #2 on: July 27, 2007, 06:15:19 PM »
@narmi & amigadave

Wrong thread ;-) You need : http://www.amiga.org/forums/showthread.php?t=30516

Lets keep this thread a technical discussion about changes to MiniMig to support NTSC (refresh rates & timing).

Quote
Hans_ wrote:
How did the later Amigas support both NTSC & PAL?

I am not sure. I know that it was more than changing the video timing, when you select 60Hz (NTSC) the Amiga bus clock changes too. Very noticable as some music playback routines go faster etc. A trick in 3D games was to select NTSC to make them go faster. (Less area to render AND a faster albeit slightly CPU)

I need to do some more research about how the PAL Amiga generates it's clocks, I wonder if it had some DLL which allowed it to change clocks... if so that would be good for us to know which crystal and multiplier settings to use.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #3 on: July 27, 2007, 06:32:21 PM »
Quote

Piru wrote:
I'm pretty sure that "real" PAL machines when toggled to NTSC don't actually change the frequency of the CPU or CIAs.

No?

Quote
Think about it: You can toggle between PAL and NTSC realtime. If the full system clocking would change when you do, any running timers would run too fast or slow, depending on which screenmode is visible.

And I thought they did. Hence why the music (on some replay routines) is faster in NTSC than PAL.

However it may just be that they use the VBL interrupt to time music playback which will make the music faster?

I'd like to know for sure.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #4 on: July 27, 2007, 06:46:16 PM »
1) If MiniMig doesnt do NTSC timings, then it wont work on American TV's. This point is a little moot because V1.0 of the PCB has no video encoder only RGB output and with no RGB TV's in the USA it doesnt matter anyhow.

2) Most PC LCD monitors will not function below 56Hz which means unless the PAL version of MiniMig can be made to do 60Hz it wont work on PC VGA LCD monitors.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #5 on: October 30, 2007, 07:06:30 PM »
Quote

Piru wrote:
So does this mean I can remove the obviously wrong quote from alexh? (about system running at different speed when you toggle between PAL/NTSC display modes.. Amiga bus clock does NOT change, nor the CPU clock)

From what I can tell, and what Dennis has said yes. A PAL Amiga running in NTSC mode doesnt change the bus clock speed.

Quote
Some music players run at different speed because they're timed to the vertical blanking frequency, and not CIA timers (vertical blank rate is 50Hz for PAL and 60Hz for NTSC, CIA timer speed remains the same regardless of the display mode.

That's what I concluded. There are fewer lines and a faster frequency and hence a shorter VBL period.

Quote
PAL and NTSC systems do have different system base clocks and thus different CIA clocks. The system base clock - and thus the CIA base clock - do not change depending on the screenmode). The only speed gain in 3D games from NTSC is the smaller area to render.

Yes. I think a true NTSC Amiga will have a faster bus/CPU clock than it's PAL rival, but it is so small, would it have  made a difference? The Atari ST people always used to shout about their 8MHz vs our 7.09MHz (PAL)

Quote
Now that I think about it, what MiniMig probably wants is the full deal: Changing the base clock aswell (that is really change between PAL and NTSC, not just the display mode). However, this cannot be done runtime (restart is needed).

Maybe, but I would imagine an ECS PAL Amiga at 60Hz to be more compatible than an NTSC Amiga at 60Hz? But there may be nothing in it.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #6 on: November 02, 2007, 09:38:12 PM »
Another MiniMig thread clogged up with non-technical crap. :-(

Does anyone who needs NTSC / 60Hz have a working MiniMig?

Is anyone actually interested in working towards 60Hz capability? Actually getting into the verilog, Xilinx tools, boards and actually making it work?

It started out so promising and turned into useless drivel :-(
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #7 on: November 02, 2007, 10:54:14 PM »
Cool, post back when you've got it and I'll work with you to try and get the right crystals, the DCM and the mods to the Agnus
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #8 on: November 09, 2007, 08:13:47 PM »
Dennis wont need any of that junk.

Hardware reference manual, 20 minutes of verilog changes and FPGA recompilation, an NTSC crystal (or 20MHz + DCM change) is all he needs.

Anyone with a minimig, half a brain, and the will to do it, could have a go.

This thread was supposed to be a technical discussion of how to make the verilog changes, but it's now full of crap posts :-)

If you have a MiniMig, try to go back to the front of the thread, read about changing to the NTSC clock frequency.

Then read about changing crystal, DCM and line counters as described by myself and Dennis.

Recompile using the Xilinx toolkit and you should have a working NTSC system.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #9 on: November 09, 2007, 11:40:40 PM »
Quote

Crom00 wrote:
Is it possible to fab or mod a minimig with socketed crystal connector and ship the unit with 2 crystals, one for pal and once for NTSC?

I suppose you could, but if you used a 20MHz crystal, as suggested several times in this thread, all you do is change the FPGA image on the MMC.

Quote
Would like to ship a board that can do both ntsc. pal versions.

You're going to make and ship boards??

PAL version with ECS support (for 60Hz) would be good enough for most people, but that will require verilog changes and there seems to be no one with a MiniMig board interested in doing any serious work (Except Dennis and Tobias).
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #10 on: November 10, 2007, 10:29:26 AM »
He didnt change any MiniMig code, did he?

I think he just changed the PCB.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #11 on: November 10, 2007, 11:00:19 AM »
If he sends me a board, I'll teach him verilog ;-)
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #12 on: February 12, 2008, 03:08:34 PM »
In case anyone is still reading this thread (or any threads regarding a 60Hz capable MiniMig).

In addition to changing the crystal, reprogramming the DCM and changing the BEAM constants, you also have to change the AGNUS ID. This is in the VPOSR register.
Code: [Select]

//beamcounter read registers VPOSR and VHPOSR
always @(regaddressin or lof or verbeam or horbeam)
if(regaddressin[8:1]==VPOSR[8:1])
dataout[15:0]={lof,2'b0,1'b1,11'b0,verbeam[8]};
else if(regaddressin[8:1]==VHPOSR[8:1])
dataout[15:0]={verbeam[7:0],horbeam[8:1]};
else
dataout[15:0]=0;
[/font][/size]
I got the values for VPOSR from here:

http://www.winnicki.net/amiga/memmap/VPOSR.html
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #13 on: February 12, 2008, 04:45:19 PM »
Not sure I fully understand the subtleties but I dont think MiniMig (or any Amiga) suffers from "colour system" problems when not using RGB. I thought it only affected COMPOSITE or RF? Like I said I don't fully understand.

Quote
The problem is the scan rate and not the sync rate.

Nope the problem is the sync rate.

Quote
LCD TVs that are displaying PAL should do so at a sync of 50Hz

Yeah, but most LCD MONITORS have a minimum sync of 56Hz.

Quote
most of these only accept SCAN RATES starting at 30Khz. Not even DoublePAL or DoubleNTSC modes, that go at 28Khz, work on monitors of today. You connected it through RGB?

MiniMig has an "AMBER" scandoubler and produces 31KHz output.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show all replies
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #14 on: February 12, 2008, 05:38:01 PM »
Quote

JJ wrote:
But really do not think NSTC is the way to go.  Its a crap tv standard.  I don't even know how possible this, but wouldn't PAL-60 be a much better option ?

PAL-60 would require ECS AGNUS support which is a big job. Support for 60Hz is only one of lots of the changes between OCS and ECS ANGUS'. We're talking 100's of lines of code and many weeks of test. Going forward, that is the way to go, but not now.

Switching MiniMig from "PAL" to "NTSC" is perhaps 4-5 lines changed in Agnus.v (maybe more in the AMBER) and a different crystal.

MiniMig only outputs RGB, and it's scandoubled so it's not really NTSC (or PAL), is it?