Skip to content

brilliantlabsAR/monocle-factory-programmer

Repository files navigation

Monocle Factory Programming Jig

This is the jig used to program Monocles at the factory. Internally, it contains a Raspberry Pi, J-Link programmer, and FT232 breakout board for programming the FPGA. The interface consists of a button for initiating programming and an LED for displaying the status.

Operation:

Upon power-on, the jig automatically launches the programming application. Wait for the Green LED to illuminate, and then press the button to initiate the programming process.

During programming, the LED will become Amber. DO NOT remove the Monocle board during this period, otherwise it could damage the FPGA.

After some moments, the LED will change color to indicate the status of programming:

  • Green: The board was successfully programmed.
  • Red: The board is bad, and could not be programmed.
  • Blue There was an error with the programming jig. Re-power the jig, or check the internal wiring.

The Monocle board can now be removed, and another one inserted. Press the button again to start a new programming run.

Image of the Monocle factory programming jig

How it's built:

We built the jig using an off-the-shelf programming jig kit that can be purchased from websites like Alibaba and Taobao. These kits come in different shapes and sizes and can be customized with programmers, buttons, switches, and more. The kit we used even included some.

After assembling the bare jig, we added the electronics and 3D printed a PCB holder designed for the Monocle board. We also incorporated a "bed-of-nails" style array of pogo-pins that make contact with the PCB when the lever is dropped.

Pogo-Pin Array:

Image of the Monocle programmer pogo-pin array

3D Printed PCB Holder

Image of the 3D printed Monocle PCB holder

Wiring Diagram:

Image of the Monocle Programming Jig Wiring Diagram

Raspberry Pi Setup:

  1. Install Raspberry Pi OS Lite (64bit), using the Raspberry Pi Imager.

  2. Connect to the Raspberry Pi via SSH over your network:

ssh brilliant@brilliant.local
  1. Update the Raspberry Pi:
sudo apt update
sudo apt full-upgrade
sudo apt clean
  1. Install openFPGALoader:
sudo apt install \
  git \
  gzip \
  libftdi1-2 \
  libftdi1-dev \
  libhidapi-hidraw0 \
  libhidapi-dev \
  libudev-dev \
  zlib1g-dev \
  cmake \
  pkg-config \
  make \
  g++

git clone https://github.com/trabucayre/openFPGALoader ~/downloads/openfpgaloader
cd ~/downloads/openfpgaloader
mkdir build
cd build
cmake ..
cmake --build .

sudo make install
  1. Install the nRF Command Line Tools:
wget -O ~/downloads/nrf_command_line_tools.deb \
  https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-22-0/nrf-command-line-tools_10.22.0_arm64.deb

sudo dpkg -i ~/downloads/nrf_command_line_tools.deb

sudo apt install /opt/nrf-command-line-tools/share/JLink_Linux_V780c_arm64.deb --fix-broken

sudo sh -c 'dpkg --fsys-tarfile /opt/nrf-command-line-tools/share/JLink_Linux_V780c_arm64.deb | tar xOf - ./etc/udev/rules.d/99-jlink.rules > /etc/udev/rules.d/99-jlink.rules'
  1. Install Python libraries:
sudo apt install python3-pip
sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel-spi
  1. Enable SPI via raspi-config and enable user group:
sudo usermod -aG gpio,spi,plugdev <USER>
sudo raspi-config
  1. Download the latest release files:
wget -O ~/monocle_micropython_power_only.hex \
  https://raw.githubusercontent.com/brilliantlabsAR/monocle-factory-programmer/main/monocle_micropython_power_only.hex

curl -s https://api.github.com/repos/brilliantlabsAR/monocle-micropython/releases/latest \
  | grep "browser_download_url.*hex" \
  | cut -d : -f 2,3 \
  | tr -d \" \
  | wget -O ~/monocle_micropython_latest.hex -i -

# TODO change this to the latest release, once it's ready
wget -O ~/monocle_fpga_image_latest.fs \
  https://github.com/brilliantlabsAR/monocle-fpga/releases/download/v230117/fpga_proj.fs
  1. Download the programming script:
wget -O ~/programming_script.py \
  https://raw.githubusercontent.com/brilliantlabsAR/monocle-factory-programmer/main/programming_script.py
  1. Configure the user's .bashrc to run the script upon power on:
echo python ~/programming_script.py >> ~/.bashrc
  1. Open raspi-config and enable Console Autologin under System Options -> Boot / Auto Login.

  2. Open raspi-config and enable Overlay File System under Performance Options.

  3. Restart and hit the button to see if it worked!

About

Details around the jig used for programming Monocles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages