6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon May 06, 2024 1:10 pm

All times are UTC




Post new topic Reply to topic  [ 126 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next
Author Message
PostPosted: Tue Jun 14, 2022 12:29 pm 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
Sheep64 on Thu 26 May 2022 wrote:
There is a very minor error in the clock circuit which may cause very infrequent error. I have only learned this by reading all of Advanced FPGA Design by Steve Kilts.


On Fri 15 Jan 2021, I mentioned to jfoucher that I am unnerved about switching clock sources. You provide an example which feels intuitively correct. The best part is that it only switches after both clock sources go high - and, specifically, in the order where the slow clock goes high then the fast clock goes high. That means we never have to consider any other cases, such as clocks in a different phase or clocks going low. It is like a sychro-mesh gearbox for clock frequencies. If I never read Steve Kilts' book, I might have been very inclined to copy your circuit and wonder why I worried about the problem.

However, counter to my intuition, any signal crossing clock domains is potential error and should be checked more thoroughly. This is particularly true if multiple, asynchronous signals are involved. Multiple signals? This is the problem but it is quite minor and may resolve itself. In Speed Select, the Q and /Q outputs of SLOW section of 74HC112 connect to J and K inputs of FAST section of 74HC112. They are always intended to be opposites. Unfortunately, when FAST clocks high, they may be 00 or 11 rather than the intended 01 or 10 due to logic level asymmetry, capacitance, ringing or other cause. In this specific case, the output glitch causes a multiplexer to select one high input rather than the other high input. Therefore, this signal glitch is swallowed by all down-stream logic. Assuming that any latch oscillates or that J or K take precedence in a manner which is not deterministic, this possibly increases the minimum speed ratio between FAST and SLOW to a factor of four plus propagation delay. Maybe. Even with the restricted range of the crystal oscillator and frequency divider (as found in Episode 23! Out now!!! Don't miss it!!!!!), the minimum FAST frequency and the maximum SLOW frequency may be in a dubious range. Even here, you may switch between FAST and SLOW thousands of times without issue or have individual chips with fortunate properties.

This borderline case can be resolved by increasing the resistor or capacitor around 555 to reduce maximum speed of SLOW oscillator, further restricting range of the frequency divider or connecting spare section of 74HC112 to absorb glitchy output. The latter is the standard FPGA double flop technique. Indeed, see clock crossing, think double flop. This is the preferred technique because the second FAST flop is guaranteed to have the intended opposite inputs. Unfortunately, that might extend the minimum speed ratio between FAST and SLOW to a factor of six plus propagation delay. Maybe. To reduce the ratio, I considered connecting one of two 74HC112 FAST inputs to a clock further upstream of the symmetric 74x74 FAST clock. That may or may not do anything useful without creating further awkward cases.

Single stepping can be exempted from a double flop. Glitchy signals are guaranteed not to occur when single stepping because your finger will be on another button when selecting clock source. Pressing two buttons simultaneously is undefined behavoir.

Anyhow, it is easy to be an armchair critic and you have my sympathy that it has taken you two hours per day over one year to get to the fun stuff, like 6522 and keyboard firmware. It doesn't help that the 6502 Forum can be a very harsh audience.

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 06, 2022 11:25 pm 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Hey all, I'm back from holiday and a bout of covid. I'm slowly getting back into recording things, so you can expect the next video in a week or two. Spoiler alert: decided to pause new features and go for a 65C816 breakout board to clean up my breadboards.

Sheep64 wrote:
Sheep64 on Thu 26 May 2022 wrote:
There is a very minor error in the clock circuit which may cause very infrequent error. I have only learned this by reading all of Advanced FPGA Design by Steve Kilts.


On Fri 15 Jan 2021, I mentioned to jfoucher that I am unnerved about switching clock sources. You provide an example which feels intuitively correct. The best part is that it only switches after both clock sources go high - and, specifically, in the order where the slow clock goes high then the fast clock goes high. That means we never have to consider any other cases, such as clocks in a different phase or clocks going low. It is like a sychro-mesh gearbox for clock frequencies. If I never read Steve Kilts' book, I might have been very inclined to copy your circuit and wonder why I worried about the problem.

However, counter to my intuition, any signal crossing clock domains is potential error and should be checked more thoroughly. This is particularly true if multiple, asynchronous signals are involved. Multiple signals? This is the problem but it is quite minor and may resolve itself. In Speed Select, the Q and /Q outputs of SLOW section of 74HC112 connect to J and K inputs of FAST section of 74HC112. They are always intended to be opposites. Unfortunately, when FAST clocks high, they may be 00 or 11 rather than the intended 01 or 10 due to logic level asymmetry, capacitance, ringing or other cause. In this specific case, the output glitch causes a multiplexer to select one high input rather than the other high input. Therefore, this signal glitch is swallowed by all down-stream logic. Assuming that any latch oscillates or that J or K take precedence in a manner which is not deterministic, this possibly increases the minimum speed ratio between FAST and SLOW to a factor of four plus propagation delay. Maybe. Even with the restricted range of the crystal oscillator and frequency divider (as found in Episode 23! Out now!!! Don't miss it!!!!!), the minimum FAST frequency and the maximum SLOW frequency may be in a dubious range. Even here, you may switch between FAST and SLOW thousands of times without issue or have individual chips with fortunate properties.

This borderline case can be resolved by increasing the resistor or capacitor around 555 to reduce maximum speed of SLOW oscillator, further restricting range of the frequency divider or connecting spare section of 74HC112 to absorb glitchy output. The latter is the standard FPGA double flop technique. Indeed, see clock crossing, think double flop. This is the preferred technique because the second FAST flop is guaranteed to have the intended opposite inputs. Unfortunately, that might extend the minimum speed ratio between FAST and SLOW to a factor of six plus propagation delay. Maybe. To reduce the ratio, I considered connecting one of two 74HC112 FAST inputs to a clock further upstream of the symmetric 74x74 FAST clock. That may or may not do anything useful without creating further awkward cases.

Single stepping can be exempted from a double flop. Glitchy signals are guaranteed not to occur when single stepping because your finger will be on another button when selecting clock source. Pressing two buttons simultaneously is undefined behavoir.

Anyhow, it is easy to be an armchair critic and you have my sympathy that it has taken you two hours per day over one year to get to the fun stuff, like 6522 and keyboard firmware. It doesn't help that the 6502 Forum can be a very harsh audience.


That is really interesting stuff, I'm learning a lot thanks for sharing. I will give this a bit of a think.

I do have another design that depends on a 3-way latch going to the 3 select pins of an 8-bit multiplexer, but it does also include 2 flip flops per select bit. So it is maybe vulnerable to this as well, I'll have to check

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 06, 2022 11:30 pm 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Oh and also, I'm putting the backplane project on the backburner for now. I will use my breadboards as a backplane of sorts and do a horizontal build, kind of similar to James Sharman's build. I'm basically under the same constraint as him, namely that a backplane build is not very visual on video. Best to lay the circuits down so you can see everything in a top-down shot!
Then, once the design for v1 is completed, I'll reconsider the final form

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 07, 2022 8:13 am 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Attachment:
Screenshot 2022-07-07 at 10.05.38.png
Screenshot 2022-07-07 at 10.05.38.png [ 566.44 KiB | Viewed 3547 times ]


So this is what I came up with after reading the double-flop article this morning. Is this what you had in mind?

If SLOW and FAST have synchronized phases so that U5A is triggered too close to the falling edge of FAST, then the setup time of U5B is not met and it could go metastable. This is fine because it has up to the period of FAST minus the setup time of U7B to settle. Then, the next falling edge of FAST will correctly propagate the value to FAST_~SLOW. This adds one flip flop delay to determining the max frequency this can run at. However, that is fine because the limiting circuit is still PULSE_~RUN, so it does not change my max frequency.

One thing I'm unsure of is what happens if U5B starts changing while still in the hold time of U7B. Thankfully for this specific J-K flip flop the hold time is 0 so it shouldn't be a problem here.

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 07, 2022 12:38 pm 
Offline

Joined: Wed Jun 23, 2021 8:02 am
Posts: 165
I used a variation of Figure 3 on this page:

https://www.eetimes.com/techniques-to-m ... itch-free/

to do clock switching between a fixed 8MHz clock and a variable 8 to 50MHz clock for a 68000 board. It was implemented in an ATF1504 CPLD.
The circuit relies on both clocks running continuously - single pulses won't go through. If you want to use it for single stepping you will have to generate additional pulses on the SLOW clock when you switch from fast to single step.
If you only want it for single stepping rather than running from two completely different unsynchronized clocks there is probably a simpler way of (1) stopping the main clock and (2) allowing a single clock pulse through before stopping again.


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 01, 2022 8:26 am 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Long time no post! :mrgreen:

I just published a video adding the 6551 UART to the build, along with an MCP2221A for USB protocol conversion. I'm pretty happy with the result, especially since I found a through-hole USB chip, as it allows me to stay within my goal of no SMD components. Here is what the new UART section looks like:

Attachment:
65C816-Serial.pdf [71.56 KiB]
Downloaded 26 times


At the moment the code is still pretty inefficient, as I haven't implemented interrupt-based communication yet. That will come in a future video.

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 01, 2022 9:46 am 
Offline
User avatar

Joined: Mon Aug 30, 2021 11:52 am
Posts: 258
Location: South Africa
Nice! Your video almost inspired me to use a W65C51 as it feels more period appropriate than the TL16C752D I've got. But it's a bit expensive for what it it does and still has the hardware bug. And that issue is what prompted me to post - I was thinking surely WDC must have fixed the issue by now and browsing the data sheet doesn't mention any issues or errors...

Until I read a little more closely
Attachment:
W65C51 Status Register.png
W65C51 Status Register.png [ 119.94 KiB | Viewed 3424 times ]
Seems the data transmit empty register just does nothing now and that's officially the way it is.

I mean I get it from WDC's point of view. It must be a very low volume IC and I doubt it is profitable. There isn't even a LQFP version and I wonder if that means they only did a single run of the buggy versions and haven't sold that stock yet. Just idle wondering.


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 01, 2022 10:11 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Yes... the documentation has been changed to call it a feature versus the defect that it is. Sadly, I've got around 10 of each of the new featured parts... DIP and PLCC... and can't really use any of them, as I've no interest in programming around defective hardware.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 01, 2022 5:41 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8175
Location: Midwestern USA
akohlbecker wrote:
I'm pretty happy with the result, especially since I found a through-hole USB chip, as it allows me to stay within my goal of no SMD components.

You could have used a socketed PLCC44 version of the 816, stayed in the goal of no SMD, but at the same time, substantially reduce board space consumption.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 01, 2022 5:42 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8175
Location: Midwestern USA
floobydust wrote:
...I've no interest in programming around defective hardware.

Amen to that! Even without the TxD bug, the 6551 would still be a garbage design.

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 1:32 pm 
Offline

Joined: Wed Nov 04, 2015 11:10 am
Posts: 51
I am curious about the 65C816 data sheet, AC characteristics has a list of the max. clock speeds for different voltages. If I plan on running about 3.5 mhz, can I use the 4 mhz timings for that speed, even if I am using 5 volts?


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 1:44 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10799
Location: England
Depends what you mean on using the timings! If you're at 5 volts, the chip will respond in the number of nanoseconds it should, and if you need to make one signal arrive some number of nanoseconds before another, you should do that. The result should be a system which works up to the rated clock speed at 5 volts.

There's a real sense in which chips have no idea what frequency the system is operating at: all the important things happen in the time domain, not the frequency domain. Think about nanoseconds, instead of megahertz, and it might well all make more sense!


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 2:04 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
A0CBM wrote:
I am curious about the 65C816 data sheet, AC characteristics has a list of the max. clock speeds for different voltages. If I plan on running about 3.5 mhz, can I use the 4 mhz timings for that speed, even if I am using 5 volts?

Personally, at such low speeds I wouldn't really look that closely at the timings anyways. The general rule is that the combined delay of the decoding logic and memory/io (ie the time between latching the upper address bits to when your RAM/ROM is stable) shouldn't exceed half a clock cycle.
For 4MHz it's 125ns, remove 10ns just to be safe. And you got 115ns to play with, which is a pretty long time for basically any modern logic/memory chips.
To get the total delay of your system you can use the datasheets of all ICs you have in series, from the CPU to whatever endpoint device you have (like an EEPROM, UART, or an SRAM chip). Just add them up and see if that value is smaller than the 115ns mentioned above.

Atlwast that's how I design my systems. Others may do it differently


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 3:43 pm 
Offline
User avatar

Joined: Mon Aug 30, 2021 11:52 am
Posts: 258
Location: South Africa
A0CBM wrote:
I am curious about the 65C816 data sheet, AC characteristics has a list of the max. clock speeds for different voltages. If I plan on running about 3.5 mhz, can I use the 4 mhz timings for that speed, even if I am using 5 volts?
You can absolutely run the W65C816 at lower clock speeds than the maximums recommended by WDC at a given voltage.

But what BigEd and Proxy have mentioned is important. The clock speed basically doesn't matter* it is the rise, fall and delay time of the signals that you need to think about.

Attachment:
SDS00002.png
SDS00002.png [ 27.55 KiB | Viewed 3225 times ]
Above is a view of an '816 running at 5Hz (Hertz, not Megahertz) at 5V and even at that very low speed notice that once PHI2 (in yellow) falls the address lines (in green) are already set about 11ns later.

Attachment:
SDS00001.png
SDS00001.png [ 71.46 KiB | Viewed 3225 times ]
Whereas here the same program on the same '816 is running at 36MHz at 5V and you'll notice that the propagation delay from PHI2 falling to the address line being set is still 11ns. (The RWB signal is in cyan and pink is not connected.)

Interestingly the '816s response time barely changes until under 4.2V

* Well, I mean, obviously the clock speed does matter. Too fast and the '816 is still doing stuff internally when PHI2 rises on the second half of the cycle. And all your logic propagation timings must fit within your chosen clock.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 7:52 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8432
Location: Southern California
A0CBM wrote:
I am curious about the 65C816 data sheet, AC characteristics has a list of the max. clock speeds for different voltages. If I plan on running about 3.5 mhz, can I use the 4 mhz timings for that speed, even if I am using 5 volts?

The S in W65C816S stands for "static," meaning it will run down to DC, meaning you can even stop the clock and internal registers will keep their data and status.  You could run at one cycle every ten hours if you wanted to.  However, if you're running at 5V, use the 5V specifications, even at lower frequencies.  Do not use the 2.5V column just because it's rated for 4MHz.  At 5V, the timing margins will still meet the what's guaranteed in the 5V column.  BTW, do capitalize the M in MHz.  Lower-case m in numbers stands for "milli," ie, one one thousandth, whereas capital M stands for "mega," ie, one million (not one one millionth, which would be micro, represented by µ or u).  3.5mhz would be one cycle every 4 minutes and 46 seconds.

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 126 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 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: