6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 1:35 am

All times are UTC




Post new topic Reply to topic  [ 193 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 13  Next
Author Message
PostPosted: Sun Feb 02, 2020 4:16 pm 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Chromatix wrote:
I think that would amplify the problem…


Wire Wrapping, or buffering PHI2 for the FFs?

Nah, I don't doubt the benefits of WW, and I can only say I'm amazed at some of the builds I've seen, but don't feel like mastering (well, at least trying) another technique right now. Besides, I've managed to get my hands on a nice stash of SMD parts, and the PCBs are dirt cheap.


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 06, 2020 11:08 am 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
And there it was... staring at me... all this time.... Dang!

download/file.php?id=9005&mode=view

Take a look at gate U14C, in the upper left corner... The timer should tick on the rising edge of PHI2 only if DECREMENT is high.

DECREMENT comes from the clock pipeline and is always 1 when counting PHI2 pulses, and it will be a single clock wide positive pulse when counting CNT, or TA underflows.

And sure, if DECREMENT is high, a rising edge on PHI2 makes the timers tick once... but it will do the same whenever DECREMENT goes high during high phase of PHI2.

So there it is, my extra count on CNT pulses, my extra count on one-shot mode, My (unnoticed) counting one cycle earler when setting START to 1. There is it probably the cause for 80% of the issues in the timers!

I'm going to try to generate a single pulse, on PHI2 rising edge, with 3 inverters+ an and gate, pretty standard stuff. PHI2 will be delayed by an aditional inverter that will clock the FFs in the clock pipeline, adding further delay to the DECREMENT signal. At least in theory, and using the Typical propagation delays in the datasheets, everything adds up. I get a ~18 ns pulse on PHI2 rising edge, that ends before DECREMENT goes high. Everything is pretty tight though... will need to run some tests before doing anything else.

Edit: A quick breadboard test I just did is extremely promising. Passing PHI2 through 3 inverters, and AND'ing it with itself gives me a ~20ns pulse (measured with a 20mhz not-very-precise oscilloscope). Pretty much in line with my estimation. That pulse is properly driving the '193 counters, and there seems to be a 40-50ns delay between PHI2 rising edge and the counter ticking. Half of this delay comes from the counter itself. I need to make sure DECREMENT won't rise within 30-35ns after PHI2 rising edge. For that, the DFF in the clock pipeline will be run with PHI2 delayed by 4 inverters. This, along the delay of the DFF itself feels like more than enough.

Also, with such a short pulse, I'm probably diving into some high-frequency zones. A clock with 40 ns cycle (20 high 20 low) is 25 MHz. The side effects I'm seeing because of this, is that the breadboard circuits works with decoupling caps only. Without them, I'm getting random unwanted ticks on the counter. Even with the caps, I'm getting quite a bit of ringing. I'm hoping for this to be exaggerated by the breadboard and for it to be less severe on a proper PCB.

Attachment:
phi2_pulses.PNG
phi2_pulses.PNG [ 24.24 KiB | Viewed 1563 times ]


As a personal note, this is probably the first time in this whole project I've had to look this deep into the propagation delay of a whole path... and I can feel something finally clicking into my brain about it! Still a long way to go of course, but it feels very good :)


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 16, 2020 11:03 am 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Hi all.

I need to hijack my own thread and go a little bit offtopic...

The project is still going on but, as probably all of you are aware, the coronavirus crisis has put pretty much everything on hold...

For those of you who don't know, I live in Madrid which, right after Italy, is currently the worst spread focus in Europe. Af of today, it's my 7th day quarantined at home. Luckily for me, I can work from home pretty much without issue, and life, more or less, keeps going on.

As my wife and I are working from home now, I've had to dismantle my "lab". Also, I have no less than 4 parcels with PCBs, components, and other stuff wandering around the world and who knows when,or if, they will arrive.

For all of you in affected areas, take care, extreme any hygiene measures, wash your hands often. For all of you in unaffected areas... apply the same measures, please.

Spanish public health services, although not perfect, are said to be amongst the best of the world, and here in Madrid, they're close to collapsing.

Take care everybody.


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 28, 2020 2:15 pm 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1431
Had some time at hands for drawing a "cheat sheet" for Dani's timer control logic.

Omitted the reset circuitry to make it more easy to read.
During reset, timer and timer latches are set to -1.

Attachment:
dani_timer.png
dani_timer.png [ 403.73 KiB | Viewed 1466 times ]


Sometimes it doesn't come out clear whether sontrol signals are HIGH or LOW active,
but considering it's a beginner project it doesn't look bad.

;---

A short overview about the clock dependencies.

Changed PHI2'''''' to PHI26 (PHI2 with six apostrophes).

Attachment:
dani_phi.png
dani_phi.png [ 78.5 KiB | Viewed 1466 times ]


Looking forward to see, how the adventure continues.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 10, 2020 3:33 pm 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
It's funny how I'm able to understand your schematics better than my own! That probably means I'm somehow putting together different pieces of a puzzle, while you're able to imprint some meaning in them. I like that.

Tomorrow will be my 60th day in quarantine. Oh my! And life still goes on. I now have a working SBC that can push the 74HCT6526 to, until now, unknown speeds.

So far I've only tested B0, and it is stable at 14Mhz. I can push the SBC a bit higher but the clock itself begins to fail just a bit after that, so that'll be my target for now.

I'm now building the second version of B1 (Timer B) that should fix all the issues detected on the first one. Next step after that, TOD, it's schematics are like 30% done so far. Only the actual clock is implemented, I'm still missing Alarm, and all the control logic. It feels nice to get back to "work"

Cheers!


Top
 Profile  
Reply with quote  
PostPosted: Tue May 26, 2020 8:12 am 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Quick update today.

Over the weekend, I've built the second version of B2/TimerA. (In some previous posts I said it was B1/TimerB, the one I had, but no... it's actually B2/TimerA!) and, even though full testing needs to be done, first tests look extremely promising.

None of the issues found on the previous version seem to be present. I still need to get the scope and logic analyzer to check for the tiny details, such as underflows, timer output and so on, but I'm very confident.

If I don't managed to find anything wrong.... this would be another great milestone, after such a long time. Fingers crossed!


Top
 Profile  
Reply with quote  
PostPosted: Sat May 30, 2020 10:53 am 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Hi all.

As I am expecting to complete timer tests within a couple of weeks, and, as I also have high hopes from what I am seeing this time, I decided to retrace my steps, back to the ports, before moving on with the next component, which would be ISR I think, as TOD and SDR are barely used on normal C64 operation.

As I have been pointed out several times, in several places, I have a big design flaw in my ports. They're not open collector, as I'm activelly pulling up the outputs. So far so good, this has worked for me (Being able to use a floppy drive with my ports whas a big milestone, quite a long time ago!) but, as I've been gaining more knowledge (ok, not a lot, but some :) ) I came to understand, this was a big flaw.

First alarms went of when I found some people talking about my work, in other forum, and mentioning "A killer poke" for my design. Pretty easy to see know... of course..

In a C64, ports are used to read the keyboard matrix, as you may know. Set both ports as outputs, pull one high, one low. Press a key, a Boom!. A short to ground. Yikes!

So yeah, I've been thinking of a couple of ways to amend this. @ttlworks suggested using some buffers ('125 or '126) with it's input tied to ground, that would be put in High-Z when the port had to output a 1, relying only on the external pullup to output a high value. So I went ahead, and layout a new board with this setup.

However, after further investigating... I made one (at least for me) big discovery. PortA and PortB are not the same. First clue was deeply hidden, in a readme.txt for a C64 emulator test suite. It's intented to be run on emulator to compare with the expected outputs and, when it comes to the ports. this is what I found:

Quote:
* Port A outputs high, Port B outputs (active) low.

- In this case port B always "wins" and drives port A low,
meaning both read back as 0.

* Port A outputs (active) low, Port B outputs high.

This case is a bit special and has some interesting properties:

- Usually (probably unexpectedly) port B will NOT be driven low by port A,
meaning port A reads back 0 and port B reads back 1.

- port B will be driven low (and then read back 0) only if the resistance of the
physical connection created over the keyboard matrix is low enough to allow
the required current. this is (again) usually not the case when pressing single
keys, instead -depending on the keyboard- pressing two or more keys of the same
column is required. a special case is the shift-lock key, which will also work
and which you can seperate from the normal left shift key in this configuration.


Second clue was found on an old scanned MOS6522 datasheet.
Attachment:
6522-03.gif
6522-03.gif [ 23.58 KiB | Viewed 1282 times ]


On the 6522, PortB schematic suggests it has a transistor to pull up stronger, together with a "normal" transistor acting as a pullup. This have to be the "Active and passive pull-ups" that are mentioned on the 6526 datasheet.

Third and last clue. Back in september, 2019, user fhw72 posted a die shot of a 6526. Even though I'm not able to read silicon in any way, there was something there, completely obvious.

Attachment:
ports.PNG
ports.PNG [ 649.34 KiB | Viewed 1282 times ]

I've taken a section where we can see PA7 and PB0 together. I've colored in light red the VCC metal, light yellow GND. In the VCC metal, nexts to all PB pins, there're plenty of vias, forming what I can only guess is the active pullup. They're not there in any of the PA pins.

To have additional information, today I've put one of my original CIAs under some stress with some very simple test.

Attachment:
test.png
test.png [ 906 Bytes | Viewed 1282 times ]


I've tried with different R5 values, from infinite (No resistor) to 0, (direct connection) and the results seem to prove all the above:

Code:
R5    PA0  PB0  vPA0 vPB0
inf   0    1    0.2  2.9
      1    0    2.6  0.2
100k  0    1    0.2  2.9
      1    0    2.6  0.2
3k    0    1    0.2  2.8
      1    0    2.3  0.3
1k    0    1    0.3  2.6
      1    0    1.9  0.3
10    0    1    1.1  1.3
      1    0    0.5  0.4
0     0    1    1.2  1.2
      1    0    0.5  0.5


I need to dig up my most basic electronics knowledge(Shame on me, yesterday I had to google Ohm's Law :shock: ), but I should be able to find some accurate values for the pull'ups of a rial CIA, and how to best mimick them on my design.


Top
 Profile  
Reply with quote  
PostPosted: Sat May 30, 2020 3:18 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Quote:
I've been thinking of a couple of ways to amend this. @ttlworks suggested using some buffers ('125 or '126) with it's input tied to ground, that would be put in High-Z when the port had to output a 1, relying only on the external pullup to output a high value. So I went ahead, and layout a new board with this setup.
'125 or '126 will work fine but they only offer 4 bits per package (14-pin). If you're interested in saving space (and if you're not already committed to your new layout) then you may wish to consider this bunch of options, which offer 6 bits in a 14-pin (Example: 74xx07), or even eight or nine bits in a 20-pin. :shock:

Nine wide Schmitt trigger buffer; open drain outputs

-- 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: Sat May 30, 2020 6:30 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Very nice, Jeff! You've had quite a few of these suggestions for off-the-beaten-path logic options! If you decide to round all these up and add more that you probably know of and haven't posted about yet, I will definitely bookmark the post for my own use, and probably add the link to my site to help others.

_________________
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: Sat May 30, 2020 7:11 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
The credit belongs to Digikey's product search function. THAT is what I suggest folks bookmark.

In this case I started with Product Index > Integrated Circuits (ICs).

From there I saw two possible paths for an open-drain device:

Product Index > Integrated Circuits (ICs) > Interface - Drivers, Receivers, Transceivers
and
Product Index > Integrated Circuits (ICs) > Logic - Buffers, Drivers, Receivers, Transceivers

It was in the latter category that I discovered the nine-wide Open-Drain Schmitt... which I had never heard of until today. :!:

First I had to click a lot of filters to rule out unsuitable parts, such as those that won't run on 5 volts. I admit the process is a bit finicky, and I sometimes have to backtrack. But it's amazing the stuff you find sometimes.

-- 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: Sat May 30, 2020 7:21 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Quote:
I admit the process is a bit finicky

which, I guess, is why I get so frustrated with it and get nowhere.

_________________
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: Sat May 30, 2020 7:29 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Yes it requires patience. But it gets easier with practice.

_________________
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: Sat May 30, 2020 10:12 pm 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Nice findings!

Board is not ordered yet, so it's open to changes. However, having 4 bits per IC, so 2 ICs per port, has the nice benefit of resulting in a very clear an nice layout. 6 gates per IC would mean sharing one of them amongst both ports. I'll save 1 IC, but the routing won't be so clean.

I may try with those 9 bits buffers. That could work. And yet, I have quite a stock of '126 laying around, so maybe it's not worth it in the end. I also have plenty of PCB real state available.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 07, 2020 10:16 am 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Last update on the timers, probably for quite a long time I'd say.

Another weekend spend on testing, and they now feel as good as I feel I can manage. All counting modes are OK (For TIMERA, reviewed version of TIMERB is not built yet). But it work.... except those moments when it doesn't.

I doesn't happen too often. Around once every 10.000 PHI2 cycles from what I can see. But sometime, the lower nibble of the timer goes haywire and does not count right. What I'm seeing are bits failing to flip. My best guess, the clock pulse to the counter is too short and it's messing with the internal flipflops.

I don't have equipment precise enough to look furter into this. I do have a 20Mhz oscilloscope that only registers the clock as a blip, and a 24mhz logic analizer that detects the pulse around 60% of the time. Until I can get hold of something more powerful... both timers will stay as they are right now.

So, after such a long time... work begins on the ISR. It will share board with the SDR too, (if they fit together, which I think they will). We'll see how this goes.

Cheers!


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 30, 2020 9:31 pm 
Offline

Joined: Fri Jan 25, 2019 2:29 pm
Posts: 192
Location: Madrid, Spain
Hi everybody! It's been quite a long time... as I expected.

Pretty much nothing has changed since my last post.... I still haven't "recovered" my lab, so any work with real hardware is still on hold.

However, for the last couple of weeks I've been getting up to speed again. It's amazing how much stuff just slips out of your head when you don't use it for some time. I've been re-learning some stuff, making sense of my old schematics... and looking for a way to progress with this project.

So far, I've been using Intel Quartus for my logic simulations. This is, of course, not its original purpose, so... well... overcomplicated for my needs, and, as I stepped further into the 6526, it became difficult to implement good tests, and this reflected on my work.

But, again, inspired by @Drass excellent work with the 100MHz TTL 6502, I decided to give Logisim a try. If you can properly create the 6502 there... a 6526 must be easy right?

Attachment:
logisim.png
logisim.png [ 38 KiB | Viewed 1018 times ]


Absolutely right. It took me only a weekend to get a handle on the Software, getting Drass CPU working, and implementing a very crude 6526 (Just DDRA and DDRB). But, amazingly, it is able to run some code, write values into the 6526, and read them back!

So I'm going to redo a big chunk of my work. Get some proper test suite running in Logisim. The circuit above replicates the most basic components of my SBC6526, which can now run with an original MOS6526, so I should be able to run the same code, both in logisim, both in real hardware. That for sure feels like a good starting point for a decent test suite!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 193 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 13  Next

All times are UTC


Who is online

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