This is a forked project to support Hermes-Lite 2.0 FPGA programming with a Raspberry Pi. See the origial github and Altera documentation for background information.
You can compile this on your Raspberry Pi. You must have build-essentials installed, sudo apt-get install build-essentials
. To compile, cd jam-stapl/source
then make -f Makefile.RPi
. This will build the exectuable jam
in that subdirectory.
You must connect pins from the Raspberry Pi GPIO header to programming header CN1 on the Hermes-Lite 2.0.
Signal | Raspberry Pi Header Pin | Hermes-Lite 2.0 CN1 Pin |
---|---|---|
TCK | 22 | 1 |
TDO | 24 | 3 |
TMS | 26 | 5 |
TDI | 28 | 9 |
GND | 20,30 | 2,10 |
The GPIO pins used on the Raspberry Pi are 6 pins in line (20, 22, 24, 26, 28, 30) on the outer edge of the board. Pin 1 of CN1 on the HL2 board is marked with a dot and is the closest pin to the ethernet jack. A simple way to connect the pins would use 6 female to female breadboard jumper wires. A harness could also be created using dupont connectors for repeated use.
Raspberry Pi Header Pin | Hermes-Lite 2.0 CN1 Pin |
---|---|
20 | 2 |
22 | 1 |
24 | 3 |
26 | 5 |
28 | 9 |
30 | 10 |
Both the Raspberry Pi and Hermes-Lite 2.0 must be powered on and connected to program. You must also download to the Raspberry Pi the desired .jam firmware file. Look in the release subdirectory and then the Hermes-Lite 2.0 version subirectory for the .jam file.
Programming is done in two steps. First the FPGA is configured to talk to the serial EEPROM. Next the EEPROM is programmed through the FPGA.
- Configure
Execute on the Raspberry Pi:
sudo ./jam -aconfigure <yourjamfile.jam>
- Program
Execute on the Raspberry Pi:
sudo ./jam -aprogram <yourjamfile.jam>
If there are any errors, check your connection between the Raspberry Pi and Hermes-Lite 2.0. This connection must be solid for the programming to be successful. Also, try again as subsequent attempts may not experience errors.
This code has been tested on a Raspberry Pi 3 Model B. For older Raspberry Pi models, you may need to change the BCM2708_PERI_BASE back to 0x20000000 as in the original code. See jamgpio.c:
#define BCM2708_PERI_BASE 0x20000000
You can change the pins used for JTAG communication in jamgpio.c. See the defines starting at #define TCK
. Note that Broadcom SOC GPIO numbering is different from the 40-pin header numbering. See the Raspberry Pi documentation for more details.
There is a hardcoded delay for the JTAG clock TCK in jamstub.c:
// Pulse TCK
delay_loop(10);
gpio_set_tck();
delay_loop(10);
gpio_clear_tck();
This delay may be increased if you experience programming failures.