Connect with us

Serial Port Design for Z80 - Questions

Discussion in 'Electronic Basics' started by Commander Dave, Oct 18, 2009.

Scroll to continue with content
  1. 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:
    http://tinyurl.com/yfe9utm (or: http://preview.tinyurl.com/yfe9utm )

    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
     
  2. Rich Webb

    Rich Webb Guest

    I haven't looked at the schematic (I'm allergic to tinyurl addresses)
    but you might consider tossing in a microcontroller (with a built-in
    buffered UART) instead of that 16550.

    On the plus side for the 16550, it's of more or less the same generation
    as the Z80 and they both are comfortable with "classic" address, data,
    and control busses. Other than the number of connections required, that
    might be the simplest approach.

    On the plus side for the microcontroller, you can probably get by with
    an address decoder to drive /enable, and the /WR plus one data bit for
    the clock and data out, which would be three SPI-like lines to the uC.
    Something will need to do the address decoding but if you're lucky then
    all 16 bits aren't used and you can steal one for /enable.

    WRT the connector. If you go with the 16550 then a default setup would
    probably be to start looking at a ribbon cable and an IDC (insulation
    displacement connector) socket on 0.1" centers. A 10x2 is pretty widely
    available.
     
  3. I didn't really look at USB because I am very limted in my knowledge of
    electronics. Serial ports seemed easier to me because I have books that have
    details on how to hook them up to the Z80 along with lots of schematics on
    the web. I was also concerned about how to make/get a driver for the USB
    working on the PC. The whole thing just seemed more complex than the serial
    port.

    The short answer is that I had a greater comfort level with the serial port
    build. Perhaps on a later project I can implement a USB port for the
    beastie... :)

    Thanks for the suggestion!
    -Dave
     
  4. I totally understand about the tinyurl allergy in this day and age. I did,
    however, put in the link to the preview tinyurl version. Are those also
    suspect in your eyes? In any case, I understand the safety issue and
    sympatize. If you want to check out the schematic, just go to www.gorf.info
    and click on the "Hardware Projects" and you will find it easily. My site is
    very small at the moment.

    I considered a microcontroller, but as with many things, I don't have any
    experience with them. I would have to do a great deal of research on
    programming them and how they work. I have a greater comfort level with a
    UART and serial ports, so that is why I went that route. I would like to get
    into microcontrollers one of these days, however. Perhaps I will use one in
    a future project.
    Wow... this really shows my ignorance on microcontrollers. I didn't
    understand hardly any of this paragraph. It's not that you wrote it badly, I
    just have no knowlege in the microcontroller world. As I said above, I
    should really get into microcontroller one of these days.
    Ah, now this is something I really needed... information on the connector
    issue. I'll use the info you provided and see what I can find from Digikey.
    Thank you VERY much for all your suggestions and help. By the way, I used to
    live in the Norfolk/Virginia Beach area. It seems like a lifetime ago... but
    I remember it fondly.

    -Commander Dave
     
  5. Rich Webb

    Rich Webb Guest

    The layout looks reasonable at first cut. There is one spot where you
    have a crossing but no junction dot (up by Vcc on the MAX232). Strongly
    recommend sticking by the rules: ALL T-junctions are connections and NO
    crossings are connections. Means that you may need to add an extra zig
    or zag in a spot but it can remove any ambiguity.

    WRT the MAX232: You'll probably want (or may only find) the ...232A
    variant (or one of the many clones). The ...A chips use 0.1 uF caps
    instead of 1 uF and you can usually do okay with the same caps used for
    power rail bypassing (which you'll want to add to the schematic).

    WRT whit3rd's suggestion on using USB. There are many difficult ways to
    do that but there's also a (relatively) simple way by, more or less,
    just replacing the MAX232 with an FTDI FT232R chip.
    http://www.ftdichip.com/FTProducts.htm#FT232R. In effect, the Z80 and
    16550 think that they are talking to an ordinary RS-232 serial line. On
    the PC side, the FTDI driver installs a "virtual serial port." You may
    already have a gizmo hanging off your PC that uses one. The principal
    advantage is that PCs with serial ports are getting hard to find but
    it's hard to find one nowadays without multiple USB ports.
    The parallel bus arrangement that you've shown should work just fine. As
    you do more projects, you may find that a lot of inter-device
    communications have moved to serial busses instead; many fewer wires to
    manage. One common bus is the SPI bus
    http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus. Not
    germane to the current project, though.
    Ribbon cable and IDC connectors are often the easiest to use. You can
    get them premade or get the connectors and squeeze 'm yourself.
    http://dkc3.digikey.com/PDF/B092/P0043.pdf
    Former bubblehead turned contractor (they *pay* me to play with this
    stuff ;-) The area hasn't changed much ... well, the traffic's probably
    a little worse.
     
  6. I see the spot you are talking about and will get that fixed. It should be a
    junction there. I'm afraid that I didn't quite understand the meaning of
    your rule. Are you saying not to make a junction out of a crossing? In the
    case above, I would move the top wire (+5v) over a bit so it doesn't cross?
    You may have to talk to me like a four year old on that one. :)
    This is another tough point for me. If I am not mistaken, "power rail
    bypassing" is caps put between the power and ground rails to keep down
    ripple? I was never clear on where to put the caps, especially on a wired
    board, not to mention the value or type of caps to use (disc ceramic?). The
    only thing I think I know is that they go near digital IC chips. I'm very
    limited on my knowledge of electronics, but I keep on trying. I'll see if I
    can find some reading material on the subject.
    Very true about disappearing serial ports and your solution would be the
    simplist to implement given the design I have already. After I get the
    serial port working, I may do a modification to change it to a USB using the
    method you describe.
    Still nice to know. I have heard of SPI when looking at UART's. I recently
    pulled a data sheet on a Maxim MAX3110E which I thought was something I
    could use because it had a UART and line drivers built into the same chip. I
    was all excited until I found that there were not any parallel data lines
    going into the chip. It instead was SPI/QSPI/MICROWIRE compatable. I assume
    that this is the mechanism that microcontrollers use today to pass data as
    you have said. My problem would be that I wouldn't know how to get the
    parallel data from the Z80 (D0-D7) into a serialized format that SPI uses.
    I'm clueless on the subject, but I don't mind you talking about it. I do
    love to learn, but just talk at a very low level or it will sail right over
    my head. :)
    Excellent, excellent, excellent. Thank you so much for the link and the
    help.
    My gosh, man... the highway to the Norfolk naval base was practically at a
    standstill in the mornings even back then. I would really hate to see it
    now! I do wish I could come back and visit Virginia Beach, however. I have
    some fond memories. I used to live about 1/2 mile from the beach and would
    jog down to and run along the beach. In the summer the view was very nice
    and in the cooler weather I had the beach to myself and found it very
    peaceful.

    Did they ever do away with that toll road that led down to the beach? There
    was always talk about when it was paid for they would do away with it, but I
    was skeptical. Do you happen to know?

    Fondest Regards,
    -Commander Dave
     
  7. Baron

    Baron Guest

    Curiously TalkTalk blocks your web site !
    Among a number of others it blocks.
     
  8. How odd. I do use a free web hosting service (I can't afford anything else
    yet), so perhaps it has something to do with that. I'm not familiar with
    TalkTalk, but if they are blocking your access to other web sites too, you
    may want to consider another service or at least write them and find out why
    it is blocked. It sounds very inconvenient.

    Cheers!
    -Commander Dave
     
  9. Rich Webb

    Rich Webb Guest

    Exactly. The intent is to avoid depending on the "junction dot" to tell
    whether or not there is a connection. That makes it much easier for
    somebody who is unfamiliar with the schematic (which generally includes
    the author, after a few months) to know what is intended.
    When devices change state, they momentarily "want" a lot of current in a
    very short time. You'll want to have a local reservoir (the bypass cap)
    between power and ground and located near to each of the chips you're
    using. The inherent inductance of the interconnects on the board means
    that you can't just, say, put a handful of caps off in one corner; they
    need to by physically close to each switching device. Typically a 0.1 uF
    monolithic ceramic.
    Yes, wide parallel (address + data + control) busses are relatively rare
    nowadays except for applications that need the highest available
    bandwidth (e.g., the main memory interfaces in PCs). SPI (and the subset
    Microwire (TM National Semiconductor)) and I2C (TM Philips/NXP) are two
    that are commonly used for chip-to-chip communications. For example,
    your PC almost certainly uses a subset of I2C, the SMBus, as its
    internal low speed "system management" network for things like
    temperature monitoring.
    Stick with the parallel architecture for now. But if you look at the
    signals on an SPI connection and compare them to the signals used for a
    Z80 I/O operation, you may see that it could be possible, for example,
    to use the write pulse (/WR) as the "clock" line in SPI.
    Yes, state route 44 dropped the tolls and became a segment of the
    interstate. Naturally, Virginia Beach being Virginia Beach, it just
    Would Not Do for them to get a mere spur designation (odd digit + main
    interstate base number). So, instead of being I-364 like they should be,
    they continued the I-264 designation from Norfolk and thus contributed
    to the endless confusion of out-of-towners who justifiably expect that
    an even-prefix auxiliary should reconnect to the main highway.
    </rant>
     
  10. The original Z80 UART (USART) is the Z80SIO. A powerfull device yet hard to
    program correctly and it requires an external Baud-rate generator.

    Instead of that Z80SIO an Intel 8251 was often used. Much easier to program
    though it has some bugs like all Intel UARTS and their clones at the time.
    It also requires a Baudrate generator.

    The Intel 8250 was used in the first PCs. There were myriads of types
    (including the clones) all with small differences and bugs. They were harder
    to program then the 8251. Very hard to program if you had to anticipate for
    all types and bugs. On the positive side they had a programmable Baudrate
    generator build in.

    When the PC-market boomed, Intel developped successors for the 8250: Among
    them the 16450 and the 16550. FAIK the 16550A was the first bugfree type. I
    guess your 16C550 to be a clone of that last one. As they were used in PCs
    there's a lot of information about them on the net. Look for instance at:
    http://www.beyondlogic.org/serial/serial.htm

    If I had to deal with those old hardware I'd go for a 8251 using a 4060 for
    the Baudrate generator as IMHO it is the most simple approach. As you have
    that 16C550 already I guess you will stick at it.

    Which brings me to the main question: What do you really want to do? Because
    adding a serial interface to the existing hardware does not solve anything
    on its own. You will need to program a kind of monitor in the Gorf that
    communicates via that interface. Accepting commands and returning results.
    Then, when you want the Gorf to perform its original function, you need to
    get the firmware via the serial interface, store it in RAM and then pass
    control to it. I do not know the hardware of that Gorf but I suppose you
    will need to do some real hardware modifications. Not to mention the
    requirements if you want to do some debugging.

    petrus bitbyter
     
  11. Baron

    Baron Guest

    TalkTalk is a UK isp. They seem to block file sharing sites in
    particular, so I suspect that your isp is probably within a group of
    addresses that they block.

    Of course they deny that they do anything of the kind and blame network
    or bandwidth issues. They have already killed off Usenet and are
    trying to kill of pop/smtp as well by forcing new subscribers to use
    webmail.
     
  12. When I was considering UART's and based on my low level of experience, I
    decided against the Z80SIO because it looked to be much more complex than
    other solutions.
    I considered the 8251 as there are tons of old Z80 books with instructions
    on exactly how to interface and program the 8251 to the Z80. I decided
    against it because the 8251 seemed to be an old chip and I wanted to try to
    stay with something that would be easily obtainable from mainstream
    companies like Digikey.
    I think I have this site bookmarked already, but thanks for the link. Lots
    of helpful information there. :)
    Yeah, got to stick with it in this incarnation at least. As I said a few
    lines up, I didn't go for the 8251 because I am thinking it is an obsolete
    part and it might not be readily available from mainstream sources. I wanted
    to stick with parts I could get from a mainstream company. I mainly was
    wondering if there was anything better and newer than the 16C550 that I
    should have used.
    A fellow named Don posted the same question yesterday. I like to modify the
    code on the Gorf machine and it has been a hassle in the past to burn a new
    EPROM every time I wanted to test on real hardware. I want to have a serial
    port attached so I can download code into memory.... kind of a dump and
    execute type thing. I have modified the original game code so it looks for
    an extra EPROM in a vacant socket if the debug switch is on. If it is there,
    it jumps to my code, if not, it just resumes the normal game diagnostics. I
    would have a monitor/debug program in the extra EPROM to control the serial
    port. In case you are curious, I have ruled out a Z80 ICE and a EPROM
    emulator for various reasons, not because they aren't a good idea, but for
    other personal reasons (which I think I covered in previous postings if you
    are curious).
    Actually, since the Gorf machine already has static RAM (and some dynamic
    also) on board, the only hardware mods is the connections to the bus from
    the bottom of the cardcage (about 20 signal wires), power connections (again
    from the card cage power connector) and the custom EPROM's which are all in
    original sockets. One of my goals was to make as few changes to the original
    hardware as possible. As for the debugging, most would be done with the MAME
    emulator and only code that worked on the emulator would be tested on real
    hardware which usually requires minimal debugging (just a tweak or two). A
    simple monitor/debug program would be enough to do the job for me.
    Yeah, that's my bad. When I first started looking for an electronics
    newsgroup to post in, I went to rec.electronics. Then I saw that it was
    pretty dead there, but then found another I thought might be better and
    posted it there. Then I found another and another and posted in those. I was
    a real cluster-flub on my part, but next time I will know which groups are
    active and will post to all at once as you have suggested. I apologize for
    the inconvenience.

    (Note: I copied and pasted this reply from the sci.electronics.design group
    because of this same problem.)
    Thank you for your help and suggestions!
    -Commander Dave
     
  13. Jasen Betts

    Jasen Betts Guest

    8250 ? :) but the 16550 is basically just an improved version.

    I'm not too great with finding what is out there. Can someone make a
    use a DB25 if you can't find something better, probably easier to
    prototype with a DB25 than with an edge connector.
    I see no capacitors between VCC and ground, add atleast one 0.1uf (or
    larger)

    unused inverter inputs should be connected to +5 or ground.
    unused outputs can be left unconnected.

    unused UART inputs should probably be similarly treated, (or you could
    connecte /CTS and /DTD to /RTS) , connecting /RI to +5 is probably
    apropriate, and appears to be convenient.

    I note that you're not connecting the interrupt line,
    the hassle you save by omitting interrupt hardware may not be worth it.
     
  14. Jasen Betts

    Jasen Betts Guest

    Disc ceramic is suitably old-school to match your Z80, but these days it's
    monolithic ceramic that's used instead, basically it's a 2mmx1mm surface
    mount part, if you want leaded parts it's the same surface mount chip with
    wires bonded on, a coating of resin and some apropriate numbers written on
    it.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-