6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 7:53 pm

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed May 15, 2013 1:53 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
Looking through Garth's 6502 primer I found the hint, that several 6551 can be driven by one crystal by using the XTAL output of the first ACIA to drive the XTAL input of the next one.
So my idea was to drive also the Phi-0 input of the 6502 by that clock signal.

There could be different ways to clock the board:

For CMOS Chips:
Can I use a 5V 1.8432 MHz oscillator to drive the XTAL input of a 65C51 and and the Phi-0 of the 65C02? Or use a 3,6864 MHz oscillator with a Flip-Flop to generate a clean 1.8432 MHz square-wave with an accurate 50% duty-cycle?

For NMOS Chips:
Use the 1.8432 MHz crystal as clock-source for the 6551 and then use the XTAL2 (out) also as source for the 6502?

Sorry for that maybe stupid question, but my knowledge for this part of electronic is very poor.

Mario.

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 15, 2013 3:19 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
I don't think it's a good idea. For one thing, you'd be stuck with one Ø2 frequency. Also, if you decide to add a 6522 to the circuit your timer setups would be weird because of the 1.8432 MHz clock—you may find it impossible to achieve the desired timer rate because the timer setup values "fall in the cracks." Can oscillators are cheap and are made in even megahertz multiples, so I see no good reason to do what you are planning.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Wed May 15, 2013 3:37 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
OK, I already thought that this is not a "best practice" approach. It was more a "esoteric" question. Even if there are no good reason to do this, would it be possible only from a technical point of view?
So the Commodore 64 was running with 985248 Hz (PAL version) using a master clock with 17.734475 MHz (devided by 18 for the cpu clock), so they should had the same problem with proper timers. The frequency is closer to a plan 1MHz, but still there should be an incrementing difference.

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 15, 2013 3:59 pm 
Offline
User avatar

Joined: Mon Dec 08, 2008 6:32 pm
Posts: 143
Location: Brighton, England
If you are not bothered about running your CPU at 1.8432 MHz, this is certainly technically feasable and I see no reason why it should not work.

Years ago I modified an Acorn Atom to have a 1.78977 MHz clock for the CPU and apart from having a non-standard tape interface speed the system ran with no ill effects. Running the CPU at this speed allowed me to synchronise the CPU with the 6847 display chip and eliminate on-screen noise when the CPU accessed the video memory.

_________________
Shift to the left,
Shift to the right,
Mask in, Mask Out,
BYTE! BYTE! BYTE!


Top
 Profile  
Reply with quote  
PostPosted: Wed May 15, 2013 5:35 pm 
Offline

Joined: Sat Oct 20, 2012 8:41 pm
Posts: 87
Location: San Diego
mkl0815 wrote:
For CMOS Chips:
Can I use a 5V 1.8432 MHz oscillator to drive the XTAL input of a 65C51 and and the Phi-0 of the 65C02? Or use a 3,6864 MHz oscillator with a Flip-Flop to generate a clean 1.8432 MHz square-wave with an accurate 50% duty-cycle?


The oscillator output should drive both inputs but separate oscillators with sockets would be best. It would also be a good idea like you mentioned to use the flip-flop for the 65C02.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 15, 2013 6:19 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Where you have the two versions you label, "For CMOS Chips:" and "For NMOS Chips:", I can't think of any reason not to run both types the way you give under "For CMOS Chips:". For minimal systems, you could do that, but as others have said, setting up timers in the VIA might be easier to get the values you want if you run the processor at an even value like 2MHz or 4MHz. And actually, all the current-production parts can go much, much faster if the board construction is up to it, so having the duty cycle way off won't hurt anything at the speeds you're talking about. (This page of Jeff's shows the idea very well with repeating motion pictures of timing diagrams.) So if you wanted to just hang a crystal on the '51 and run the its crystal output to the phase-0 input of the processor, I don't anticipate any problem there either. Bare crystals are hardly any cheaper than complete crystal oscillators, so this would mainly be to save board space, not money.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 3:15 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
mkl0815 wrote:
So the Commodore 64 was running with 985248 Hz (PAL version) using a master clock with 17.734475 MHz (devided by 18 for the cpu clock), so they should had the same problem with proper timers. The frequency is closer to a plan 1MHz, but still there should be an incrementing difference.

True, timing was never an exact microsecond multiple with any of the eight bit Commodore computers. However, both the PAL and NTSC Ø2 clock frequencies were sufficiently close to 1 MHz to not be a significant problem in setting up the CIA timers—the margin of error with relatively long timing intervals was tolerable. This was fortunate, in that the fake RS-232 kernel routines were driven by CIA timer interrupts and would have caused errors if the Ø2 clock had been an odd value like 1.8432 MHZ.

What you are proposing would create a much larger discrepancy and would make 6522 timing more difficult. As Paul noted, it is technically feasible with the NMOS 6502, but I'm not so sure about that with the 65C02, whose Ø2 clock requirements demand an accurate 50 percent duty cycle. As I said, can oscillators are cheap, so why box yourself into a corner with the idiosyncratic arrangement you are describing? You won't get extra points for doing it the "goofy" way. :lol:

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 3:31 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
One other thing...the 6551's operation is slaved to the Ø2 clock, with the 1.8432 MHz clock being used only for baud rate generation. I think driving Ø0 of the 6502 from the XTAL2 output of the 6551 will cause obscure timing issues and might even cause internal errors in the 6551. I would expect that the XTAL2 output would slightly lag the 1.8432 MHz clock signal due to propagation delays within the 6551.

Speaking of timing matters, be aware that the 6551 (and the W65C51N) require that all chip selects be valid before the rise of Ø2. This timing requirement also applies to the 6520, 65(c)21 and 65(c)22. Please don't make the newbie mistake of qualifying chip selects with Ø2.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 5:10 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BDD wrote:
[the 65C02] Ø2 clock requirements demand an accurate 50 percent duty cycle
Yes or no, depending on the assumptions. There are specifications for clock pulse width low, clock pulse width high, and for the overall cycle time. If you need to operate the chip at its maximum frequency (shortest possible cycle time), the numbers usually are such that the low and high times will be equal, incidentally yielding 50% duty cycle. But AFAIK none of the 65xx processors -- NMOS or CMOS -- directly specifies what the duty cycle must be. IOW, if maximum operating frequency is not required then you have leeway to deviate from 50% -- perhaps very drastically. Garth touched on this point earlier, athough without elaboration:
GARTHWILSON wrote:
current-production parts can go much, much faster if the board construction is up to it, so having the duty cycle way off won't hurt anything at the speeds you're talking about
cheers,
Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 5:39 pm 
Offline
User avatar

Joined: Mon Dec 08, 2008 6:32 pm
Posts: 143
Location: Brighton, England
BigDumbDinosaur wrote:
One other thing...the 6551's operation is slaved to the Ø2 clock, with the 1.8432 MHz clock being used only for baud rate generation. I think driving Ø0 of the 6502 from the XTAL2 output of the 6551 will cause obscure timing issues and might even cause internal errors in the 6551. I would expect that the XTAL2 output would slightly lag the 1.8432 MHz clock signal due to propagation delays within the 6551.

I don't think this will cause a problem. The baud-rate clock can be driven from a seperate oscilator to phase-2 and not cause any problems, even when the two oscilators are not synchronised. With unsynchronised clocks, worst-case timing clashes are bound to occur sooner or later, and since the 6551 doesn't suffer from this problem, I think we can assume that there are no timing requirements between the baud-rate clock and the phase-2 clock. As long as the 6551's phase 2 input is connected to the 6502's phase 2 output, it should work.

Dr Jefyll wrote:
There are specifications for clock pulse width low, clock pulse width high, and for the overall cycle time. If you need to operate the chip at its maximum frequency (shortest possible cycle time), the numbers usually are such that the low and high times will be equal, incidentally yielding 50% duty cycle. But AFAIK none of the 65xx processors -- NMOS or CMOS -- directly specifies what the duty cycle must be. IOW, if maximum operating frequency is not required then you have leeway to deviate from 50% -- perhaps very drastically.

Very true. The Oric-1 computer used a 2MHz 6502 with a 1MHz clock with a 2-1 duty cycle. The video system performed 2 memory accesses when phase 2 was low, then the CPU had access to memory when phase 2 was high. This required a 2MHz 6502 and a 2MHz 6522 even though the clock frequency was 1MHz because the phase 2 high time - a third of a cycle - wasn't long enough for 1MHz devices, but it didn't cause any problems either with the CPU or the VIA.

_________________
Shift to the left,
Shift to the right,
Mask in, Mask Out,
BYTE! BYTE! BYTE!


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 7:37 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
Dr Jefyll wrote:
There are specifications for clock pulse width low, clock pulse width high, and for the overall cycle time. If you need to operate the chip at its maximum frequency (shortest possible cycle time), the numbers usually are such that the low and high times will be equal, incidentally yielding 50% duty cycle. But AFAIK none of the 65xx processors -- NMOS or CMOS -- directly specifies what the duty cycle must be. IOW, if maximum operating frequency is not required then you have leeway to deviate from 50% -- perhaps very drastically.

You could deviate from a 50 percent duty cycle, as long as you don't violate the minimum for each phase of the clock. If you examine the AC characteristics for the W65C02S, you'll see that tPWL and tPWL are the same value at any given clock rate (±1ns), and that the specified values are minimums. The only way in which you could implement a significantly asymmetric clock would be by slowing it down to avoid violating the minimum for one phase or the other.

PaulF wrote:
Very true. The Oric-1 computer used a 2MHz 6502 with a 1MHz clock with a 2-1 duty cycle. The video system performed 2 memory accesses when phase 2 was low, then the CPU had access to memory when phase 2 was high. This required a 2MHz 6502 and a 2MHz 6522 even though the clock frequency was 1MHz because the phase 2 high time - a third of a cycle - wasn't long enough for 1MHz devices, but it didn't cause any problems either with the CPU or the VIA.

That was all low speed NMOS stuff, which was actually quite tolerant of sloppy timing. To paraphrase a famous comment made about cost overruns in the U.S. space program, "A megahertz here and a megahertz there and before you know it, you're into some serious timing problems." As Garth pointed out, you can get away with murder at 1 Mhz, but not so much as the pace quickens.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 9:54 pm 
Offline

Joined: Sat Oct 20, 2012 8:41 pm
Posts: 87
Location: San Diego
I think it's always a good idea to start a micro processor project with a quality 'clockpulse' :) . It's one less thing to worry about if you do end up dealing with some other possible timing issues after constructing your project. The flip-flop output provides quality fast rise/fall times and a 'very' stable 50% duty cycle. A crystal (or other types) oscillator duty cycle may vary with temperature and time. Maybe not vary much but it could be at some point the deal breaker on a close timing sequence when accessing ram, rom or i/o when your dealing in ns timing.


Top
 Profile  
Reply with quote  
PostPosted: Thu May 16, 2013 10:23 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
The 65c02's phase-0 input is Schmitt-trigger, so what you feed it does not have to be very clean. If you use the RC clock option, the capacitor's charging and discharging keeps that input going through an analog range. We sold a lot of high-end intercoms that went into private aircraft, weather-research aircraft, and some non-combat military aircraft (like large transports) with a 2MHz Rockwell 65c02 controlling them and using the RC oscillator option at close to 1MHz. Duty cycle was something like 60-40. It was never a problem.

How you handle the clock signal (phase-2 out, in the case of the '02) to the rest of the system OTOH is a different story. Also, the 65816 requires a really clean clock signal since it does not pre-process it before sending it out to the rest of the system like the '02 does.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri May 17, 2013 7:47 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
[...]


Top
 Profile  
Reply with quote  
PostPosted: Fri May 17, 2013 5:55 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
GARTHWILSON wrote:
The 65c02's phase-0 input is Schmitt-trigger, so what you feed it does not have to be very clean. If you use the RC clock option, the capacitor's charging and discharging keeps that input going through an analog range. We sold a lot of high-end intercoms that went into private aircraft, weather-research aircraft, and some non-combat military aircraft (like large transports) with a 2MHz Rockwell 65c02 controlling them and using the RC oscillator option at close to 1MHz. Duty cycle was something like 60-40. It was never a problem.

"clockpulse's" comment about a quality clock pulse is good, though. A beginner doesn't want to accidentally introduce too many subtle variables that can sabotage the design before it even gets out of the gate, so to speak. An asymmetric clock is one of those variables that in itself might not cause trouble. When combined with marginal timing however...

Quote:
How you handle the clock signal (phase-2 out, in the case of the '02) to the rest of the system OTOH is a different story.

Note that the WDC 65C02 data sheet has something to say about that:

    3.8 Phase 2 In (PHI2), Phase 2 Out (PHI2O) and Phase 1 Out (PHI1O)
    Phase 2 In (PHI2) is the system clock input to the microprocessor internal clock. During the low power Standby Mode, PHI2 can be held in either high or low state to preserve the contents of internal registers since the microprocessor is a fully static design. The Phase 2 Out (PHI2O) signal is generated from PHI2. Phase 1 Out (PHI1O) is the inverted PHI2 signal. An external oscillator is recommended for driving PHI2 and used for the main system clock. All production test timing is based on PHI2. PHI2O and PHI1O were used in older systems for system timing and internal oscillators when an external crystal was used.

Emphasis added. Bottom line, as I said, is you won't get extra brownie points for using an idiosyncratic clock source. I would not use either of the 'C02's clock outputs in a new design, but that's just me being conservative.

Quote:
Also, the 65816 requires a really clean clock signal since it does not pre-process it before sending it out to the rest of the system like the '02 does.

This is a case where the clock oscillator should be run through a flip-flop and the flop's Q or /Q output used to drive PHI2 on the '816. Note that the '816 does not produce a PHI1O or PHI2O like the 'C02 does. If you need the equivalent of PHI1O and PHI2O in an '816 system, take one off of Q and the other off /Q. You'll have a two-phase, overlapping clock with very sharply defined edges and 50 percent duty cycle.

——————————————————————————————————————————————————————————————
EDIT: Fixed an egregious typo that would have confused someone not familiar with flip-flop outputs.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Thu May 30, 2013 6:04 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron