How to write a design into a NeTV2’s flash¶
You want a bitstream written to a NeTV2’s SPI flash, so that it survives a power cycle.
The write replaces the bitstream in the NeTV2’s own SPI flash. Step 3 first copies that bitstream region into backup.bin on the Pi, and you copy it to your own machine. This page is for someone setting up or looking after a NeTV2; a visitor to a site’s board page never writes the flash. Loading into SRAM only is on the Raspberry Pi 3B+ page and the Raspberry Pi 5 page.
This procedure is waiting for its run: test-designs issue #249.
What you need¶
A NeTV2 wired as on NeTV2 wiring to a Raspberry Pi, with openFPGALoader on the Pi. The pins are
27:22:4:17, in the orderTDI:TDO:TCK:TMS.The cable for your Pi:
-c rp1pioon a Raspberry Pi 5, from theopenfpgaloader-fpgasonline-gitpackage;--cable libgpiodon a Raspberry Pi 3B+.The FPGA’s part and the size of its bitstream region in bytes. An XC7A35T board is
xc7a35tfgg484and2228224; an XC7A100T board isxc7a100tfgg484and3866624.Which of the two your board is: its JTAG scan reads
0x0362d093on an XC7A35T and0x03631093on an XC7A100T (FPGA device variants).A bitstream, here
design.bit, no larger than the region.
Steps¶
On a Raspberry Pi 5, run
lspci -D -s 0001:01:00.0, the Pi 5’s PCIe slot. A line there is an endpoint to detach; no line, go to step 3.On a Raspberry Pi 5, detach it with
echo 1 | sudo tee /sys/bus/pci/devices/0001:01:00.0/remove. Runlspci -D -s 0001:01:00.0again: it prints nothing. If it still prints the line, stop.On the Pi, keep a copy of the bitstream region. Put your cable, part and size in place of
CABLE,PARTandSIZE.ls -l backup.binshowsSIZEbytes. Copybackup.binto your own machine: a netbooted Pi loses it at its next reboot.$ sudo openFPGALoader CABLE --pins 27:22:4:17 --fpga-part PART --dump-flash --file-size SIZE backup.bin
On a Raspberry Pi 5, run
lspci -D -s 0001:01:00.0again. If it prints a line, the endpoint came back after step 3: repeat step 2.On the Pi, write the bitstream to the flash and read it back. Without
--fpga-part, openFPGALoader writes nothing.$ sudo openFPGALoader CABLE --pins 27:22:4:17 --fpga-part PART --write-flash --verify design.bit
To put the old bitstream back, run step 4, then step 5 with backup.bin in place of design.bit.
Check¶
Step 5 prints no line with failed and no Can't program SPI flash. Read the output rather than the exit status: some openFPGALoader builds exit 0 after a failed write. That the FPGA then starts the design from flash at power-up waits for this page’s run (test-designs issue #249).
If it fails¶
What you see |
Likely cause |
Fix |
|---|---|---|
The Pi crashes or drops off during the write |
On a Raspberry Pi 5, the PCIe endpoint was still enumerated |
Detach it as in steps 1 and 2, then write again |
|
the command had no |
run it again with the part from What you need |
|
the flash does not hold what was written |
write again; if it fails again, write |