Skip to content

Getting started with FOMU (an FPGA in your USB port)

Kees Jongenburger edited this page Oct 30, 2019 · 7 revisions

Introduction

This how-to guide is for people who want to get started running MicroPython on a FOMU

This tutorial is for the hacker type FOMU. Find out more about the different types of FOMUS.

Requirements

Hardware

  • A computer running Linux, Mac or Windows with a USB port
  • A FOMU of the hacker type

Teardown 2019 Workshop Files

The workshop files are available in the Teardown 2019 Workshop repository. You can clone them using git:

$ git clone https://github.com/xobs/teardown2019-workshop.git

Linux

Mac

Windows

Raspberry Pi

Add the Fomu Raspbian repo:

$ sudo mount -oremount,rw /
$ echo 'deb https://repo.fomu.im/debian/ stretch main' | sudo tee /etc/apt/sources.list.d/fomu.list
$ wget -O - https://repo.fomu.im/tomu-signing-key.asc | sudo apt-key add -

Or manually get the packages from the Fomu Repository.

  • riscv-toolchain
  • yosys
  • nextpnr-ice40
  • icestorm
  • picocom

TOMU Firmware

dfu-util -l
Found DFU: [1209:5bf0] name="Fomu DFU Bootloader v1.7.2"
$ dfu-util -D evt-installable.dfu
Download        [=========                ]  36%   38912 bytes
Download done.
$ dfu-util -l
Found DFU: [1209:5bf0] name="Fomu DFU Bootloader v1.8.1"
$

Micropython

Micropython is a work-in-progress port to Fomu. Currently the following features exist:

  • Manipulate RGB LED
  • Read SPI flash ID

Required Software

  • dfu-util
  • terminal emulator (screen, Tera Term, picocom, etc.)

Usage

To load Micropython, use dfu-util:

# If this is the first time loading Micropython
$ dfu-util -D micropython-fomu.dfu

# If Micropython has already been loaded
$ dfu-util -e

Then access the USB serial port using your serial program of choice.

$ sudo minicom --device /dev/ttyACM0

RISC-V

You can directly program the RISC-V softcore on Fomu. The VexRiscv implements an RV32I core with no multiply unit.

Required Software

Usage

The riscv-blink/ directory contains a simple "blink" program. This utilizes the LEDD hardware PWM block to produce a pleasing "fade" pattern. The riscv-blink/ example project is entirely self-contained. All you have to do is go into the directory and run make.

For a more advanced example, the riscv-usb-cdcacm/ directory contains a program that enumerates as a USB serial port. This simply echoes back any characters that are typed, adding 1 to the value. For example, if you send "a", it will respond with "b".

As with micropython, you can load these binaries with dfu-util -D output.bin.

HDL

HDL interfaces directly with the hardware. With Verilog, you have complete control over the chip. For easier debugging, LiteX lets you write in Python, which provides you with a USB debug bridge.

Required Software

The first is a simple Verilog blink, and is located in the verilog-blink/ directory. Go into this directory and run make FOMU_REV=???. You will need to specify the version of Fomu you're using. Once it is built, you can load the bitstream with dfu-util -D blink.bin.

Clone this wiki locally