Difference between revisions of "Getting Started: Quartus Prime & OpenOCD"
From spiderboard.org
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Prerequisites == | == Prerequisites == | ||
− | * Quartus Prime | + | * [http://fpgasoftware.intel.com/?edition=lite Quartus Prime] |
− | * A SpiderSoM or MX10 with SpiderBase | + | * A [[Spiderboard_SoM|SpiderSoM]] or MX10<sup>[[Installing OpenOCD#MX10 Hardware Issue|[note]]]</sup> with [[Spiderboard_Baseboard|SpiderBase]] |
* One of the following: | * One of the following: | ||
− | ** [[Installing OpenOCD|OpenOCD]] (Linux | + | ** [[Installing OpenOCD|OpenOCD]] (Linux & Windows) |
** USB Blaster and Quartus Programmer | ** USB Blaster and Quartus Programmer | ||
+ | * a [https://shop.aries-embedded.de/tools/pmod/302/pmod-8ld Pmod 8LD], to connect to your SpiderBase, in case you want to see the blinking LEDs | ||
== Quartus Prime Project == | == Quartus Prime Project == | ||
<ol> | <ol> | ||
− | <li> Create a new Quartus Prime Project. Name the project ''Example'', this will set our top level entity for later. | + | |
+ | <li> Create a new Quartus Prime Project. Name the project ''Example'', this will set our top level entity for later. | ||
+ | <li> In ''Family, Device & Board Settings'', select Family "MAX 10" and then search for your FPGA. <br> | ||
+ | |||
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-new-project.png|x150px|thumb|Project and Top-Level-Entity are being set.]] </li> | ||
+ | <li style="display: inline-block;"> [[File:quartus-set-device.png|x150px|thumb|In this example the 10M08SAU169C8G FPGA is installed on the module.]] </li> | ||
+ | </ul></div> | ||
+ | |||
<li> Go to '' Assignments -> Device -> Device and Pin Options -> Voltage'' and select 3.3-V LVCMOS as Default I/O Standard. | <li> Go to '' Assignments -> Device -> Device and Pin Options -> Voltage'' and select 3.3-V LVCMOS as Default I/O Standard. | ||
<li> If you plan to use OpenOCD, you can enable automatically creating a .svf file. Under ''Device and Pin Options -> Programming Files'' select ''Serial Vector Format File (.svf)''. | <li> If you plan to use OpenOCD, you can enable automatically creating a .svf file. Under ''Device and Pin Options -> Programming Files'' select ''Serial Vector Format File (.svf)''. | ||
+ | |||
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-assignment-device.png|x150px|thumb]] </li> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-device-pin-options.png|x150px|thumb]] </li> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-set-voltage.png|x150px|thumb]] </li> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-enable-svf.png|x150px|thumb]] </li> | ||
+ | </ul></div> | ||
+ | |||
<li> Open the new file dialog and create a VHDL file. | <li> Open the new file dialog and create a VHDL file. | ||
<li> Copy and paste the code below. | <li> Copy and paste the code below. | ||
<li> Save the VHDL file. This file contains our top level entity ''Example'', which matches our project configuration. | <li> Save the VHDL file. This file contains our top level entity ''Example'', which matches our project configuration. | ||
− | <li> Run ''Analysis & Elaboration'' | + | <li> Run ''Analysis & Elaboration'', this will create nodes for pin assignment. |
<li> Open ''Pin Planner'' and edit the location for the existing signals: | <li> Open ''Pin Planner'' and edit the location for the existing signals: | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 39: | Line 56: | ||
|clk25 | |clk25 | ||
|PIN_H4 | |PIN_H4 | ||
− | | | + | |PIN_J12 |
|} | |} | ||
For a complete pin assignment table see [[Pin Assignment Table|here]]. | For a complete pin assignment table see [[Pin Assignment Table|here]]. | ||
− | <li> Run ''Compilation'' | + | |
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-bar-elaboration.png|x70px|thumb|Analysis & Elaboration]] </li> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-bar-planner.png|x70px|thumb|Pin Planner]] </li> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-pin-planner.png|x70px|thumb]] </li> | ||
+ | </ul></div> | ||
+ | |||
+ | <li> Run ''Compilation'' | ||
+ | |||
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:Quartus-bar-compilation.png|x70px|thumb|Compilation]] </li> | ||
+ | </ul></div> | ||
+ | |||
<li> The subfolder '''output_files''' now contains an Example.sof file, an Example.pof file and if enabled the respective .svf files.<br /> | <li> The subfolder '''output_files''' now contains an Example.sof file, an Example.pof file and if enabled the respective .svf files.<br /> | ||
− | .sof directly configures the FPGA. This configuration will be lost when the FPGA powers down. <br /> | + | .sof (.svf) directly configures the FPGA. This configuration will be lost when the FPGA powers down. <br /> |
− | .pof writes to flash memory. When the FPGA powers up, it will load the configuration stored in the flash memory. | + | .pof (_pof.svf) writes to flash memory. When the FPGA powers up, it will load the configuration stored in the flash memory. |
<li> After programming the FPGA via OpenOCD or USB Blaster the yellow LED on the base should start blinking and the green LED lights up if exactly one user button is pressed. | <li> After programming the FPGA via OpenOCD or USB Blaster the yellow LED on the base should start blinking and the green LED lights up if exactly one user button is pressed. | ||
</ol> | </ol> | ||
Line 67: | Line 96: | ||
− | architecture | + | architecture arch of Example is |
signal counter : integer range 1 to 12500000 := 1; | signal counter : integer range 1 to 12500000 := 1; | ||
Line 89: | Line 118: | ||
led(0) <= button(0) xor button(1); | led(0) <= button(0) xor button(1); | ||
− | end architecture | + | end architecture arch; |
</nowiki> | </nowiki> | ||
== Programming via OpenOCD == | == Programming via OpenOCD == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | If | + | # If not done already install and configure [[Installing OpenOCD|OpenOCD]]. |
+ | # Open a terminal and run the command | ||
+ | #: '''$''' mx10spider ''<path/to/file.svf>'' | ||
+ | # If your project for example is under ''/opt/quartus_projects/Example'' run either: | ||
+ | #: '''$''' mx10spider /opt/quartus_projects/Example/output_files/Example.svf | ||
+ | #: '''$''' mx10spider /opt/quartus_projects/Example/output_files/Example_pof.svf | ||
+ | #: for programming the ''.sof'' or ''.pof'' file respectively. | ||
− | + | <div><ul> | |
− | + | <li style="display: inline-block;"> [[File:terminal_oocd_success.png|thumb|Terminal after successfully running Example.svf]] </li> | |
− | + | </ul></div> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Programming via USB Blaster == | == Programming via USB Blaster == | ||
Line 190: | Line 141: | ||
# Click ''Hardware Setup...'' and select your USB Blaster, if there is none available you may need to start the jtag service. | # Click ''Hardware Setup...'' and select your USB Blaster, if there is none available you may need to start the jtag service. | ||
# Press Start | # Press Start | ||
+ | |||
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:spider-with-blaster.png|thumb|x160px|SpiderSoM and SpiderBase with USB-Blaster connected.]] </li> | ||
+ | <li style="display: inline-block;"> [[File:programmer-hwsetup.png|thumb|x170px]] </li> | ||
+ | <li style="display: inline-block;"> [[File:programmer-select-blaster.png|thumb|x170px]] </li> | ||
+ | <li style="display: inline-block;"> [[File:programmer-start-success.png|thumb|x170px]] </li> | ||
+ | </ul></div> |
Latest revision as of 18:02, 9 November 2021
Contents
Prerequisites
- Quartus Prime
- A SpiderSoM or MX10[note] with SpiderBase
- One of the following:
- OpenOCD (Linux & Windows)
- USB Blaster and Quartus Programmer
- a Pmod 8LD, to connect to your SpiderBase, in case you want to see the blinking LEDs
Quartus Prime Project
- Create a new Quartus Prime Project. Name the project Example, this will set our top level entity for later.
- In Family, Device & Board Settings, select Family "MAX 10" and then search for your FPGA.
- Go to Assignments -> Device -> Device and Pin Options -> Voltage and select 3.3-V LVCMOS as Default I/O Standard.
- If you plan to use OpenOCD, you can enable automatically creating a .svf file. Under Device and Pin Options -> Programming Files select Serial Vector Format File (.svf).
- Open the new file dialog and create a VHDL file.
- Copy and paste the code below.
- Save the VHDL file. This file contains our top level entity Example, which matches our project configuration.
- Run Analysis & Elaboration, this will create nodes for pin assignment.
- Open Pin Planner and edit the location for the existing signals:
Node Name SpiderSoM MX 10 button[1] PIN_A5 PIN_T13 button[0] PIN_B7 PIN_T7 led[1] PIN_L2 PIN_T6 led[0] PIN_L1 PIN_T12 clk25 PIN_H4 PIN_J12 For a complete pin assignment table see here.
- Run Compilation
- The subfolder output_files now contains an Example.sof file, an Example.pof file and if enabled the respective .svf files.
.sof (.svf) directly configures the FPGA. This configuration will be lost when the FPGA powers down.
.pof (_pof.svf) writes to flash memory. When the FPGA powers up, it will load the configuration stored in the flash memory. - After programming the FPGA via OpenOCD or USB Blaster the yellow LED on the base should start blinking and the green LED lights up if exactly one user button is pressed.
VHDL Code:
library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity Example is port ( clk25 : in std_logic; button : in std_logic_vector(1 downto 0); led : out std_logic_vector(1 downto 0) ); end entity Example; architecture arch of Example is signal counter : integer range 1 to 12500000 := 1; signal led_yellow : std_logic := '0'; begin process (clk25) begin if (clk25 = '1' and clk25'EVENT) then if (counter < 12500000) then counter <= counter + 1; else led_yellow <= not led_yellow; counter <= 1; end if; end if; end process; led(1) <= led_yellow; led(0) <= button(0) xor button(1); end architecture arch;
Programming via OpenOCD
- If not done already install and configure OpenOCD.
- Open a terminal and run the command
- $ mx10spider <path/to/file.svf>
- If your project for example is under /opt/quartus_projects/Example run either:
- $ mx10spider /opt/quartus_projects/Example/output_files/Example.svf
- $ mx10spider /opt/quartus_projects/Example/output_files/Example_pof.svf
- for programming the .sof or .pof file respectively.
Programming via USB Blaster
- Connect the USB Blaster to the JTAG Header on the SpiderBase.
- In Quartus Prime, open the Programmer (Tools -> Programmer).
- Choose whether you want to use the .sof or the .pof file.
- Click Hardware Setup... and select your USB Blaster, if there is none available you may need to start the jtag service.
- Press Start