
Lattice fpga dev board
Lattice ice40 up5k Raspberry Pi hat designed for using the secondary memory interface (SMI)
- Size
- 25.4 × 50.8 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 25
- Nets
- 46
- Pads
- 169
- Tracks, vias
- 343, 30
- Pours
- 1
- Routed
- Yes
- KiCad
- KiCad 5 (file 20171130)
- Created
- 4 Nov 2020
- Updated
- 11 Nov 2020
Overview
Lattice fpga dev board is an open-source printed circuit board by braingram, from the braingram/pi_smi_up5k repository on GitHub. It is a 2-layer board of 25.4 × 50.8 mm with 25 parts on 46 nets, routed with 343 tracks and 30 vias.
It is built around the ICE40UP5K-SG48ITR50 and 1N4148WT-7-CN. Its parts include 13 capacitors, 4 resistors, 3 ICs, 3 diodes and 2 connectors. It belongs with the fPGA and programmable logic and interfaces and adapters boards and the FPGA and CPLD boards of this library.
Main components
2README
README.mdAfter reading a post on iosoft.blog about the Raspberry Pi SMI interface I wanted to test out using the interface for exchanging data with a FPGA.
This project involves some hardware and software (in verilog and python) designed to test out the interface. There is no specific application for the project (although I'm open to suggestions).
Hardware
As described on the iosoft blog post SMI can use almost all the Pi GPIO pins. The only non-SMI pins are BCM pins 26 and 27. A FPGA hat was designed that connects to:
- all SMI pins
- BCM pin 27 as CRESET: to reset the FPGA
- BCM pin 26 as CDONE: to signify the FPGA programming is done
- 5V and GND for power
See pinouts.csv for a full pinout table. Depending on what Pi gpio pins your FPGA design uses you may have to disable several Pi interfaces by modifying /boot/config.txt, removing kernel modules, and/or directly changing gpio modes.
:exclamation: WARNING :exclamation: It is possible to have the Pi and FPGA fight to drive pins which can cause regulators to get hot and magic blue smoke to escape.
The hat uses a lattice ice40-up5k in a 48-pin QFN package. The remaining FPGA pins connect to:
- RGB led (using up5k led drivers)
- a 2x6 PMOD connector (:exclamation: WARNING :exclamation: the power and ground are swapped on the current design)
The hat does not include an oscillator and instead the up5k internal oscillator should be used.
FPGA bitstream
For generating bitstreams the open source icestorm and nextpnr tools were used. The hat also does not include spi flash to hold the FPGA bitstream and the SPI_SS pin of the FPGA is pulled low with a 10K resistor. To load a bitstream onto the FPGA the Pi pins must be setup for SPI and the bistream sent to the FPGA using a custom python script (similar to iceprog).
# enable SPI
sudo dtparam spi=on
# run in the same directory as program.py and provide a path to your bitstream file
python3 program.py bitstream.bitSoftware
The software for the project includes verilog and python code. The python program.py script is used to reset and program the FPGA over SPI. Other python scripts are included in some example project directories:
- blink: blink FPGA RGB leds
- testpins: test (almost) all FPGA/Pi connections
- spi: FPGA as spi peripheral
- spram: read FPGA SPRAM over spi
- smi: read incrementing counter on FPGA over smi
Each example project includes verilog code, a Makefile for building the bitstream and some contain python scripts for testing/interacting with the programmed FPGA.
SMI Notes
Using the SMI character device linux kernel modules
All of the testing used the bcm2835_smi and smi-dev kernel modules. To load the modules several Pi peripherals must be disabled (i2c, spi, uart, etc). When correctly loaded a character device should appear at /dev/smi This character device can be read from to initiate reads on the SMI bus and written to to initiate writes on the SMI bus. Settings can be changed by issuing ioctl system calls. Setting descriptions can be found in bcm2835_smi.h. Defaults for these settings can be found in bcm2835_smi.c. The ioctl magic number is 0x1 and 3 types of requests are accepted:
- 0x0100: get settings
- 0x0101: set settings
- 0x0102: address
Get/set settings expect a Settings struct/Structure (as described in bcm2835_smi.h) Address accepts an (up to 6 bit) address that will be asserted on the SMI bus during read/write cycles.
Pin electrical specs
Address pins
SA5:SA0 are normally high (3.3 volts) and are asserted just prior to and slightly after a read/write cycle (see the smi settings setup, hole, pace, and strobe settings). SA5 is the most significant bit and a 0 address bit results in a low (0 volt) signal. With the default settings the address bus asserts ~8 ns prior to the read/write signal (see below) and deasserts ~8 ns after the read/write signal inactivates.
It seems like the smi driver is OK with not commanding all address pins which could open up a few signals on the Pi.
Control pins [SOE/SE, SWE/SRW]
SOE/SE is normally high and goes low during a read cycle
SWE/SRW is normally high and goes low during a write cycle
For both signals and default settings the low period is ~24 ns.
Data pins
:exclamation: So far only pins SD0 to SD15 have been tested
These pins appear to be driven low when not in a read/write cycle which means the FPGA must release (put into high-z) these pins when not in a read cycle.
I'm not sure at what edge of SOE/SE the Pi reads the data pins but based off NAND datasheets and iosoft notes I think it's the rising edge of SOE/SE. This gives the FPGA ~24 ns from falling edge and ~32 ns from address assertion to assert the data lines.
Parts
25| Qty | Value | Footprint | References |
|---|---|---|---|
| 10 | 4.7u | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | C3, C4, C5, C6, C7, C8, C9, C10, C11, C13 |
| 3 | 0.1u | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | C1, C2, C12 |
| 1 | 100 | Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder | R2 |
| 1 | 10K | Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder | R1 |
| 1 | 10K | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | R4 |
| 1 | 1N4148WT-7 | Diode_SMD:D_SOD-523 | D1 |
| 1 | 2.2K | Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder | R3 |
| 1 | AP2127K-1.2 | Package_TO_SOT_SMD:SOT-23-5 | U3 |
| 1 | AP2127K-3.3 | Package_TO_SOT_SMD:SOT-23-5 | U2 |
| 1 | ICE40UP5K-SG48ITR | Package_DFN_QFN:QFN-48-1EP_7x7mm_P0.5mm_EP5.45x5.45mm | U1 |
| 1 | LED | LED_SMD:LED_0603_1608Metric_Pad1.05x0.95mm_HandSolder | D2 |
| 1 | LED_BGRA | LED_SMD:LED_Cree-PLCC4_3.2x2.8mm_CCW | D3 |
| 1 | PMOD | Connector_PinSocket_2.54mm:PinSocket_2x06_P2.54mm_Vertical | J2 |
| 1 | Raspberry_Pi_2_3 | Connector_PinSocket_2.54mm:PinSocket_2x20_P2.54mm_Vertical | J1 |
Similar boards
- 4 layers39.7 × 20.8 mm

- 4 layers62 × 22.2 mm

UPduino v3.01
tinyvision-ai-inc/UPduino-v3.0
UPduino 3.0: new 4 layer layout, various other improvements
113 parts365MIT - 6 layers122.5 × 103.5 mm

- 4 layers22.9 × 61 mm

- 4 layers27.9 × 63.5 mm

Pico2-ice
tinyvision-ai-inc/pico2-ice
Doc | Hardware | SDK | Schematic | Assembly | Discord
124 parts60MIT - 2 layers45 × 52.5 mm

Caravel breakout fpga ICE40UP5K TT3
TinyTapeout/breakout-pcb
Tiny Tapeout breakout PCBs
234 parts22Apache-2.0 - 4 layers100 × 100 mm

Pico Dev iCE
frohro/pico-dev-ice
This is a direct down conversion (DDC) HF transceiver & VNA using the Raspberry Pi Pico and the iCE40UP5K.
294 parts3 - 4 layers80 × 60 mm

Questions
How big is the Lattice fpga dev board PCB?
It measures 25.4 × 50.8 mm and has 2 copper layers, 1.6 mm thick.
What parts does the Lattice fpga dev board use?
25 parts, built around the ICE40UP5K-SG48ITR50 and 1N4148WT-7-CN. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Lattice fpga dev board KiCad files?
From the braingram/pi_smi_up5k repository on GitHub, at the commit this page was made from: the board is lattice_fpga_dev_board/lattice_fpga_dev_board.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Can I use the Lattice fpga dev board design in my own project?
Its repository states no licence, so its author keeps all rights: ask braingram before reusing the design.