Friday, February 22, 2019

Been learning KiCad (Dragon's Lair ROM PCB created to help me learn)

After I discovered that my Eagle v7 license only allows PCB sizes of something like 6" x 4" (I was disgusted), I decided to learn KiCad so that I could make larger PCBs.

Needing a simple and easy PCB to start with, I decided to reproduce the Dragon's Lair ROM board which is very basic.  All it has is a connector, five EPROM sockets, and some capacitors.

Here's what I ended up with.  I am pretty happy overall with the tool, although I did a find at least one feature that Eagle has that KiCad doesn't have that I am missing.  Still, I think KiCad may be the overall winner between the two considering how far astray Eagle has gone these days.



(here's the original for reference)

Monday, February 11, 2019

Added a new molex connector to my Electrohome G07

Someone had cut off the original molex power connector for this G07.  I studied the connector for another G07 that I have in my Dragon's Lair and found what I believe is a compatible replacement.

A small victory, but at least it was a mini project completed.


Tuesday, January 1, 2019

Digilent Discovery Quick Howto

When I haven't used my Digilent Digital Discovery logic analyzer for a while, I kinda forget how to use it.  This logic analyzer is really nice because it's relatively cheap but can capture 32 channels (!!) and has some pretty decent software to help me visualize my data.  The only real downside that I've found is that it doesn't stream so you can't have arbitrarily large samples.  This is the one killer feature of the Saleae which prevents me from saying that the Digital Discovery wins in every category.  However, it does have a decent buffer size especially for 'slower' capture speeds like 1 MHz which is usually plenty for the old tech that I like to study.

Without further ado, here are my notes (to myself) for how to set up the software to make the logic analyzer do what I want.  And a bonus youtube video at the end illustrating all of it.

----------------------

Click "Logic"

Change mode to "Record"

Click + to add channels
If adding multiple lines, choose Bus, otherwise Signal

If using trigger, change trigger dropdown to 'normal'.
Else, set it to 'none'.

Click "Config"

Choose Rate (I like 1 MHz minimum)
Uncheck 'noise'
Set 'base' to how much time you want to capture. 'Samples' will be auto computed.  Note, streaming doesn't seem to be supported, so the higher the sample rate, the smaller the sample size.

If using trigger,
Set trigger to 10% or less.  10% will capture 10% of data before the trigger happened which is often the most useful for me.


Important notes about triggers:

Triggers can be confusing.  I spent several minutes being horribly confused by this situation:




I wanted to trigger when the data lines had a value of 0x10 and when M1 was low (a Z80 instruction).  It appeared to me that what was happening was not a valid place to trigger.  However, upon closer inspection, it actually is valid because for a brief snapshot in time, my trigger criteria had been properly met.  To fix the problem, I needed to change the M1 trigger to be a rising edge instead of simply a value of 0.

My advice is to try to use falling/rising clock edges as part of your triggers.

When capturing Z80


If capturing data lines to try to find an instruction, capture on M1 (or RD) going high in addition to isolating the data bus.

If capturing address lines to try to find an instruction, capture on RD going low in addition to isolating the address bus.

Wednesday, November 28, 2018

My first Apple IIgs hardware fix

So when I was a kid, my dad bought an Apple IIgs for Christmas of 1986 and I loved that thing and used it until I finally gave up around 1993 and moved to a MS-DOS 486.

I still have this original machine and it's a ROM 01 machine which means it may have more game compatibility.  Apple also released a ROM 03 version which is newer, has more memory, but may not play every game that the ROM 01 could.  I decided to purchase a ROM 03 a year or so ago so that if my siblings ever came and demanded the ROM 01 family machine back, I'd still have a IIgs that I could call my own :)

Well, the ROM 03 IIgs came and I left it in a box for many months.  Finally, last Father's Day, I opened it and tried to show my kids some games.  That's when I discovered that it had a sound problem!

Fast forward to a week ago.  An accelerator board and a power supply replacement that I paid for literally 7 months ago finally showed up and I was eager to install it in my ROM 03.  But I decided that I really wanted to fix the sound problem before messing with the accelerator.

So I did some basic troubleshooting and this stuff was happening:



My first attempt to fix the problem was to simply de-solder the sound chip and socket it.



I've done this sort of thing several times on arcade PCBs so not only was I familiar with how to do it, but I already had a de-soldering gun along with several 40 pin sockets so I didn't have to wait for any parts to arrive.

Unfortunately, it did not fix my problem.

I wanted to replace the sound chip, but didn't want to destroy a working Apple IIgs.  Fortunately, someone was selling a "battery acid destroyed" IIgs motherboard on ebay, so I got it for fairly cheap.

The acid damage was really bad but it looked like the sound chip was still okay, so I desoldered it.


I plugged the replacement sound chip into my ROM 03 IIgs ...


and fired up the self-test...



Wow!  Despite thinking that replacing the sound chip would likely fix the problem, I was still a bit giddy to see that it actually worked! :)

I fired up a game to test the sound ...


and everything sounds great!

I'm one happy camper.

Now... to install that accelerator board... :)

Tuesday, October 2, 2018

How to dockerize Intel Quartus 18.01

I've been working with the Domesday Duplicator lately and one of the pieces of hardware that they use is the DE0-Nano board.  Domesday documentation focuses on linux tools so I booted into my Ubuntu and got the DE0-Nano IDE software (called 'Quartus') working.  While I was successful, I found it a bit of a pain to figure out which components of the software to download, and would've preferred a pre-built VM or a Docker image.  The Quartus license likely does not allow distribution of pre-built Docker images, so I have outlined the steps to create one from scratch here.

The benefits to running this program from a docker container are:
  • The docker image, once created, will likely work on many more platforms than what the native installation option offers.
  • Building and running the Docker image is relatively easy.
  • Installing and uninstalling is simple and clear.
So here are my instructions to Docker-ize Quartus v18.01:
  • Be using some linux flavor (I am on Ubuntu 18.04).
  • Install Docker and configure it so that normal users can access it (beyond scope of this blog post).
  • Create a file called /etc/udev/rules.d/51-usbblater.rules which has the following contents: (this file is necessary to allow non-root access to the USB device)

    SUBSYSTEM=="usb", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="0666"
  • Run "sudo udevadm control --reload-rules" to make the change take effect
  • Download Quartus 18.1 Lite for linux, including the Cyclone 4 package.  The filenames I downloaded are called QuartusLiteSetup-18.1.0.625-linux.run and cyclone-18.1.0.625.qdz .
  • Create a new subdirectory and copy QuartusLiteSetup-18.1.0.625-linux.run and cyclone-18.1.0.625.qdz into it.
  • Inside this subdirectory, create a file called Dockerfile and paste this into it:

     # ubuntu 18.04 is officially supported by this version of quartus
    # libpng12 included in 16.04 but not in 18.04, so we use 16.04 for convenience
    FROM ubuntu:16.04

    ENV DEBIAN_FRONTEND noninteractive

    ARG QUARTUS=QuartusLiteSetup-18.1.0.625-linux.run
    ARG CYCLONE=cyclone-18.1.0.625.qdz

    COPY $QUARTUS /$QUARTUS
    COPY $CYCLONE /$CYCLONE

    RUN apt-get update && \
        apt-get -y -qq install apt-utils sudo && \
            apt-get -y -qq install locales && locale-gen en_US.UTF-8 && \
        apt-get -y -qq install software-properties-common \
                               libglib2.0-0:amd64 \
                               libfreetype6:amd64 \
                               libsm6:amd64 \
                               libxrender1:amd64 \
                               libfontconfig1:amd64 \
                               libxext6:amd64 \
                                    libpng12-0:amd64 \
                               xterm:amd64 && \
        chmod 755 /$QUARTUS

    # create a normal user so we're not running as root
    RUN export uid=1000 gid=1000 && \
        mkdir -p /home/developer && \
        echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
        echo "developer:x:${uid}:" >> /etc/group && \
        echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
        chmod 0440 /etc/sudoers.d/developer && \
        chown ${uid}:${gid} -R /home/developer

    # switch to user so it installs from the user's context
    USER developer
    ENV HOME /home/developer
    # install quartus as the user (not root)
    RUN    /$QUARTUS --mode unattended --unattendedmodeui none --installdir /home/developer/altera_lite --accept_eula 1 && \
        sudo rm -f /$QUARTUS && \
        sudo rm -f /$CYCLONE

    # run from xterm to capture any stdio logging (not sure there is any, but can't hurt)
    CMD xterm -e "/home/developer/altera_lite/quartus/bin/quartus --64bit"
  • From within this subdirectory (which contains the three files), run this command:
    "docker build -t quartus18 ."
  • It will take ~15 mins depending on the speed of your system.  When it finishes, your Docker image will be generated and will be called "quartus18".  You may now optionally delete the sub-directory that you created to generate the docker image.
  • Plug in your DE0-Nano to a USB port.  Be sure to unplug any other sources of power (for example, the FX3 board, if you have a DdD 'stack' ) or you will get unexplained errors.
  • From a desktop session, run the following command:

    docker run --rm -v /sys:/sys:ro -v $HOME:/shared -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -e "QT_X11_NO_MITSHM=1" --privileged -v /dev/bus/usb:/dev/bus/usb quartus18
  • If all goes well, the Quartus app will launch inside of the container.  Your host's home folder will be accessible as /shared in the root.  Follow the instructions from DdD site.  You may also find this youtube video helpful.
  • When you exit the program, the container will automatically delete/uninstall itself.
The only thing left on your host system once you exit the container will be the file you put inside of /etc/udev/rules.d and the docker image that you created.  Uninstalling is as easy as removing this file and deleting the docker image.  Simply re-execute the "docker run" command above in the future to reprogram.