Welcome, Guest. Please login or register.

Author Topic: NTSC MiniMig  (Read 12402 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show only replies by alexh
    • 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 only replies by alexh
    • 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 jkonstan

  • Full Member
  • ***
  • Join Date: Dec 2005
  • Posts: 243
    • Show only replies by jkonstan
Re: NTSC MiniMig
« Reply #2 on: July 27, 2007, 03:08:30 PM »
Nice work Alex.

I looked at Spartan3 DCM on another project a few months ago.
It is pretty flexible. Since I am in the USA and have NTSC Amiga software, I look foward to getting an NTSC MiniMIG working ....


 :-)
 

Offline Hans_

Re: NTSC MiniMig
« Reply #3 on: July 27, 2007, 04:26:00 PM »
How did the later Amigas support both NTSC & PAL? It would be nice if both were supported within one unit.

Hans
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: NTSC MiniMig
« Reply #4 on: July 27, 2007, 04:30:51 PM »
Quote
How did the later Amigas support both NTSC & PAL?

Only the video output changes, so they don't actually support the other system 100%.

ECS added beamcon0 bit 5 to toggle between PAL and NTSC preprogrammed modes. See BEAMCON0 bit 5 (PAL).
 

Offline freqmax

  • Hero Member
  • *****
  • Join Date: Mar 2006
  • Posts: 2179
    • Show only replies by freqmax
Re: NTSC MiniMig
« Reply #5 on: July 27, 2007, 05:18:19 PM »
If the only physical change is to swap the crystal. Maybe a change should be incorperated such that both clock sources (pal=4.433619 ntsc=3.579545) are available to the fpga..?

That way changes between pal/ntsc is just software and no soldering iron fixing.

The clock circuit is quite simple:
IC8 74HC40670
C54 100nF
R55 1Mohm
R54 2.2kohm
C48 100pF
X1 Crystal 4.433619 or 3.579545 MHz
C47 22pF

Just duplicate it and wire up another pin on the fpga besides Pin 80.
It might also be useful if the MCU could provide the pcb version such that the verilog sources can reconfigured at runtime. (or some serial i2c-eeprom).
 

Offline amigadave

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Jul 2004
  • Posts: 3836
    • Show only replies by amigadave
    • http://www.EfficientByDesign.org
Re: NTSC MiniMig
« Reply #6 on: July 27, 2007, 05:53:54 PM »
Having Minimig PCB's manufactured to allow both PAL & NTSC with just a software switch would be best from the beginning and make them easier to sell worldwide.  I hope this is considered when redesigning for the first production run, which appears to have enough interest for 100+ units just from the replies here on Amiga.org.
How are you helping the Amiga community? :)
 

Offline narmi

  • Newbie
  • *
  • Join Date: Jul 2007
  • Posts: 38
    • Show only replies by narmi
Re: NTSC MiniMig
« Reply #7 on: July 27, 2007, 06:10:05 PM »
An NTSC/PAL switchable version would also provide the maximum compatibility with software, some of which is specifically targeted to one standard or the other.

A RGB to S-Video/composite encoder onboard could also be added, like the one I posted on the EAB.  It can do both NTSC and PAL. ;)
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show only replies by alexh
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #8 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 Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: NTSC MiniMig
« Reply #9 on: July 27, 2007, 06:22:48 PM »
@alexh

Actually, I'm pretty sure that "real" PAL machines when toggled to NTSC don't actually change the frequency of the CPU or CIAs. 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.

Clearly this is not the case.

Real NTSC machines run at slightly higher CPU and CIA clock, indeed, but IMO this is unrelated to the display mode (they will continue to run faster even when displaying PAL screen).
 

Offline freqmax

  • Hero Member
  • *****
  • Join Date: Mar 2006
  • Posts: 2179
    • Show only replies by freqmax
Re: NTSC MiniMig
« Reply #10 on: July 27, 2007, 06:23:47 PM »
What about this, let's have the S-video encoder pcb solder pads on the board. And those that want it can simply solder the circuits. The extra space should be neglible.

Alternativly if a breakout board is made for flatcable stuff. One can put it on the breakout board.

Hmm.. maybe DB23M can be recreated with pins and epoxy ;)
Just plug loose connectors to pins in an existing db23 and swipe with oil/grease. Then pour epoxy over it  :-)
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show only replies by alexh
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #11 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 Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: NTSC MiniMig
« Reply #12 on: July 27, 2007, 06:39:12 PM »
@alexh
Quote
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?

Yeah, that's it. It indeed happens because these routines are tied to vertical blank frequency (50Hz for PAL, 60Hz for NTSC). Player-routines which use CIA timers do not have this problem, they continue playback exactly the same speed, regardless of the screenmode.

Think about it, if CIA timers would change speed depending on the screenmode, the system clock would run too slow/fast, too, causing the clock to drift. That'd be unacceptable.
 

Offline persia

  • Hero Member
  • *****
  • Join Date: Sep 2006
  • Posts: 3753
    • Show only replies by persia
Re: NTSC MiniMig
« Reply #13 on: July 27, 2007, 06:40:57 PM »
Given that all televisions and monitors available nowadays are by default multisystem does this matter?  In the old days mutisystem tubes were complicated, but who needs (or wants) some boat anchor with a tube in it?
[SIGPIC][/SIGPIC]

What we\'re witnessing is the sad, lonely crowing of that last, doomed cock.
 

Offline alexhTopic starter

  • Hero Member
  • *****
  • Join Date: Apr 2005
  • Posts: 3644
    • Show only replies by alexh
    • http://thalion.atari.org
Re: NTSC MiniMig
« Reply #14 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.