Serial Port Design for Z80 - Questions

Greetings!

I wanted to add a serial port to my 1981 Gorf arcade machine. Since it is really just a specialized Z80 computer, I was just going to tap the signals from the Z80 pins and create a small sub-board with a UART. I haven't really got this working yet and was since I have virtually zero experience with any hardware design, thought I might beg a question or two.

First, you can see the schematic and other info here:

formatting link
(or:
formatting link
)

First, was there a better UART that I could have chosen? The 16C550 seems to have been around for quite awhile. I am looking for mainly availability and simplicity rather than cost or other factors.

Second, I have to tap all the signals from the bottom of a card cage by running individual wires to my board. I currently have this hard wired which is a pain for debugging purposes. I need a connector system that takes these individual wires and turns it into some kind of plug that could go into a socket. I'm not too great with finding what is out there. Can someone make a suggestion on what to use to do this? There are 20 signal connections that need to be made on the current design.

Third, I know I am a total newb with design and prototyping. If you see obvious errors with my design or implementation, please feel free to let me know. Please be kind though, I bruise easily... :-)

Cheers!

-Commander Dave

Reply to
Commander Dave
Loading thread data ...

I don't know where to start. Nice looking schem, though. I don't mean to sound rude, but this is a bit like saying "I would like to make a pig fly, and here's the design for the wings." There is a step or two missing :)

I really feel the better part of valor here is to find a ROMulator ( a little box that acts like a ROM, but already has a serial port, if not also Ethernet )

formatting link

or even a Z80 in-circuit emulator. It's surely through-hole, so you can socket it. Craigslist or otherwise network to find somebody who can help you make this happen, unless you feel up to risking your target board by learning to desolder the CPU. I don't know; you could be a total black belt at desolder for all I know. I personally would not do it because I don't solder very frequently.

Here's an "open source" ICE:

formatting link
They're going the way of the dodo bird, so hurry!

Good luck.

-- Les Cargill

Reply to
Les Cargill

How about just asking a question or two? "Beg the question" has nothing to do with asking a question.

formatting link
formatting link

here:

formatting link
(or:
formatting link

It's been the standard in the PC world for decades. Just search for UART on Digikey, that'll give you access to parts that they carry and can get the next business day. Just make sure you get it in a package you are comfortable using.

Even on an older system with presumably slow clocks and rise times, spaghetti wiring like this might cause signal integrity issues that will be hard to diagnose if you don't have an oscilloscope.

Don't forget decoupling caps! Don't leave logic gate inputs floating, even if the logic family doesn't mind, it's not good design practice.

Reply to
a7yvm109gf5d1

The "authentic" solution would be to use a Z80 SIO :-)

formatting link

I think I have one in my basement, if I can find it, but there are even some available at eBay.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

You didn't come across as rude at all. Actually the concept is quite easy. Don't let the fact that the object is an arcade machine throw you, think of it as only a Z80 computer and I'm just adding a serial port to it. I agree that from your perspective that there is many steps missing, such as I didn't explain about the programming or how I worked out the port addresses and such, but for this post's purpose I just need a few specific pieces of information related to the electronics. I've already thought a lot about how to make the pig fly and build the wings, I'm just wanted a few suggestions on how improving the wing design slightly. :-)

I suppose my last question which was "if you see any errors in the design" was mainly what you were referring to. It was only meant for people to point out errors in the schematic at hand, not errors in the overall design. For example, an experienced person may look at the design and say "Oh, he has the IO REQUEST line backwards" or "He has the port decoding wrong for the addresses he has specified". Just simple, little things.

I've considered that option, but for reasons that would be hard to explain, I decided against it. One reason is that the Gorf machine has many ROM slots (it's old technology) and also I'm looking for something that I can leave attached to the game permantly (so to speak). I also wanted to try my hand at actually designing and building something rather than a store bought solution. It's not all about the end result, you see... it's kind of a hobby thing too.

I actually looked at this before hand when it was available as a kit, but again decided againt due to the reasons I mentioned above. Again, the main reason is that I want to design and build, not buy. But both the ROM emulator and the Z80 ICE were excellent suggestions, which I appreciate.

Thanks Les... I appreciate your reply and all your suggestions.

Reply to
Commander Dave

On a sunny day (Sun, 18 Oct 2009 11:54:38 -0500) it happened "Commander Dave" wrote in :

Wel, normally the Z80 DART and the Z8530 SCC or SIO would be used (because of the interrupt scheme specific to Z80 systems). the DART and SCC may be availabe under other names: Z8400 CPU Z8410 DMA Z8420 PIO Z8430 CTC Z8440/1/2 SIO Z8470 DART Second, I have to tap all the signals from the bottom of a card cage by

DIP socket flat cable DIP connectors?

I dunno, I did the Z80 thing so long ago... dunno if have ever used that chip of yours, sort of look familiar. Looks like you actually did think about the address decoding, just read the datasheets. !RD and !WR think about timing.

Greetings! Captain CMOS

Reply to
Jan Panteltje

The 16C550 is an excellent choice. It has FIFOs so the software doesn't have to service it all the time.

What you need is an small program that tries to read & write from the UART. IIRC register 7 of the UART is a scratch pad register (unused but can be written & read). Try and see if you can read and write data to that register. This will verify whether the UART can be accessed by the Z80 or not.

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
                     "If it doesn\'t fit, use a bigger hammer!"
--------------------------------------------------------------
Reply to
Nico Coesel

Hmmmm... from what I see of the web sites you provided, my use of "beg a question" is a bit different than you interpreted it. The reason that I even put that in there is that I am a bit gun shy. From all my years on the newsgroups, I find that there are multitudes of rude people out there ready to criticize even the slightest mistake or question. In some cases it is related to the post and sometimes not. For example, they may nitpick your methods, design, reasoning, schematic program, operating system, terminology, etc. Others like to pick at things like "bottom posting is best" or that you are a loser because you mispelled a word or used poor grammer. All of these type things are non-helpful, especially when pointed out in a rude or condecending way. So after being burned so much by rude people, when I say "I might beg a question or two" means that "I respectfully request the answers to some questions in a helpful way without rudeness". While I probably failed in my attempt to convey that message, I don't see how it relates to the way it is used in the web sites you pointed out. I won't go into a discussion on why it is unrelated as it is useless to the topic of electronic design and the questions I posed. I'll leave that as an exercise for you and other readers.

I am glad to see that you agree that I made a good choice. It was the best I could come up with at the time, but this being my first design I was thinking there may be a better alternative. Unfortunatly, the 16C550 has been discontinued in the DIP 40 pin format, so I went with a PLCC which was hard to wire up and probably the reason for my prototype failure. I have an PLCC to DIP adapter on the way that should help with that.

I can't argue with that and I appreciate the suggestion. I assume that there isn't much I can do in that regard except keep the wiring as short and simple as possible. Perhaps a ribbon cable or something similar would be the answer. I'm open to suggestions.

OK, thanks for the suggestions. I'll have to look up decoupling caps and see if they are needed on the design I have (still shaky on electronics). On the suggestion of not leaving logic gates floating, would this apply to all the pins on the 16C550 also? I pulled a lot of information from the net and most of the time I see them just listed at not connected.

Thanks for the helpful suggestions!

Reply to
Commander Dave

I intially rejected the Z80 SIO because it looked to me to be a bit more complicated to wire up than the 16C550, but it might just be my inexperience. Thanks for the suggestion, I will keep it in mind.

Reply to
Commander Dave

I may have missed it, but how about the code in the existing ROMs.

Do you have any idea on how to add code so it will work with the existing code base ??

Do you have schematics of the original unit ??

As others have mentioned, the hardware should be easy to connect with some care.

The software is going to be the biggest hurdle.

don

Reply to
don

That's good to hear. My question is really just curiosity at this point as I am somewhat locked into the design I have for now. If there was a better choice I would have probably put it into a future design.

I actually did what you have suggested. I have a program that initilized the UART and then read back the registers. Unfortunatly, every register just returned the decimal number 12, even when the UART wasn't in the socket. This indicated to me that the Z80 isn't talking to the UART correctly. I suspect that it is my wiring on my prototype. Since the 16C550 is discontinued in the DIP 40 format, I went with a PLCC format which was difficult to wire up. I have a PLCC to DIP converter board ordered which may help with this problem. I also thought about breadboarding the port addressing circuit with some latches and LED's to see if my design is even working at the port decoding level. Still considering that option, but that's more I would have to figure out how to do. I'm learning as I go...

Thank you for the helpful suggestions!

Reply to
Commander Dave

Reading your web site, I noticed that you did not stated what you were going to do with the serial port once it is installed.

I would suggest replacing the ROM chips with RAM chip(s), this would allow you to run a Bootloader.

Google found lots of Bootloaders:

formatting link

A smaller UART chip would be the SCC2691, Digikey has them for $5.40 for one.

Good Luck

don

Reply to
don

You didn't miss anything, Don. I didn't mention anything about the code and I haven't posted anything on my web site. But rest assured that the code isn't a problem once I get the hardware working (barring any bonehead coding errors on my part). I've written code quite a bit and burned it into the EPROM's for awhile now. You can see an example of one of my programs on youtube here:

formatting link

As I get some time, I will eventually put the programming info up on my web site... but it seems I'm always busy, busy busy... :-) Oh, and I do have the original schematics and they are available on the 'net. That's something else I need to put up on the web site.

Thanks!

-Commander Dave

Reply to
Commander Dave

Wiring a PLCC socket is not more difficult than a DIP socket. You'll need to figure out which pin goes where first though. I suggest you get a simple oscilloscope (a 20MHz will do) to do some measurements (like the port decoding).

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
                     "If it doesn\'t fit, use a bigger hammer!"
--------------------------------------------------------------
Reply to
Nico Coesel

On a sunny day (Sun, 18 Oct 2009 11:54:38 -0500) it happened "Commander Dave" wrote in :

Actually I think it is wrong in timing. You need to combine !IORQ with !RD and !WR to get the !RD and !WR signals. The chip enable should be done by the address decoding. That way the chip is enabled *before* you do a read or write. Like I did say: Watch the timing!

Z
Reply to
Jan Panteltje

Oh, I don't know about that... it was definitely harder for me, but again, I'm a newbie at building boards. Another reason I wanted the DIP 40 format was so I could breadboard it initially... those PLCC sockets don't fit on a breadboard AFAIK. Since I have an adapter on the way (found one for $6.95 shipped), it's pretty much a moot point now.

I would like to get an oscilloscope, but I am really cash poor. I practically have to scrounge money for the small parts that I buy. One of these days I'll snatch one up cheap, but until I get the money I have to work with what I have.

Thanks for the suggestions,

-Commander Dave

Reply to
Commander Dave

My intentions are to have a small monitor program in EPROM with the ability to download program code into RAM and then have the machine execute it. It's mainly for testing and debugging purposes. Once I have the code solid, I would burn the program into an EPROM and put it in the game permantly.

I do use a Gorf arcade emulator (MAME) to do the gross debugging, but sometimes things that run on the emulator will not work on the real hardware or it will have different results. Burning EPROM's to test code in the real machine is a pain, but compiling and downloading to the machine would be quick and easy.

As for replacing the ROM with RAM and running a bootloader, it seems like the modfications would be just as much work as building a serial port, but honestly, I would have to research the information you gave me on bootloaders to make an informed decision. My main concern is that I don't want to hack around on the original hardware if I can avoid it. By connecting a serial port, I only have to run wires from the bottom of the cardcage to a external board and just have to burn one EPROM that would go in an extra socket on the original board. I modified the original game code so that if I flip the diagnostic switch on, it looks for this extra EPROM, and if it is there, jumps to my code. If it isn't there, it runs the game as normal.

Sorry I got so chatty.... I really need to copy and paste this into my project web site. I will look into what you are suggesting, however. :-)

Interesting! I glanced over the datasheet and it looks like a viable alternative with a smaller footprint in the DIP format. I'm kinda locked into the 16C550 for this run, but I may use the chip you suggest in any future projects (or perhaps future incarnations of this one). Thanks!

Reply to
Commander Dave

There's only one way to "beg a question". But you can beg for our attention. But you don't need to.

I disagree. Any information is useful eventually. Correct usage of expressions and logical fallacies is important. You ever met someone who says "for all intensive purposes" for example? Or professional websites where the old it's/its problem shows up? What else did they get wrong?

Well, you didn't say if you are planning to make a PCB or keep it as a hand-wired proto.

Yup. Old computers are sometimes built with different sections tied together with ribbon cable, like the Commodore SX-64. However, when you look closer at the signals, you realize the whole mess just holds together by being barely in-tolerance. And wouldn't you know it, some things that work on regular Commodore

64s don't work, or are unpredictable, on the SX-64 because of signal integrity. At 1MHz... You can get better integrity by tossing in more grounds between signal wires. Like put a ground between every 4 signals, instead of just one ground for the whole ribbon.

Also, when carrying power off the main board to a hack, it is wise to use a sacrificial resistor as a "fuse", so that accidental shorts don't connect the entire power supply of your machine to the short. Put the resistor in the machine where your wires start. A couple of ohms should be fine.

You don't look it up, you just do it. The "why" can become tricky. It's a whole subject in itself.

It is true that many inputs have built-in pull ups or pull-downs. If you leave something floating that shouldn't be, you can get anything from overheating components to intermittent operation. If you are sure it can be left floating, then it's cool.

Sometimes, this group works.

Reply to
a7yvm109gf5d1

Where are you located? You sound like someone that can benefit from people trying to cleanup their place.

Reply to
a7yvm109gf5d1

I defer to your superior knowledge of the subject without agreement or disagreement. Next time I will write it out fully so everyone including English majors can understand. It will be longer and more annoying, but at least it will be correct.

May I suggest that there is a good balance point? In a non-professional setting such as newsgroups, there are times when it is appropriate to correct and when it is not. For example, if I WROTE IN ALL CAPS, I would expect to get a spanking. Or I would even accept a correction of "verticle" to "vertical". But then there are times when it should really just let it go. It gets very annoying when people correct every little mistake. Have you ever had a conversation with a person who keeps interrupting you to correct your useage of "who" or "whom"? Or correct your verb tense? It gets really annoying fast and you quickly learn to avoid that person in conversation. When it is done on the newsgroups, it usually causes either a high noise to signal ratio for the group or long threads that have nothing to do with the topic at hand. At worst it leads to flame and religious wars (just search on top/bottom posting for prime examples). I've watched new members leave the rec.games.video.arcade.collecting newsgroups over the years because on the first post they made, people nitpicked and acted all condesending. It's really sad to see.

And as for any information being useful, that is true, but only if it is in the correct context. There is a time and a place for everything and I find it a bit arrogant that you would decide an electronics forum is appropriate for grammer correction, especially since I don't consider it to be a mistake how I wrote it. You are entitled to your opinion of course, but I consider your correction to be crossing the line from necessary to just annoyance. If you don't like my posting style or grammer, it would be best just not to say anything at all and not be the newgroup policeman. Just put me on the

*plonk* list.

So, to end it once and for all, you win. My grammer is atrocious and I should be flogged and my posts deleted. I beg your pardon. Now, can we just drop it and get back to the subject of electronc design?

I see I didn't explicitly state that fact, but usually things start out as a wired prototype and them moves to a PCB stage after the bugs are worked out. To clarify, I am in the wired prototype stage.

Once I get the connector nailed down I'll see how many extra connections I have and see if I can throw in a some extra grounds in between. It sure couldn't hurt.

Would some type of fuse not be indicated? Why is a resistor a better choice? Is it because that a surge can get through the fuse before it blows but a resistor won't let it through before it burns up?

Yes, but I have no idea what decoupling caps are and HOW they are used. Before I "just do it", I have to know what they are and how they are used. I'll try not to get bogged down in theory.

I'll double check the design and see if I can spot anything.

And sometimes it works, but in an annoying way. But I do appreciate the help.

-Commander Dave

Reply to
Commander Dave

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.