Fomu: an FPGA in your USB Port

Fomu (with case): an FPGA in your USB port. Crowdfunding now! One week to go. t.xobs.io/fomu

Fomu: An FPGA in your USB Port

A whirlwind introduction to Fomu and FPGAs

Sean Cross - https://xobs.io/ - @xobs

Outline

  1. Fomu Firmware Layout
    1. Bootloader
    2. Recovery
    3. Magic constants
    4. Interpreters
    5. Updates
  2. Loading firmware onto Fomu
  3. Blinkenlights

Workshop Outline

  1. What do I need to get started?
  2. What is Fomu, and what is an FPGA?
  3. What can I do with Fomu?
  4. What makes Fomu special?

What do I need to get started?

  1. Synthesis
  2. Place-and-Route
  3. Packer

What is an FPGA?

An FPGA is like a hardware emulator. It can change itself so that it can take on the characteristics of any other digital logic.

FPGAs are measured in resources called LUTs or LCs.

What is Fomu?

Fomu is an FPGA that fits in your USB port. It has foru buttons, 2 MB of SPI flash, an RGB LED, and an ICE40UP5K with 5280 LCs. It also has 128 kB of dedicated RAM, not counting the block RAM. Unlike many other PCBs, Fomu does not have a separate USB controller chip. This means that any projects that want to use the USB port must include a USB softcore.

Fomu Block Design Diagram

ICE40 Features

What is this PCB?

This is Fomu EVT1. This is the original stretch prototype of Fomu. The schematics are the same, but much has changed: * Name changed from Tomu-FPGA to Fomu * Package changed from SG48 to WLCSP32 Additionally, some patches were needed to get this PCB working: * SO-8 for SPI flash was too small * Crystal footprint was upside-down These are yours to take home with you! Differences between EVT1 and EVT3: * Silkscreen on Raspberry Pi header * Populate Raspberry Pi header * Add PMOD pins to touchpads * Swap PMODa pins for I3C

What modifications does it have?

  • Shorting out two zero-ohm resistors
  • Programming SPI flash
  • Bending SPI flash pins inward
  • Mounting crystal on its side
  • Attaching power to crystal

Working with Fomu

"fail safe" bootloader

Using dfu

Updating Fomu

sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢  [10:45] ❯ dfu-util -l dfu-util 0.9 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ Found DFU: [1209:5bf0] ver=0101, devnum=16, cfg=1, intf=0, path="1-1.1.2", alt=0, name="Fomu DFU Bootloader v1.7.2", serial="UNKNOWN" sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢  [10:45] ❯ dfu-util -D .\pvt-installable.dfu dfu-util 0.9 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ Match vendor ID from file: 1209 Match product ID from file: 5bf0 Opening DFU capable USB device... ID 1209:5bf0 Run-time device DFU version 0101 Claiming USB DFU Interface... Setting Alternate Setting #0 ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing DFU mode device DFU version 0101 Device returned transfer size 1024 Copying data from PC to DFU device Download [========= ] 36% 38912 bytes Download done. state(7) = dfuMANIFEST, status(0) = No error condition is present state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present Done! sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢  [10:45] ❯ dfu-util -l dfu-util 0.9 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ Found DFU: [1209:5bf0] ver=0101, devnum=14, cfg=1, intf=0, path="1-1.1.2", alt=0, name="Fomu DFU Bootloader v1.8.1", serial="UNKNOWN" sean@PAZUZU  ~\Code\Fomu\foboot\releases\v1.8.1   master ≢  [10:47] ❯

Levels of Fomu

Fomu aims to be accessable on three levels:

  1. Python / Interpreted
  2. RISC-V
  3. Verilog / FPGA

Python / Interpreted

  1. Goal: Multiple interpreters, auto-reload, USB disk interface
  2. Now: MicroPython binary

Loading Programs onto Fomu

dfu-util -l dfu-util -D update.bin

Loading MicroPython

dfu-util -D micropython.dfu

Connecting via serial

Interacting with Fomu

RGB LEDD reference

Future Work

CircuitPython, etc.

RISC-V code

LiteX Machine Model

Wishbone Interface

Wishbone Bridge

Interacting with LEDD directly

Writing RISC-V Code

Hardware Description Language

Yosys and NextPNR

Blinking an LED

LiteX and MiGen

VexRiscv