Crates.io | iceprogrs |
lib.rs | iceprogrs |
version | 0.1.1 |
source | src |
created_at | 2023-01-03 15:51:15.406017 |
updated_at | 2023-03-06 12:42:18.399643 |
description | SPI-based SRAM programmer for Lattice iCE40 family FPGAs |
homepage | |
repository | https://github.com/berke/iceprogrs |
max_upload_size | |
id | 750226 |
size | 23,359 |
SPI-based SRAM programmer for Lattice iCE40 family FPGAs.
This works like iceprog
but does not require an FTDI chip as
provided on the usual development boards. It uses GPIO lines and an
SPI device through the spidev
and gpiochip
Linux kernel drivers,
using the spidev
and gpiod-rs
crates.
You need the following:
spidev
, of which
SCK
(clock) line is connected to the SPI_SCK
pin of the iCE40MOSI
(or data out) line is connected to the SPI_SI
pin of the iCE40SS_B
pinCREST
pinThe SPI slave select line is NOT used because that signal needs to stay low during the transfers. In normal SPI usage, the slave select line is released between packets (bytes).
However on many devices you can configure the pins you see fit, so you
could use a pin labeled SS
as a GPIO pin.
SCK
), R4 (to get SS_B
),
R5 (to get CDONE
) and R6 (to get CREST
)CDONE
to VCCIO (the voltage used for SPI, typically 3.3V)SDO
to pin 4 of J6 (Northwest)Configure your pins as follows. I recommend placing 100 to 150 ohm series resistors for protection and signal integrity near the Beaglebone.
config-pin P9.17 gpio
config-pin P9.18 spi
config-pin P9.21 spi
config-pin P9.22 spi_sclk
config-pin P9.23 gpio
Connect them as follows:
BBone pin | Type | iCE40 pin |
---|---|---|
P9.17 | GPIO | SS_B |
P9.18 | SPI | SDO |
P9.22 | SPI | SCK |
P9.23 | GPIO | CREST |
P9.2 | Ground | GND |
Run the command:
./iceprogrs --bitstream blinky.bin --spi-speed 5000000
Works at 5 MHz with 20 to 30 cm worth of improvised wires.
Berke DURAK bd@exhrd.fr