Page 4 of 5
Re: Need Help with some UARTs
Posted: Fri Mar 10, 2023 10:55 am
by gfoot
So I think I may have noticed the issue here. The system comes up and runs, but when I tried plugging the serial cable into the 65C51 it refused to even boot. I started digging and the cheep bread board power supply I have is delivering 8.3V for some reason according to my meter. >_<
So, now to track down a better power supply.
Eek, is it one of the ones that plugs across the power rails and has a USB-A socket as well as a barrel jack? I've had the same thing, for a long time i was running my system at 7-8V as it appeared the voltage regulator had failed. At the time I thought it might have been due to me shorting it at some point, but it's hard to be sure when the system wasn't obviously broken afterwards.
Due to car battery issues in the past I had a device you plug in to the cigarette lighter socket with an LED display of the voltage it sees, which broke, but I took it to bits and rewired it to plug into the breadboard so now I have a permanent voltage display, which is good for peace of mind!
Re: Need Help with some UARTs
Posted: Mon Mar 13, 2023 6:39 pm
by Yuri
Okay,
Things are pretty stable. The only issue I've run into is that it seems that if I have the 65C51 hooked up to my PC in anyway, it prevents the 65C02 from starting. It works fine if I connect the PC after the 65C02 has had a chance to start.
I've tried using a DTECH USB to TTL serial converter cable as well as my Arduino Due as a dummy pass thru serial port, and both have the same issue. If they're plugged into the system before power on, the 65C02 won't start. I have to disconnect them and power the thing down (reset doesn't work) and then back up.
I've checked the power rails and they appear to be good. (The current power module is delivering 4.97V)
All other things being equal, the code is working fine and the system has been very stable with the replaced ICs and power module.
I've attached the current version of the circuit with my IO devices. I'm pretty sure I need to tie down some other lines on there before I move on.
Re: Need Help with some UARTs
Posted: Mon Mar 13, 2023 9:03 pm
by barnacle
A shot in the dark, but... is your interrupt routine in eeprom or does it vector through ram? I'm wondering if there may be stray characters in the 6551 input buffer causing an interrupt which isn't being handled correctly...
Neil
Re: Need Help with some UARTs
Posted: Mon Mar 13, 2023 9:33 pm
by Yuri
A shot in the dark, but... is your interrupt routine in eeprom or does it vector through ram? I'm wondering if there may be stray characters in the 6551 input buffer causing an interrupt which isn't being handled correctly...
Neil
A good question, and one I had considered myself after I adjusted my serial program to output what it was reading to the LCD instead of looping it back. I saw quite a number of garbage characters come up when I had the serial port plugged in.
On the other hand though, it seems to not matter much if it's the receive line or the transmit line that's plugged in that causes it. Additionally, I don't think it's the interrupt line, as the 65C51 isn't (yet) connected to the IRQ1 pin on my NAND gates; that gate is currently tied hard to ground while I debug this stuff.
Right now my current working theory is I have some sort of odd grounding issue? I'll double check but I think I was able to reproduce by simply connecting the lines from the PC to some pull up resistors.
Pulling Up/Down the lines on the 65C51 end didn't have an effect.
I think the oddest part is that it works if I power on the 6502 w/o the lines connected and then connect them. At which point it behaves completely as expected (at least until I power it off)
Re: Need Help with some UARTs
Posted: Tue May 30, 2023 7:54 am
by mark.williams
Perhaps your valid address decoding is allowing a clash on the data bus for when the UART is selected. I will have a look through your design and get back. Cheers Mark
Re: Need Help with some UARTs
Posted: Tue May 30, 2023 11:37 pm
by Yuri
Perhaps your valid address decoding is allowing a clash on the data bus for when the UART is selected. I will have a look through your design and get back. Cheers Mark
Always open to a critical eye to make sure I didn't make a mistake anywhere, though I think BDD got it right with my mixing of logic families. Moving to HC parts settled most everything out. As for the weird interrupt issues, that seems to have calmed down.
I did figure out that I needed a pull up resistor on the 65C02's INT pin despite driving it with an IC. This was some head scratching on my part as the 65C02 datasheet doesn't seem to mention the open-drain nature of this pin, but the 65C22 docs seemed to suggest you should be using IC gates to drive the pin now and not the wire or with a diode (for performance reasons). But the interrupts weren't working until I added a pull up resistor; so it would seem I still need to wire or the logic?
Would be nice to get confirmation on that before I add more devices to the mix. Or when I switch to TTL which would let me use the 16550 which I think would be a nicer UART to use.
*shrug*
Re: Need Help with some UARTs
Posted: Wed May 31, 2023 12:19 am
by floobydust
I'm quite late to the party here....
Looking at the recent schematic pics, it appears you are using the W65C22N part along with the WD65C51N. Both of those parts have open drain IRQ outputs. As such, both parts require a pull-up resistor +5V. If you delete the two 74HC00 gates feeding the IRQ pin of the W65C02, you can just connect both IRQ outputs from the 'C22 and 'C51 to the CPU IRQ pin and all should be fine.
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 5:01 am
by cjs
I don’t do GitHub. I can never make head or tails out of it. :D
The easiest way of handling this is to click the "Code" button/dropdown and choose the "Download ZIP" option; this will give you a ZIP file with the latest version of the code from the branch you're looking at. (The default branch you see when you go to the project, often called `master` or `main`, is usually the one you want.)
If you use Git, you can ignore all the GitHub functionality entirely and just clone the URL directly (
git clone https://github.com/vhelin/wla-dx), treating it like any other URL (GitHub, GitLab, static site, whatever) that provides a Git repo via HTTP. I mostly do this, though I do find the ability of GitHub/GitLab/etc. to let you link directly to a page showing a file fairly useful when I want to show someone a particular bit of code without making them download anything. (And the ZIP download option is of course also useful for those who don't use Git.)
It's worth remembering that GitHub is not Git, no more than your HTTP hosting service is Vim (or your editor of choice for HTML files). One of the reasons GitHub is so popular is that, if you use only Git and not the GitHub-specific features, it's trivial to put up a copy of your repo anywhere else if GitHub starts doing things you don't like. (And a lot of repos did quickly move from GitHub to GitLab when MS bought GitHub.)
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 8:26 am
by mark.williams
Perhaps your valid address decoding is allowing a clash on the data bus for when the UART is selected. I will have a look through your design and get back. Cheers Mark
Always open to a critical eye to make sure I didn't make a mistake anywhere, though I think BDD got it right with my mixing of logic families. Moving to HC parts settled most everything out. As for the weird interrupt issues, that seems to have calmed down.
I did figure out that I needed a pull up resistor on the 65C02's INT pin despite driving it with an IC. This was some head scratching on my part as the 65C02 datasheet doesn't seem to mention the open-drain nature of this pin, but the 65C22 docs seemed to suggest you should be using IC gates to drive the pin now and not the wire or with a diode (for performance reasons). But the interrupts weren't working until I added a pull up resistor; so it would seem I still need to wire or the logic?
Would be nice to get confirmation on that before I add more devices to the mix. Or when I switch to TTL which would let me use the 16550 which I think would be a nicer UART to use.
*shrug*
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 8:29 am
by mark.williams
The 6502 is meant to be pin compatible with the 6800. The IRQ on the 6800 is wired or to allow multiple devices to interrupt the processor. Hope this helps in the final revision. Mark
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 8:42 am
by rwiker
The 6502 is meant to be pin compatible with the 6800. The IRQ on the 6800 is wired or to allow multiple devices to interrupt the processor. Hope this helps in the final revision. Mark
6501, possibly?
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 12:40 pm
by cjs
Yes, the 6501 was designed to be pin-compatible with the 6800. That's long gone now, but it's fair to say that the 65xx series uses essentially the same bus protocol as Motorola's 8-bit processors, and so yes, the IRQ line is designed to be used with a pull-up and multiple devices with open-collector outputs.
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 1:29 pm
by mark.williams
Yes. I understabd the pin out changes that occured with the 6502 were to do with the clock circuitry and I assume the IRQ remained as wired or. NB The datasheets are silent on this

and (erroneously?) refer to them being driven by a std output.
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 1:51 pm
by cjs
Yes. I understabd the pin out changes that occured with the 6502 were to do with the clock circuitry...
Not just that, but also the removal of tri-state ability on the address bus. (In fact, both changes made also by Motorola a couple of years later with the 6802.) And maybe a few other things.
and I assume the IRQ remained as wired or.
The IRQ pin on the 6502 is not "wired-or" or not since it's an input. Any input can be used in a wired-or configuration or not, because that's about the configuration the outputs feeding it, not the input.
NB The datasheets are silent on this :-( and (erroneously?) refer to them being driven by a std output.
Well, I wouldn't expect that an input would mention whether you're to drive it with totem-pole or open-collector, since normally you can do both, but the
March 1980 datasheet even explicitly mentions open collector usage: "A 3KΩ external resistor should be used for proper wire-OR operation."
Re: Need Help with some UARTs
Posted: Mon Jun 12, 2023 5:22 pm
by BigDumbDinosaur
Yes. I understabd the pin out changes that occured with the 6502 were to do with the clock circuitry and I assume the IRQ remained as wired or. NB The datasheets are silent on this

and (erroneously?) refer to them being driven by a std output.
The primary reason the 6501 pinout was changed was Motorola sued MOS Technology for patent infringement and as part of the settlement, the latter agreed to change the 6501 so it couldn't be plugged into an MC6800 board. The result was the “lawsuit-compatible” 6502.
All members of the 6502 family have been designed to use a wired-OR interrupt circuit, excepting WDC’s 65C22S, which has a totem-pole IRQ output and hence can’t be wired-OR without the use of a blocking diode. A better implementation has the 65C22S driving one of the inputs of an AND gate, and another input of the same gate wired-OR to the other interrupting devices in the system. The gate’s output drives the IRQB pin on the MPU—no pullup resistor required.