Single 6522 for a few applications

Building your first 6502-based project? We'll help you get started here.
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Single 6522 for a few applications

Post by floobydust »

sburrow wrote:
Attached is a newer schematic. I was talking to BDD and he suggested starting with UART only first, and then work my way up.

I was using his schematic for his DUART alongside the datasheets and other things.

My memory map changed a tiny bit, it's now full 32K RAM, I moved the I/O addresses to overlap the ROM a bit now. The '688 makes it easy to do this though.

No 6522 VIA if you can see. Not that I do not plan on including it. This is just supposed to do ONE thing: terminal with Linux. From here, I will add on.

Thoughts?

Thank you all for your time and help on this!

Chad
A better plan, IMHO. Some things to think about:

1- No need to use a can oscillator for the UART. I've always used a simple crystal and a pair of 24pF caps attached directly to the X1/X2 pins (SCC2691 and SC28L92).
2- That's a pretty busy set of chips for glue logic. It can be simplified... Look here: https://sbc.rictor.org/sch2.html - 7400, 7430, 74138.
3- Consider the TI TL7705 Reset chip. A few more components to implement it, but you get both reset signals (active low and high) and can configure the delay time.
4- Using a MAX232 for voltage level conversion.. and having the same to attach to your computer seems like a lots of parts for no gain. Consider a FTDI USB-UART interface, much simpler.
5- Bypass caps... no such thing as too many (within reason). Also, 2-3 larger filter caps is a plus (I use a trio of 68uF caps on my Pocket SBC).
6- Add a LED indicator for power... just use one of the spare resistors in the resistor network to drive it.
7- Consider adding a polyfuse for safety, in case you accidentally short something... helps to keep the smoke inside the parts!
8- A power switch!

As you're using all DIP parts, you can start on a solderless breadboard and get things working. You'll also need a way to program the EPROM.

EDIT: no reason to use a toggle switch on the reset, just a momentary button switch (same for NMI).
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Single 6522 for a few applications

Post by sburrow »

GARTHWILSON wrote:
For debugging, I would be in favor of having at least something that can feed a beeper and/or LED as discussed in the debugging page of the 6502 primer at http://wilsonminesco.com/6502primer/debug.html
I seem to have missed that page along the way Garth! Thank you!

From the bottom of that page:

"It is common for the beginner to want all the fancy tools too soon, and these tools insulate him too much from really learning what goes on at the heart of the machine, giving him a disadvantage that takes much longer to overcome. A sure result down the road is more bugs, some of which he won't be aware of until after the bugs have been a secret cause of a lot of inconvenience, equipment damage, or worse. It's kind of like giving young kids a calculator to multiply and divide with before they really have an understanding of what these procedures even are. The appropriate thing is to get them well acquainted with, and practiced at, doing it with paper and pencil, before moving on."

Garth, excellent point yet again. Just a small story of how I got here to begin with:

Back some long months ago, I actually was wanting to make a VERY basic calculator from water pipes and stuff. I have worked with PVC in the past and figured I could somehow use water like electricity. Well, that changed pretty quickly. My next idea was to make a VERY basic computer/calculator from only 74' logic chips. I didn't look at any full examples or anything, I just started trying stuff on paper, and eventually came up with a 40 chip monstrosity, but I learned a whole lot. After calculating costs and complexity, I decided to start researching the 'dark arts' of microprocessors. Garth's pages eventually came up on DuckDuckGo searches, and now I'm here!

Moral of the story: I came here with lots and lots of 'from the ground up'. I went from zero to where I am now in only months. This is not for me to boast or something, but rather, demonstrating the way folks should learn (I am a math teacher by the way). Just like Garth said, don't start folks on calculators, start them on slide rules, or better yet, pencil and paper. [ Funny thing, NONE of my students know what a slide rule is! ]

Garth, I will be thinking heavily about this, it is a VERY excellent point. Not just the beepers and LED's, but also the ability to debug along the way somehow. Test the 6502, then plug in ROM, then plug in RAM, etc. Somehow, step by step debugging should be premeditated in the design. Especially for someone at my beginner level.

Thank you Garth, once again.

Chad
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Single 6522 for a few applications

Post by GARTHWILSON »

sburrow wrote:
[ Funny thing, NONE of my students know what a slide rule is! ]
http://wilsonminesco.com/SlideRules/SlideRules.html :D
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?
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Single 6522 for a few applications

Post by sburrow »

floobydust wrote:
A better plan, IMHO. Some things to think about:
1- No need to use a can oscillator for the UART. I've always used a simple crystal and a pair of 24pF caps attached directly to the X1/X2 pins (SCC2691 and SC28L92).
2- That's a pretty busy set of chips for glue logic. It can be simplified... Look here: https://sbc.rictor.org/sch2.html - 7400, 7430, 74138.
3- Consider the TI TL7705 Reset chip. A few more components to implement it, but you get both reset signals (active low and high) and can configure the delay time.
4- Using a MAX232 for voltage level conversion.. and having the same to attach to your computer seems like a lots of parts for no gain. Consider a FTDI USB-UART interface, much simpler.
5- Bypass caps... no such thing as too many (within reason). Also, 2-3 larger filter caps is a plus (I use a trio of 68uF caps on my Pocket SBC).
6- Add a LED indicator for power... just use one of the spare resistors in the resistor network to drive it.
7- Consider adding a polyfuse for safety, in case you accidentally short something... helps to keep the smoke inside the parts!
8- A power switch!
As you're using all DIP parts, you can start on a solderless breadboard and get things working. You'll also need a way to program the EPROM.
EDIT: no reason to use a toggle switch on the reset, just a momentary button switch (same for NMI).
Wow, awesome list! Thank you floobydust, or KM. I'm going to go line by line:
1) I suppose that makes sense. Is using a crystal instead of a can better because of space or power concerns?
2) Yes, I needed ONE too many NAND's... If I check out that TL7705 like you said, I can probably reduce that by one chip. Also, my 74'688 *basically* does the same as the 74'30, in effect. The 74'154 is a bigger version of the 74'138, but I had the spare addresses so I figured "why not?"
3) Neat! Good idea, that would save some glue logic too.
4) My USB-UART adapter is coming in the mail actually! BDD was suggesting to go with straight TIA-232, and I'd get a PCI card for my Linux box to help. I have not discarded the USB idea. Thank you.
5) I've seen like 10 of the things put together in a network. Haha! Ok, if you say so.
6) Yes, that's a good idea, and semi-parallel's Garth's debugging concerns.
7) I just learned what a polyfuse is, and yes that makes sense. I have been thinking of using a 5.1V zener diode near the power supply, would that do any good?
8 ) What's wrong with just powering on from plugging it in? i.e. the ZX80. Yes, of course, that is a good idea, thank you!
9) So my thoughts on the reset switch is that I can just keep it on reset while I, well, do whatever I want. If it's a button I have to hold it down, but a switch I can walk away for a minute and make a sandwich. Any particular reason I shouldn't make sandwiches?

The breadboard is in my future for sure. I have one, and will get a second one. Already have been testing a few chips together here and there with it.

As far as the EEPROM, I was thinking of using my Raspberry Pi GPIO pins, some basic Python, and a spare 12V power supply. If I was reading the datasheet correctly (on the EEPROMs), I apply 12V to the VCC (specifically to erase), and then go about my business writing with TTL levels. Maybe I didn't read that correctly? I also believe it's different from EPROM where I have to apply 12V somewhere else, thus not as easy? Confirm with me on this if you can, I'd like to not spend a ton more money on an EPROM programmer if I can.

Thank you again KM, this is excellent advice!
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Single 6522 for a few applications

Post by floobydust »

Well, it's your choice on how you want to proceed forward. Again, the premise being less is more for an initial project.

A few additional comments:
- There's no reason to hold the CPU in Reset mode and make a sandwich... just turn it off if you don't want it to be running.
- Zener diode... classic way to clamp the power supply voltage, but then you need to manage the current shunt. A polyfuse works well for this.
- Crystal vs oscillator. Both work, I just prefer the crystal with the UARTs I'm using. A bit less PCB space and no additional current to run the oscillator.

Programming the 28C256. Do NOT shove 12V into this chip, you'll fry it!. The 28C256 is programmed at standard operating voltages. In fact, you can write to it insitu with a simple software routine (my Monitor supports this). I first programmed a 28C256 by accessing it from a Vic-20 with an I/O board I built back in the 80's. It's pretty simple overall. So yes, go back and read the datasheet again.

Getting a decent programmer is a good idea if you plan on continuing going down the path to building up some small systems like this. Acquire and justify these purchases as you get further down the road and more into moving to the next project. Baby steps first... and keep your costs down. However, trying to build your tools at the same time can be difficult. Think about it... if you build a tool to program the 28C256 and it doesn't work properly, how do you know if your EEPROM isn't right or your initial hardware isn't working??
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: Single 6522 for a few applications

Post by Michael »

Chad (and gang):

I'm a proponent for using Flash ROMs instead of EEPROMs. The 128K 39SF010A in DIP-32 package is $1.52 at Mouser while a new 32K AT28C256 (DIP-28) costs more than $11. Both types are relatively easy to program. I use an Arduino Uno R3 and a DIY programming shield to program the SST 39SF series Flash ROMs as well as 28C256 EEPROMs (see below).

I would also recommend using 64K or 128K RAM chips in new designs. The extra active high chip enable pin often comes in handy. I'm necessarily frugal and have paid as little as 52¢ a piece (including shipping) for a handful of skinny W24512AK-15 chips and as much as 75¢ a piece (including shipping) for wide HM628128ALP-70 chips from Chinese vendors these last few years. Prices for new 32K or 128K RAM chips are very close (32K AS6C62256 $4.03, 128K AS6C1008 $3.91 @ Mouser, not including shipping).

Squeezing a design to fit on a 4"x4" PCB can be a challenge. Placing smaller chips beneath larger chips in the open space inside a machined pin socket may be an option (see below).

Good luck on your project.

Cheerful regards, Mike, K8LH
Attachments
1802 4-chip build #1.jpg
Flash Programmer PCB 2.png
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: Single 6522 for a few applications

Post by Michael »

Chad.

Is your decoder logic correct? Don't you want an active low ROM select when both A15 and P=Q are high? If so you can free up the gate that you're using to invert the P=Q signal and use that gate instead for the positive reset gate...
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Single 6522 for a few applications

Post by sburrow »

floobydust wrote:
- There's no reason to hold the CPU in Reset mode and make a sandwich... just turn it off if you don't want it to be running.
- Zener diode... classic way to clamp the power supply voltage, but then you need to manage the current shunt. A polyfuse works well for this.
- Crystal vs oscillator. Both work, I just prefer the crystal with the UARTs I'm using. A bit less PCB space and no additional current to run the oscillator.
- Do NOT shove 12V into this chip, you'll fry it!.
Great mentions here.

1) Ok, if I have an on/off switch, then that replaces the need of what I had. Makes sense, thank you.
2) AH! Now I'm understanding the difference, great!
3) Sounds good.
4) I went back to the datasheet. There is an OPTIONAL erase mode using 12V, but other than that, yes, just regular TTL will work.

As far as getting a programmer, and knowing if I have the right data on there or not, good point. Things on my Christmas list: analog oscillator and EPROM programmer.

Thank you for the corrections!
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Single 6522 for a few applications

Post by sburrow »

Michael wrote:
The 128K 39SF010A in DIP-32 package is $1.52 at Mouser while a new 32K AT28C256 (DIP-28) costs more than $11. Both types are relatively easy to program.
Mike, thank you once again.

This is news to me! Flash ROM?? I mean, of course I've heard of it, but perhaps I didn't know parallel 8x versions existed? Yes MUCH cheaper, AND it does seems super easy to program, especially given a Pi/Arduino. So... why are the big EEPROM's even a thing? It seems like a perfect replacement, thank you.
Michael wrote:
I would also recommend using 64K or 128K RAM chips in new designs. The extra active high chip enable pin often comes in handy.
As far as RAM goes, the only way I could logically see using the entirety of one of those is by using bank switching, which needs some type of external latch or I'd have to be able to write to the ROM temporarily. See, the 128K ROM makes sense because I can just put in some jumpers onboard and so theoretically have different "programs" or "bios". I do like the idea though, a lot, and will be thinking about it. In the least, I could change my memory map some, and probably get that 48K RAM I've been wanting.

Chips under chips?! Garth has some pages about soldering chips to one another even, fancy stuff!

Lastly, for the smaller post about the logic:

P=Q comes out low when they are equal, low enable for I/O space. I invert that to make it high temporarily. Then I NAND it with the A15 which is also high at that point. High NAND High = Low. That runs into the ROM. So yes you are correct, when they are both high I want it low. The only problem was that P=Q comes out low.

EDIT: I went back and rethought my logic some. For ROM I need A15 high and I/O enable high (as in, not enabled). Ok, I think that's right? Thank you again.

Also Michael, I'm now reconsidering that FT245RL you suggested. Drop-in, ready for MPU action! This would simplify a lot. Thank you for that again.

Chad
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Single 6522 for a few applications

Post by sburrow »

I guess I have more time on Saturday mornings. It's actually kind of cold here in Texas today!

Anyways. Attached is the PDF of some updates.

Big changes:

1) I changed the 28C256 EEPROM to the 39SF010 Flash ROM, with bank switching onboard.
2) Added power switch, changed reset to button, kept the DS1813's, added power LED, replace extra can with a crystal.
3) Put in single-cycle feature with a SPDT button, using some left over NAND's to debounce.
4) LED's on data bus and a beeper at $80FF (Idk if I put it in correctly, it's a first for me.)
5) Theoretical replacement areas if using FT232 or FT245 USB boards.

Thank you all so much for your help on this. So much learning going on here! I love it!

Chad
Attachments
OnlyTIA232-2.pdf
(180.05 KiB) Downloaded 66 times
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Single 6522 for a few applications

Post by floobydust »

So much for keeping it simple....

I think you need to take a few steps back. It appears that you're just dropping stuff in, stringing wires around and not actually understanding how things work or just making mistakes and never checking. A couple examples:

1- Power LED... look at what you're doing. +5 volts into the LED on one end, with the other connected to the resistor network that's also connected to +5 volts. How does that work?
2- Using a Zener and Polyfuse.... you should bring +5 volts thru the polyfuse. The out from the polyfuse goes to the zener. The +5 to drive your circuit would be from the zener end. Again, look more closely at what you're doing.

Beyond this, having LEDs on the databus is of little value, same for a speaker on an address line. Adding single step... is this really thought thru? A side note: I (and likely others) find it confusing to use logic chips as shown. It's much easier to visualize logic when using gates and inverters in schematic form. Again, I think less is more for a first project. A simple UART setup and minimal circuitry to make it all go.

It's also handy to have some parts on hand.... gates, inverters, decoders, caps, LEDs, etc.
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: Single 6522 for a few applications

Post by Michael »

The /RAM, /ROM, /IO select logic still doesn't look right. Shouldn't it be something like this?
Attachments
temp1.png
Last edited by Michael on Sat Oct 16, 2021 11:36 pm, edited 2 times in total.
sburrow
Posts: 833
Joined: 09 Oct 2021
Location: Texas

Re: Single 6522 for a few applications

Post by sburrow »

floobydust wrote:
So much for keeping it simple....
You are exactly right. And you are right about my mess up's. I don't know exactly what I'm doing with a lot of these things.

Before I came here, I had to figure them out on my own. If I didn't understand something, I either spent a LOT of time researching, or I just tossed the idea. And I did mess up a lot! And that was ok!

Here now, my mess up's are before the pro's to see. So indeed, much more helpful, but also harder.

So, thank you for pointing those out to me floobydust, and everyone.

Michael, I am *sure* that's my ROM select arrangement. Surely that's what I was thinking in my mind at least. You are definitely correct on that diagram.

Just a side note: I feel like I get pulled in different ways. Y'all are all pro's at this, and I'm beginning. So when someone says "add this" or "change this" I trust that that is good. Not that it's not! But feature creep sets in. Michael suggested Flash ROM, and I LOVE the idea, but now that alters how I'm going to program the darned thing. Garth suggests a beeper, yet I don't know the darned thing about a beeper but I try. I never had a power LED, or a switch for that matter, I just always "plugged it in and it'll run", thus my switch on the reset vs a button. My mind has been working differently for a while, and so when I'm shifting gears into new territory, even if it's simple, I am prone to mistakes (the power LED was a pretty stupid one of mine, I admit).

My future plans? I am going to take a step back. A few steps back actually. I need to do some breadboard testing for now, I got some parts coming in, and I need to discover how they work. I'll keep y'all posted, thank you again for your help on this. I really appreciate you all very much.

Chad
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: Single 6522 for a few applications

Post by plasmo »

You are doing fine. You have great motivation and communication skills, so the technical knowledge will come soon enough. Career in electronics is one continuous on-the-job training for everyone.

You've got plenty of advices, so you don't need another voice from me. However, I would encourage you to go forward with prototyping and PC board fabrication. There are plenty of challenges ahead so dive in and bring the lesson-learned back to the design process in next iteration.
Bill
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Single 6522 for a few applications

Post by floobydust »

I agree with Plasmo, you're making progress... but it's all a learning curve. Everyone will make some suggestions, that doesn't mean you need to implement every one. I still think keeping simple is the right way to go... one I/O device (UART) and that can keep you busy getting it to work.

I'll offer this schematic. It's a very simple circuit, based on my C02 Pocket SBC, sans the PLD, expansion connector and some other caps, etc. not needed. There's one I/O select driving the UART.
65C02_UART.png
Just follow the overall design piece by piece, hopefully it's logical to you. The I/O select is at $FE00, and is 256 bytes wide, with 32KB RAM from $0000-$7FFF and EEPROM from $8000-$FFFF (sans $FE00-$FEFF). All of the caps are grouped together, basically a 0.1uF for every device, along with a couple larger filter caps.

You don't have to build it, but at least it's a simple system that will work. Have fun ;-)
Post Reply