6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 7:59 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sun May 23, 2021 1:11 pm 
Offline

Joined: Sun May 23, 2021 12:58 pm
Posts: 6
I try to create some kind of W65C02S based computer, and until now, it worked pretty well, but I ran into some snags now. I have no idea how to continue, so I'll just tell what I tried and perhaps somebody can give me some hints or tips.

The design is just the 6502, with 32kB RAM and 32 kB ROM, using A15 to select RAM or ROM. There is some glue logic currently (both 74HC and 74LS chips) for future I/I expansion on addresses 7ff8 to 7fff (the glue logic disables both RAM and ROM in that address range).

What I am experiencing now is that whenever there is a WRITE (e.g. to RAM), the databus completely fails, as if the 6502 cannot drive it. When measuring, I can see a noisy 1,8V instead of a clear 0 or 5. READs go fine. I have connected an Arduino to monitor the address and databus (and some control signals) and I can see the correct stuff passing by when single stepping.

I have no clue how to continue now, but some research gives me a few leads:

1. I somehow destroyed the 6502 and it is unable to drive the databus.
2. I am using incorrect glue logic, mixing LS and HC chips, even though the datasheets tell me they should all work on 5V.
3. Some wiring issue (obviously I looked, but haven't found anything yet)
4. Anything else?

Speed is not an issue as I am still single stepping the whole thing.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 1:31 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
1.8V level pretty much means you have a data contention. Please upload your schematic. Very unlikely you've damaged any parts.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 1:59 pm 
Offline

Joined: Sun May 23, 2021 12:58 pm
Posts: 6
When I measure now with a multimeter, I get 0.3-0.7V, not 1.8.

I did see the 1.8 earlier on an osscilloscope.

Attached my design.


Attachments:
File comment: The current design.
output.pdf [114.63 KiB]
Downloaded 61 times
Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 2:30 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
It's pretty complicated... Did you get a chance to look at Garth's 6502 primer?

I don't think that you qualify the memory write with PHI2... Or I didn't see it.

Seriously, consider replacing all your decoding logic with a single 74hc00. When you truly miss the 'wasted' 16K, you will probably be able to decode in a less convoluted way. It is rarely a good idea to make your life difficult today to prepare for 'the future' as you see it now.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 2:45 pm 
Offline

Joined: Sun May 23, 2021 12:58 pm
Posts: 6
Thanks, I haven't read the primer. Seems like a lot of information there. I'll have to study that.

I'll go a step back and make my design simpler.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 2:57 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
bartfriederichs wrote:
Thanks, I haven't read the primer. Seems like a lot of information there. I'll have to study that.

I'll go a step back and make my design simpler.

Definitely need to qualify chip selects with PHI2 high. I/O decoding is too complicated and slow, simplification is good for the first try.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 6:56 pm 
Offline

Joined: Sun May 23, 2021 12:58 pm
Posts: 6
What exactly do you mean with "qualify chip selects with PHI2 high"?

I am not a native speaker and haven't heard the term "qualify" in this context before.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 7:11 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
bartfriederichs wrote:
What exactly do you mean with "qualify chip selects with PHI2 high"?

I am not a native speaker and haven't heard the term "qualify" in this context before.


Chip select should not be asserted (going low) until Phi2 is high. This is because addresses may be changing while Phi2 is low. Addresses and controls are not guaranteed to be valid until Phi2 is high.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sun May 23, 2021 8:10 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
About chip selects and phase-2:
The key is that one way or another, you must keep the RAM from getting written to before phase 2 rises. Just using the R/W line is not enough, because the address is not guaranteed to be valid and stable before R/W goes down, let alone with some setup time. If you go only from the R/W line, you can write to unintended addresses, overwriting data that another part of the program still needs. Since modern RAM is often so fast (like 10ns, occasionally even faster), an easy way to solve the problem is simply not let its chip-enable line go true until phase 2 rises. For slower RAM, you may need to go ahead and enable it when the address lines say so, but don't let its write-enable line go true until phase 2 rises. (Note that the key here is address lines. The data won't be valid yet when phase 2 rises, but it will be valid before phase 2 falls, with plenty of setup time.)

ROM is usually much slower than RAM; and since you're not writing to it, it can be enabled according to the address, not waiting for phase 2.

Note that 65xx I/O ICs like the 6522 and 6551 require the chip-enable and register-select lines to be valid before phase 2 rises; so do not qualify their enable inputs with phase 2. ("Qualifying" means prohibiting the enable line from going true when phase 2 is low.)

About using 74LS:
Jeff has some good diagrams on voltage thresholds at viewtopic.php?f=4&t=6594, and more on page 3 of that topic. It's not about power-supply voltage, but rather signal voltages.

_________________
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: Mon May 24, 2021 6:32 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
plasmo wrote:
Definitely need to qualify chip selects with PHI2 high.

No, no, no!

Qualify write cycles with Ø2 high (also read cycles with the 65C816), not chip selects, but only for non-65xx peripherals. The 65c21, 65C22 and 65C51 need no qualification, and MUST be selected during Ø2 low.

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


Top
 Profile  
Reply with quote  
PostPosted: Mon May 24, 2021 3:32 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
plasmo wrote:
Definitely need to qualify chip selects with PHI2 high.
As BDD noted, this advice does not apply to 65xx peripheral chips (their chips selects must not be qualified with Phi2 high).

But your design has no 65xx peripheral chips, so the only sources of concern are the RAM and to the two '273 output ports. These all need to be protected from spurious writes during the Phi2-low period (during which addresses are in transition and can't be trusted).

For the RAM you need to ensure that either (or both) /CE and /WE are high during the Phi2-low period, as Garth said.

As for the two '273 output ports, only one is presently protected. I see Phi2 is included in the logic which drives one 273's clock input, but not the other.

Attached is simple solution that protects both. Variations are possible, but the main thing is that I've replaced your '137 with a '138, and Phi2 directly drives the 138's active-high Enable input, thus preventing spurious writes.

-- Jeff


Attachments:
W65C02S based computer .png
W65C02S based computer .png [ 44 KiB | Viewed 435 times ]

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

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