Home » electronics » Toil and trouble

Toil and trouble

My worst fears have come to pass and for a while I thought the LEO-1 was not going to make it. I had made a test board to act as a fake control board so that I could test the memory board. I had tested it with the Real Time Clock chip and everything was working great. So I carried on building the memory board and connected up the two ZIF sockets. I burned some test data to one of the EEPROMs and put it in one of the sockets, connected up a couple of digits to one half the data bus and used the test board to address the ROM. Lo and behold, the digits showed the correct data coming out of the ROM. It was working as expected. Here’s a picture of the set-up. The digits on the protoboard are showing 3 4 which is the first byte in the ROM.

Memory Board working

Memory board displaying data

I switched various addresses and watched the data come out and everything seemed fine, when suddenly the digits went all weird, like a square 8 which is an impossible display. It was pretty clear that the display was oscillating between two values at such a high speed that it looked like all the dots were on at the same time.

And so began several weeks of pure hell trying to figure out what was going on and what caused it. I was able to reliably repeat the problem by setting a certain address and then changing to the next address so that the data changed from 0 0 to  0 1. Often, but not always, the thing would start oscillating. I put my scope on it and found an 8Mhz oscillation on the data bus. I suspected the ROM was faulty but all the ROMs had the same behaviour. I suspected the test board because I had forgotten to buffer the address bus lines. That was a dumb mistake which I decided to fix, so I spent a week adding 74244 buffers to the test board. That didn’t fix the problem. Then I realised I had forgotten to buffer the control signals too, so I used a few spare gates on the board’s 7400 to do that. Didn’t fix it. Weeks had gone by and this random oscillation was still happening. I remembered that you can get this kind of problem if you forget to connect an unused input on a gate, so I checked the schematics and scoured the board for disconnected pins. No luck. Everything was as it should be. One night in early December as I sat there with my head in my hands, I realised that if I couldn’t solve this, there would be no chance of the LEO-1 working at all. My fairly trivial memory board wasn’t even stable at manual switching speeds! I thought about giving up — all that time, effort and money down the drain. By the time I went to bed, I was pretty depressed.


Trying to figure out the oscillation problem

The next day I took one last crack at solving the problem. I had been studying all the data signals on my scope’s logic analyzer and had not had any ideas beyond unconnected pins and faulty chips.

You can see in the picture above that the test board’s ribbon cable was sticking up in the air. It was like that because I was using a short cable for the address bus and the long data bus cable had to be bent in order to be plugged in. Well, for some reason, while the oscillation problem was happening, I just happened to push the cable a bit flatter — and the oscillation stopped. That didn’t seem like a coincidence, so I tried changing the address with the cable flat — no oscillation. I bent the cable again and then next time I switched addresses, the oscillation started again. I could control whether the oscillation would happen or not by bending and straightening the cable. What’s more, the scope showed that the oscillation frequency was changing between about 7 and 8 MHz depending on how the cable was folded.

Then it hit me. Was the ribbon cable suffering from transmission line problems? Those problems that I had been obsessing over right back at the start? Things like reflections and ringing and all that annoying stuff? And did folding the cable do something random like perhaps change the impedance or cause cross-talk? And could that make the bus transceiver chip go into some kind of oscillation? Well, I was not sure and I’m still not sure now, but I have a theory. When reading data out of the ROM, the test-board end of the 12″ cable was not connected to anything. That meant that when the data bus switched from 00 to 01, that 1 bit went down to the other end of the 12″ and reflected back. Ordinarily I would have expected the reflection to die out pretty quickly and just cause a bit of ringing. But something about the folded cable caused it to keep bouncing, perhaps amplified by the bus driver itself. After reading up a bit about line termination, I did an experiment. I added a bunch of 82 ohm resistors at the memory board end of the cable, just before the 74245 transceiver. After that, I couldn’t repeat the problem any more. No amount of switching addresses or folding the cable in any way caused the oscillation and I haven’t seen the problem since. I don’t really understand why it works except that possibly the resistors absorb the reflection and damp it so that it doesn’t turn into an oscillation, but I still don’t understand why I got full permanent oscillation in the first place. I’d love to hear from any experts out there who can explain what the heck was going on.

As if that wasn’t enough trouble, the next thing that went wrong was that I discovered that I had not left nearly enough room between the address bus header and the first bunch of chips. There was no room left to solder any more wires and I still had a couple of busses to connect there. I found I had no option but to move the address bus header to the other side of the board. I had to disconnect all the wires, desolder the header, re-solder it and redo all the work of connecting the 24 address lines to the ZIF sockets. While I was at it, I bit the bullet and removed the majority of the thick annoying wires and replaced them all with magnet wire. I learned a valuable lesson there. You have to leave plenty of room between headers and the chips they connect to so that there’s room to solder multiple busses to the same header pins. From now on, I’m only going to use regular wire for power connections. Everything else will be done with thin magnet wire.

Address Bus

Address Bus connections

So, the LEO-1 lives on after all and right now I’m in the process of wiring up the main RAM and ROM sockets. After that it’s the I/O chips and then board number 1 of 4 is complete.

Memory Board

Memory board as of New Year 2016

10 thoughts on “Toil and trouble

  1. Hello, and happy new year to you.
    I’m happy to read that your project goes on.

    About long ribbon-cable, there is another very important trick that solves lots of EMC (Electro-Magnetic Compatibility) issues.
    When you use high speed digital logic components, whatever the frequency, you have to ground half of the wires.
    That means that you have to dedicate a full row out of the 2 connector’s row to ground connection. And you have to make this connection to ground on both sides of the ribbon-cable (very, very important).
    OK, it occupies lots of space inside the ribbon-cable, but it’s necessary.
    In your pictures, I see ground connections to ribbon-connector on the “test board” (the one with dip-switches), but not on “memory board”.
    With that, you guarantee that every signal-wire inside the ribbon-connector will be as closed as possible to a ground. This greatly limits EMC problems (cross-talk, etc…).
    Furthermore, for ground connections inside the board, never use ultra thin wires (like your magnetic wire). Ground connections have to be stronger.

    On my side, I continue my FPGA-computer project. I now have a compiler that works : 100% homemade, codded in C, for a custom “BASIC” language.
    I now begin to write “complex” programs. I will keep you informed if you want, especially when I will describe the project on a dedicated website.

    F4HDK – French hobbyist


  2. Thanks for your comments. This is very helpful. Although I had already grounded half of the wires I didn’t know if I should ground them at both ends. In fact, I decided not to because I thought I might get some kind of ‘ground loop’ problem. I will take your advice and ground both ends. I am interested in your project and look forward to reading about it.


  3. Ground loop happens when you make long loops of connectors that are not closed together. And the best solution to solve “ground loop” issues is to “mesh” the ground, make more ground connections, and make these connections as short as possible, and regroup these long wires so that they take the same path.

    If you connect ground of a ribbon cable only on 1 side, this is worse that no ground at all inside the cable! The “ground” cable will act like an antenna, capture the signal close to it (cross-talk from the signal wire), and draw it back as a “radiofrequency current” to the ground of the board connected. It will inject a lot of noise to the board’s ground.

    For a “system” (for ex. a computer), for solving ground issues, you have to make as many ground connections as possible between the different boards. And make all the connections (ground or signal) as short as possible.
    Every “signal” wire will be as closed as possible to a “ground”, wether the signal is on a cable or inside a board.
    And the “ground” should be meshed, especially on a signle board. The ground connections should have the shortest path possible. If 2 components close to each other have different ground paths (take their ground from different parts of the board), then you should “close the loop”.
    You can make loops inside a board, but these loops should be closed, never “opened”. Ideally, on boards, we use ground planes, which is a highly meshed topology.
    On my electronics projects, I use veroboards with 1 ground plane on 1 side.
    But for a project like your (less than 5MHz), it is not necessary.


  4. Thanks, this is good to know. I have never really been able to understand the grounding rules very well. As a software guy, I always tend to think of 1 and 0, ‘high’ and ‘low’ and forget that there is a current involved. This is the first time I have really given it any thought. When I added the LEDs I separated their power and grounds from the main logic. The LEDs have a separate +5v connection and their ground returns by a different route that doesn’t overlap the logic ground. For power connections to the logic, I tried to copy what I saw on photos of old computer boards. But I never really understood the purpose of a ground ‘plane’. I think even at slow speeds, the fact that the parts are HC means they have a faster switching time than in the old days, and that can cause problems too. There’s so much that can go wrong and I’m learning a lot. Thanks again. I’d like to see pictures of your boards when possible.


  5. Here are 2 pictures of my FPGA computer. There are very few components, because all the complexity is inside the FPGA.


    The FPGA breakout-board is put on a Euro-size veroboard with ground plane. This board is currently equiped with a custom VGA output, and a PS/2 input for keyboard. Later, I plan to add a serial connection, and 1 SPI-flash memory on this board, and perhaps a joypad interface.
    The memory board, plugged on the top, is a veroboard for SMD components (1.27mm step) equiped with 4x512kB SRAM, currently only 2 are wired. Notice the wiring density of this memory board.
    The wiring is made with a mix of wrapping and soldering.

    You say that you learn a lot about electronics with your project as a computer-scientist.
    On my side, I learn a lot about software with my project as an electronic engineer. Coding the compiler was difficult for me, but it was very instructive : parsing text, recursing analysis of an expression, etc…


  6. Thanks for the pictures. That’s a cool looking chip you have there. I’m a bit old-fashioned and have not kept in touch with modern techniques like FPGAs. The most ‘modern’ thing I’ve done was play around with PIC microcontrollers.

    I see you have used some kind of special glue to protect things. I’d like to try that. What is it called? I just use regular glue but it’s not very good. Before this project my only real digital electronic experience was with simple flashing light or clock projects. This project is like jumping in at the deep end.

    I’m a very experienced programmer but I found writing a simple expression evaluator quite difficult. A compiler must be a very hard job indeed. I hope you will set up a web site with details of your project.


  7. About the glue, I just use a “hot glue gun”, a very standard one.

    About the FPGA : it’s a very impressive device, very powerful. I have learned Verilog (one FPGA HDL language) last year. You can configure the hardware you want inside an FPGA, with registers, gates, memories, look-up-tables, ALUs, counters, etc… even complex arrangements. I programmed my own CPU core in it, and also several peripherals (VGA, PS/2). Lots of “home made CPU” are done in FPGA.

    But I understand your need to build a real mini-computer, with standard components. Bill Buzbee explains that very well in it’s “Magic-1” website. Magic-1 is the most impressive “home made CPU” project I have ever seen!


  8. I know Magic-1 very well. It was one of the things that inspired me. I read those pages many times over 18 months before I started making my own design. My real time clock subsystem is pretty much a copy of how Magic-1 does it.


  9. I love reading these progress reports. I’m planning to build a TTL computer some day, I believe your site will be helpful.


    • Thanks for your comment. I hope my work will inspire you to try. Part of the reason I’m publishing all this is to help other people. The other part is, of course, to show off 😉


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s