6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 16, 2024 2:10 pm

All times are UTC




Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Mon Apr 30, 2018 7:07 am 
Offline

Joined: Sun Jun 29, 2014 5:42 am
Posts: 352
I've just had a quick look at your schematic.

In my experience, RAM timing issues can cause some very weird failure modes.

As mentioned earlier by BDD, on the W65C02 it's recommended not to use Phi2O (pin 39), as Phi2 (pin 37) is the main timing reference.

By using PHI2O in your GAL to gate the RAM write-enable signal, the RAM write actually happens later than is ideal.

Edit: One other thing I spotted is that the RAM CS signal is tied low. Isn't the effect of this that I/O writes will also write to the RAM? This seems wrong.

Dave


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 7:55 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 173
Location: Sweden
hoglet wrote:
I've just had a quick look at your schematic.
Edit: One other thing I spotted is that the RAM CS signal is tied low. Isn't the effect of this that I/O writes will also write to the RAM? This seems wrong.


Yeah that's definitely not good. looking at his CUPL for the GAL you're right it'd be writing to RAM whenever writing to IO space

Code:
/* Intermediate values */
a = A15 & A14;
b = A10 & A11 & A12 & A13 & A14;


/* Output definitions */
RD = !RW;
RAM_WR = !(Phi2 & !RW);
RAM_CE = A15 # b;
ROM_CE = !A15;
IO_CE = A15 # !b;


Presumably you could modify the RAM_WR to assert only when the RAM is selected which would mean not having to solder on some bodge wires etc


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 8:04 am 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
Perhaps my eyes are ricking me - tracking R/W down it is grounded or say connected to p12 of the GAL. This could never work. I'm sure R/W is meant to be connected to p14 or p23 of that GAL - correct?

:)


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 8:11 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8491
Location: Midwestern USA
Could you please post a memory map for your machine?

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 11:13 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
hoglet wrote:
This related thread was also quite interesting. On an Acorn Atom the 60Hz VSYNC signal is asynchronous to the 6502 clock. It's possible to write a program that will fail after maybe an hour due to metastability propagating through the 8255 and on to the 6502.
http://www.stardot.org.uk/forums/viewto ... 9&p=200632

Indeed, that was extremely interesting: the 6502 was following an 'impossible' program flow, probably because the C bit being set by a ADC instruction was not happening, even when the top bit of the result was coming out right. As shown in your image, the data as seen by the 6502 was, sometimes, not even a valid digital level. The same thing could happen on-chip if setup times were violated, and possibly also for hold times. Many many instructions work perfectly, but one case didn't.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 1:52 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
hoglet wrote:
I've just had a quick look at your schematic.

In my experience, RAM timing issues can cause some very weird failure modes.

As mentioned earlier by BDD, on the W65C02 it's recommended not to use Phi2O (pin 39), as Phi2 (pin 37) is the main timing reference.

By using PHI2O in your GAL to gate the RAM write-enable signal, the RAM write actually happens later than is ideal.

Edit: One other thing I spotted is that the RAM CS signal is tied low. Isn't the effect of this that I/O writes will also write to the RAM? This seems wrong.

Dave


Phi-2 is now coming off the oscillator (pin 37)

It will write to RAM, but in an area that is not used (shadowed by the I/O).

I think we need to keep in mind this works just fine with an R65C02 or with an NMOS CPU. No issues at all. The problems are only seen with the WDC part.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 1:59 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
GaBuZoMeu wrote:
Perhaps my eyes are ricking me - tracking R/W down it is grounded or say connected to p12 of the GAL. This could never work. I'm sure R/W is meant to be connected to p14 or p23 of that GAL - correct?

:)

?

R/W from the cpu goes in to pin 11 of the GAL , Phi-2 in on pin 10 and the Phi-2 qualified R/W is output on pin 16.

Pins 13, 14 and 23 are unused inputs and are tied to ground.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 2:15 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
BigDumbDinosaur wrote:
Could you please post a memory map for your machine?


Simplified (hardware) memory map is:

0000 - 7BFF RAM
7C00 - 7FFF I/O
8000 - BFFF Bank switched ROM
C000 - FFFF ROM (ACIA monitor and EhBASIC)

Things done so far:

System Phi-2 now connected to pin 37 - pin 39 floating
NMI, IRQ and SO tied to Vcc, RDY and Reset held high trough 3K resistors
RAM /CE and /OE tied together (although this should not be needed).

Behavior has changed, but it's still not working with the WDC chip. Before, as I said I'd see toggling on the VP line before it went dead - so I presume there were glitches happening on the IRQ or NMI lines. Now there is only a single pulse in VP when reset occurs as it should be. There is no activity on the RDY line and it is no longer stopping dead. Instead it begins the memory test, runs for a few cycles and then goes back to the "Memory size ?" prompt. Entering anything there it will still just go back to that prompt. This behavior is consistent all the way out to 14mHz.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 2:28 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
Sorry for my last post. Seems that I was tricked somehow :oops:

I have not try to get the source fpr EhBasic, if it scans memory similar to M$Basic it might get puzzled by the I/O circuitry. Would it work if you simply enter a valid size?

Cheers


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 2:29 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
BillO wrote:
...There is no activity on the RDY line and it is no longer stopping dead. Instead it begins the memory test, runs for a few cycles and then goes back to the "Memory size ?" prompt. Entering anything there it will still just go back to that prompt. This behavior is consistent all the way out to 14mHz.


I suppose then that you see Sync is still active, throughout, as the machine hasn't crashed? It does sound rather like our problem. Perhaps, having now clocked everything with the same input clock, it's worth adding a buffer ahead of the CPU so it gets a very slightly delayed clock - the problem with the fast parts being that they are too fast.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 2:30 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
GaBuZoMeu wrote:
Sorry for my last post. Seems that I was tricked somehow :oops:

I have not try to get the source fpr EhBasic, if it scans memory similar to M$Basic it might get puzzled by the I/O circuitry. Would it work if you simply enter a valid size?

Cheers


No. Same exact behavior - unfortunately.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 2:39 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
BigEd wrote:
BillO wrote:
...There is no activity on the RDY line and it is no longer stopping dead. Instead it begins the memory test, runs for a few cycles and then goes back to the "Memory size ?" prompt. Entering anything there it will still just go back to that prompt. This behavior is consistent all the way out to 14mHz.


I suppose then that you see Sync is still active, throughout, as the machine hasn't crashed? It does sound rather like our problem. Perhaps, having now clocked everything with the same input clock, it's worth adding a buffer ahead of the CPU so it gets a very slightly delayed clock - the problem with the fast parts being that they are too fast.


Yes, SYNC is now active all the time. I could use the buffered Phi-2 signal I send out on the I/O bus for a quick test that woudl give me about 9 or 10 nS delay.

Interesting this is, just a while back as I was putting a 10x scope probe on the RDY signal, it started working fine as long as I had the probe on RDY. For a few minutes - now I can't reproduce the effect. This was before I had changed the resistor on RDY from 10K to 3K. However, at least now the machine is running and not dying. I feel progress has been made.

Update:
Holy cr#p! That worked!!! Delaying the clock to the W65C02 by a few nS has done the trick!!! It is now cruising along at a comfy 15mHz without a hiccup.

Awesome!

Thanks Ed - and to everyone else for pitching in on this one.

So it looks like these 15nS RAM chips are too fast?

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 4:45 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
First of all - congratulation!

Hmm, this is a bit puzzling - you now use the crystal clock directly for everything but the CPU and the CPU requires a brief delayed clock (say one or two buffer delays) ???

Indeed strange - and not very comfortable, as you cannot switch between various CPUs by simply plugging. Somehow unpleasant.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 4:50 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
That's a good result! I think - I hope - with a suitable diagram of the glue logic and the timing, it'll be more clear what went wrong. I suppose it could be that 15ns RAMs are not really compatible with the timing constraints of the CPU, but it could equally well be that reconfigured glue logic would sort the problem out more conventionally than a delayed CPU clock.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 30, 2018 5:50 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
BigEd wrote:
That's a good result! I think - I hope - with a suitable diagram of the glue logic and the timing, it'll be more clear what went wrong. I suppose it could be that 15ns RAMs are not really compatible with the timing constraints of the CPU, but it could equally well be that reconfigured glue logic would sort the problem out more conventionally than a delayed CPU clock.


The only glue logic between the CPU and memory is the GAL. The one in there now is rated at 15nS, but I do have one at 7nS that I could try.

Just as an aside, the bodged clock timing works with both the R65C02 and the NMOS 6502's at their rated speed.


Update: No, The 7nS GAL still needs the clock bodge.

_________________
Bill


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 15 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: