Glasgow

This guide was developed with revC1 hardware.

Reference

Get Toolchain

# see: https://github.com/open-tool-forge/fpga-toolchain/releases

read os <<< "linux"
read arch < <( uname -i )

read url < <(
  curl "https://api.github.com/repos/open-tool-forge/fpga-toolchain/releases/latest" \
    | jq -r \
      --arg os "${os}" \
      --arg arch "${arch}" \
      '
        .assets[]
          | select(.name | contains($os + "_" + $arch))
          | select(.name | endswith(".tar.gz"))
          | .browser_download_url
      '
)

curl -LO "${url}"
tar -xvf "${url##*/}"

export PATH="$(readlink -f ./fpga-toolchain/bin/):${PATH}"

yosys -V
nextpnr-ecp5 -V

udev Rules

Note

You only need to copy 99-cypress.rules if you plan to work with brand new boards, or use the glasgow factory subcommand.

cd ${GLASGOW_REPO_ROOT}
sudo cp -t /etc/udev/rules.d/ ./config/99-cypress.rules ./config/99-glasgow.rules
udevadm control --reload-rules

Virtual Environment

python3 -m venv venv
. venv/bin/activate

Build and Install Glasgow

Note

Allowing nMigen to be installed automatically (as a dependancy) will cause a version conflict on pyvcd... to resolve this, just install nMigen explicitly first

cd ${GLASGOW_REPO_ROOT}
cd ./software/
python3 setup.py sdist

pip install nmigen
pip install ./dist/glasgow-*.tar.gz

Factory Setup

Note

The --pinmap-straight flag used below depends on commit 6a8befd, which has not yet been merged.

Bug

The revC1 design currently has issues with the pins-int test - see #151. As running the other tests will prove this path out anyway, I'm content with skipping it.

glasgow factory --rev C1
glasgow flash

# power cycle the board, or unplug/plug it

# disconnect all pins
glasgow run selftest loopback pins-ext pins-pull

# connect A[0:7] -> B[0:7]
glasgow run selftest pins-loop --pinmap-straight

# connect AV -> AS, BV -> BS
glasgow run selftest voltage

Setup

Step 1 (loopback, pins-ext and pins-pull)

floating

Step 2 (pins-loop)

pins-loop

Step 3 (voltage)

voltage

Serial Number

The serial number is assigned by glasgow factory, and consists of the board revision and timestamp. For example: C1-20200923T174926Z.

Note

The serial number is not present until the glasgow utility has interacted with the board for the first time. If you see a zero-length serial number, then try running something innocuous like glasgow run selftest loopback.

The serial number can be passed to glasgow using the --serial flag to select a specific board that may be attached to the system.

At present, there is no way to list the boards connected using the glasgow tool, but it is possible to use lsusb, as follows:

lsusb -d 20b7:9db1 -v | sed -rne '/iSerial/{s/^  iSerial +[0-9]+ //g;p}'

I have opened an issue (#206) suggesting that we implement this feature.

serial