6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue May 21, 2024 10:33 am

All times are UTC




Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Sun Jan 31, 2021 3:06 pm 
Offline

Joined: Thu Jan 28, 2021 10:24 am
Posts: 14
Location: Thailand
Just want to post an update because I ran into more problems that I could however solve meanwhile and maybe my solutions help someone else in the future.

After having the UART up and running I wrote some nice functions (and therefore used JRE PHA PLA instructions) to send and receive characters and things went completely mysterious again, echoing back random characters or just two characters instead of a much longer string. As soon as I stopped using anything stack related things worked again. In other words everything stopped working as soon as I started writing to the RAM. I suspected my address and \RD \WR decoding logic before so that's where I started to look for problems. While reading on the topic I stumbled across things like clock skew and logic timing related problems, especially in connection with PHO2.

Long story short replacing the 74HCT04 with a much slower but pin compatible CD40106 solved the problem and everything works just fine.

My theory here is that with the 74HCT04 \WR was probably pulled down way before the address I wanted to write to was stable.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 31, 2021 6:08 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
maewn21 wrote:
Long story short replacing the 74HCT04 with a much slower but pin compatible CD40106 solved the problem and everything works just fine.

My theory here is that with the 74HCT04 \WR was probably pulled down way before the address I wanted to write to was stable.

Your theory may be correct and if so, is telling you your glue logic design is incorrect. :D If you are using Ø2 to qualify chip selects, the UART will not have been selected at the time /WD (write data) goes low, this being due to the time required for the UART to respond to /CS (chip select) being asserted. This being the case. it's likely an internal violation of the UART's timing has occurred, resulting in a wrong register being briefly "touched."

Succinctly stated, the device—UART in this case—should be selected without reference to the state of Ø2. The 65C02 generates a valid address midway through Ø2 low. Glue logic should take advantage of that to maximize timing headroom. As a fairly general rule, the device's /CS should be asserted before /RD (read data) or /WD is asserted. Aside from guaranteeing the correct register has been selected before a read or write operation, following this rule may improve device performance in some cases, as many devices' response to /CS is slower than to /RD or /WD. In the case of E(E)PROMs, this difference may be considerable.

Note that the 65xx-compatible I/O devices—65C22, 65C51, etc.—must not have any aspect of their operation qualified by Ø2. As those devices have a dedicated Ø2 input, they will "know" about the 65C02 bus cycle and will not sample RWB until Ø2 goes high.

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


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 31, 2021 6:39 pm 
Offline

Joined: Thu Jan 28, 2021 10:24 am
Posts: 14
Location: Thailand
BigDumbDinosaur wrote:
maewn21 wrote:
Long story short replacing the 74HCT04 with a much slower but pin compatible CD40106 solved the problem and everything works just fine.

My theory here is that with the 74HCT04 \WR was probably pulled down way before the address I wanted to write to was stable.

Your theory may be correct and if so, is telling you your glue logic design is incorrect. :D If you are using Ø2 to qualify chip selects, the UART will not have been selected at the time /WD (write data) goes low, this being due to the time required for the UART to respond to /CS (chip select) being asserted. This being the case. it's likely an internal violation of the UART's timing has occurred, resulting in a wrong register being briefly "touched."

Succinctly stated, the device—UART in this case—should be selected without reference to the state of Ø2. The 65C02 generates a valid address midway through Ø2 low. Glue logic should take advantage of that to maximize timing headroom. As a fairly general rule, the device's /CS should be asserted before /RD (read data) or /WD is asserted. Aside from guaranteeing the correct register has been selected before a read or write operation, following this rule may improve device performance in some cases, as many devices' response to /CS is slower than to /RD or /WD. In the case of E(E)PROMs, this difference may be considerable.

Note that the 65xx-compatible I/O devices—65C22, 65C51, etc.—must not have any aspect of their operation qualified by Ø2. As those devices have a dedicated Ø2 input, they will "know" about the 65C02 bus cycle and will not sample RWB until Ø2 goes high.


Yes I did notice that 65xx-compatible I/O devices have a Ø2 input and don't need the kind of glue logic I'm using as I was looking on PET and C64 schematics to see how they do the \RD \WR logic. (which was somewhat disappointing since they don't have this kind of logic)

My \CS signals are not qualified by Ø2 as you can see in the schematic I've posted when I started this thread. The only things that I qualify by Ø2 are \RD \WR. Still looking at the timing diagrams in the 6502 datasheet I figured that Ø2 goes high long before anything on the data bus is valid and if I understand that right, this should'nt matter when reading from ROM but may write whatever is on the data bus into the RAM if it's fast enough. 15ns RAM in my case. (I may have actually mixed up data bus and address bus when posting my update, I didn't have the datasheet open at this time. Sorry for that)

I'm using an NMOS 6502 (just guess it's NMOS. it draws ~100mA, gets quite warm, it's sanded off and relabeled). Not sure if that makes any difference with the timing compared to the CMOS version.

About the UART, after fixing that timing problem I tried the UART chips that I declared dead and they still only send out gibberish. So them not working wasn't caused by the timing issue.


Anyways it's working now and I have adapted the Intel hex loader from the code section of the site to work with the 16550. So I can finally just copy paste hex files into putty instead of swapping the ROM all the time. I do however think about putting some jumpers on the now grounded and unused address lines of the ROM so I could easily switch between a few programs besides the hex loader. Some version of Basic comes to mind and maybe something to dump the RAM contents thru the serial port.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 31, 2021 7:09 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
maewn21 wrote:
I'm using an NMOS 6502 (just guess it's NMOS. it draws ~100mA, gets quite warm, it's sanded off and relabeled). Not sure if that makes any difference with the timing compared to the CMOS version.

I haven't looked at the NMOS data sheet in many years, so I can't comment about any timing variances vis a vis the CMOS hardware. However, I will note that the NMOS 6502's outputs only drive to TTL levels, and rather weakly, at that. This characteristic can, in conjunction with parasitic capacitance, mung up timing in often-bewildering ways. You really need to switch to the 65C02 or 65C816 and ditch the NMOS hardware.

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


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 31, 2021 7:26 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8442
Location: Southern California
I summarize the many differences between the NMOS 6502 and the CMOS at http://wilsonminesco.com/NMOS-CMOSdif/ .

_________________
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 Feb 01, 2021 1:30 am 
Offline

Joined: Thu Jan 28, 2021 10:24 am
Posts: 14
Location: Thailand
GARTHWILSON wrote:
I summarize the many differences between the NMOS 6502 and the CMOS at http://wilsonminesco.com/NMOS-CMOSdif/ .


That's a very interesting one. Thanks.


BigDumbDinosaur wrote:
maewn21 wrote:
I'm using an NMOS 6502 (just guess it's NMOS. it draws ~100mA, gets quite warm, it's sanded off and relabeled). Not sure if that makes any difference with the timing compared to the CMOS version.

I haven't looked at the NMOS data sheet in many years, so I can't comment about any timing variances vis a vis the CMOS hardware. However, I will note that the NMOS 6502's outputs only drive to TTL levels, and rather weakly, at that. This characteristic can, in conjunction with parasitic capacitance, mung up timing in often-bewildering ways. You really need to switch to the 65C02 or 65C816 and ditch the NMOS hardware.


I thought TTL levels should not be a problem with the 74HCT series. A W65C02 or W65C816 was what I actually wanted, however there is no local retailer selling any sort of 65xx IC's so all I am left with are eBay and similar sites and the NMOS are what I could get my hands on from there (of course I could keep buying until I'm lucky and get a CMOS one, or buy from a foreign retailer that ships worldwide and probably pay more for the postage as the chip itself costs). EDIT: Just checked at mouser, the shipping fee alone would be roughly 18 USD.


Would pull-up resistors 4k7 or 10k on data, address bus and all the other outputs actually do any good in terms of improving the signals?


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 01, 2021 6:52 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
maewn21 wrote:
I thought TTL levels should not be a problem with the 74HCT series.

They aren't a problem—if the signal seen at the input of the 74HCT device is a sharply-defined square wave. However, parasitic capacitance can slow the rise and fall times of a signal to where the transition from a logic 0 to logic 1, or vice versa, is too slow for the device receiving the signal. The rise time is particularly problematic with a weak TTL driver like the NMOS 6502, as it cannot pull up toward Vcc nearly as hard as it can pull down toward ground.

Quote:
A W65C02 or W65C816 was what I actually wanted, however there is no local retailer selling any sort of 65xx IC's...

If you add your location to your forum profile perhaps someone can advise you on where to get the genuine WDC products.

Quote:
...so all I am left with are eBay and similar sites...

You need to be very cautious about ordering a 65C02 from an eBay seller. If it is described as a WDC product the odds are you will receive a counterfeit part. Genuine WDC parts are sold only through authorized distributors. In particular, David Gray at WDC has emphatically stated that no one in China is an authorized distributor or reseller of WDC products. Please keep that in mind before you buy from an eBay reseller.

Quote:
Would pull-up resistors 4k7 or 10k on data, address bus and all the other outputs actually do any good in terms of improving the signals?

I doubt it.

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 01, 2021 10:50 am 
Offline

Joined: Thu Jan 28, 2021 10:24 am
Posts: 14
Location: Thailand
Quote:
If you add your location to your forum profile perhaps someone can advise you on where to get the genuine WDC products.


Done that. Let's see if someone knows.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2021 1:45 pm 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1394
Mouser in Thailand (Bangkok) seems to have genuine WDC products.
Mouser also has 16C550 UARTs in PLCC package (not in DIP package).

Digikey in Thailand seems to have genuine TL16C550BN (Texas Instruments) UARTs from Rochester Electronics in DIP package,
but it looks like TI isn't manufacturing the TL16C550 in DIP package anymore: if that stock is gone, it's gone.


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 03, 2021 3:04 am 
Offline

Joined: Thu Jan 28, 2021 10:24 am
Posts: 14
Location: Thailand
ttlworks wrote:
Mouser in Thailand (Bangkok) seems to have genuine WDC products.
Mouser also has 16C550 UARTs in PLCC package (not in DIP package).

Digikey in Thailand seems to have genuine TL16C550BN (Texas Instruments) UARTs from Rochester Electronics in DIP package,
but it looks like TI isn't manufacturing the TL16C550 in DIP package anymore: if that stock is gone, it's gone.


Thanks for your recommendations. The shipping price of ~18 USD (translated from 600 THB) I quoted before from was from Mouser Thailand branch, together with the long estimated delivery time of ~2 weeks my guess is they don't have a local stock of WDC parts.

I did not know about Digikey and had a look. However the minimum order amount for the UART's you linked to is 85 pieces which is far more than I likely ever need. Since I do electronics just as a Hobby.

By the way, I did know that TI does not manufacture 16C550 in DIP-40 packages anymore, I stumbled upon this fact as I was looking for a datasheet since the only one I could find for the Ei16C550 (the dead one) is not really detailed and even shows wrong pin outs. (shows pin 19=VSS instead of RD ,and pin 20=nothing instead of VSS for the DIP package which is obviously wrong but not important since both are connected to GND in my case anyways)

Does Digikey usually only sell larger quantities?


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 03, 2021 5:23 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
maewn21 wrote:
The shipping price of ~18 USD (translated from 600 THB) I quoted before from was from Mouser Thailand branch, together with the long estimated delivery time of ~2 weeks my guess is they don't have a local stock of WDC parts.

More likely than not, your order would be fulfilled from Mouser's US warehouse. That would explain the two week delivery time and 600 THB shipping cost.

Quote:
Does Digikey usually only sell larger quantities?

The reason for the minimum is that Digikey part is sourced from Rochester Electronics, an obsolete parts liquidator. In this instance, Digikey is acting as a reseller, not a distributor. All orders processed through Rochester incur relatively large minimums. Rochester is definitely not hobby-friendly.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 03, 2021 6:27 am 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1394
Sorry that:
From the Digikey page, to me it didn't come out clear that the TL16C550BN minimum quantity is 85 chips.

Mouser is the only distributor for WDC parts I was able to find in Thailand.

Hmm... when I had been into hobby electronics, availability of chips in DIP package became quite a topic, so at some point I had started to buy chips for 20 years in advance.
When I had stopped with hobby tinkering, I donated my collection of chips to a forum member...


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 05, 2021 1:37 am 
Offline

Joined: Thu Jan 28, 2021 10:24 am
Posts: 14
Location: Thailand
BigDumbDinosaur wrote:
The reason for the minimum is that Digikey part is sourced from Rochester Electronics, an obsolete parts liquidator. In this instance, Digikey is acting as a reseller, not a distributor. All orders processed through Rochester incur relatively large minimums. Rochester is definitely not hobby-friendly.


Quite interesting, good to know for the future. So Digikey might still be an option for other chips.

ttlworks wrote:
Sorry that:
From the Digikey page, to me it didn't come out clear that the TL16C550BN minimum quantity is 85 chips.

Mouser is the only distributor for WDC parts I was able to find in Thailand.

Hmm... when I had been into hobby electronics, availability of chips in DIP package became quite a topic, so at some point I had started to buy chips for 20 years in advance.
When I had stopped with hobby tinkering, I donated my collection of chips to a forum member...


Well I guess I am too late for that. Seems like I'm left 2 options. Either ordering a larger amount of 65C02 from Mouser to make it worth the shipping cost, or keep trying my luck with the likes of eBay where I probably could get at best a non WDC CMOS version. However since the NMOS chip I have is running for now and I am having fun learning the assembly with it I'll probably be happy for quite a while with the NMOS. Even tho I've stumbled already on some NMOS specific limitations like not having the Opcodes to push/pull X and Y.


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 05, 2021 6:48 am 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1394
There are Rockwell R65C02 chips at ebay, but wheter they are fully functional originals or not would be going to be a different topic.


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 05, 2021 11:02 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
maewn21 wrote:
Either ordering a larger amount of 65C02 from Mouser to make it worth the shipping cost, or keep trying my luck with the likes of eBay where I probably could get at best a non WDC CMOS version.

I will reiterate that you need to be very cautious about ordering a 65C02 from an eBay seller. Not knowing the true provenance of such parts, you could end up with a remarked NMOS device or worse yet, a defective one that causes damage to other parts of your machine. My recommendation is if you see any evidence of the seller being Chinese ("from China" on the auction page, for example) DO NOT BUY IT!

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


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

All times are UTC


Who is online

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