Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

output GPIO on DE2

Altera_Forum
榮譽貢獻者 II
4,042 檢視

Hello I m trying to use the output GPIO on the DE2 board and cannot even get the clock to output. I have pin one out of a breakout board running through a 1k and then to Comm.  

 

My code was immensely simple 

 

GPIO_1(1) <=clock_27; 

 

Is there something wrong? Is there a spefic string of code I need to output anything? 

 

 

 

Thanks
0 積分
12 回應
Altera_Forum
榮譽貢獻者 II
1,725 檢視

 

--- Quote Start ---  

Hello I m trying to use the output GPIO on the DE2 board and cannot even get the clock to output. I have pin one out of a breakout board running through a 1k and then to Comm.  

 

My code was immensely simple 

 

GPIO_1(1) <=clock_27; 

 

Is there something wrong? Is there a spefic string of code I need to output anything? 

 

--- Quote End ---  

What is the pin assignment? Perhaps you have a typo. 

 

Is this a DE2, DE2-70, or DE2-115? 

 

Here's a snippet from my DE2 pin assignments ... 

 

set pin(gpio_a(0)) D25 set pin(gpio_a(1)) J22 set pin(gpio_a(2)) E26 set pin(gpio_a(3)) E25 ... set pin(gpio_b(0)) K25 set pin(gpio_b(1)) K26 set pin(gpio_b(2)) M22 set pin(gpio_b(3)) M23 and my DE2-70 

 

set pin(gpio_a(0)) C30 set pin(gpio_a(1)) C29 set pin(gpio_a(2)) E28 set pin(gpio_a(3)) D29 ... set pin(gpio_b(0)) G27 set pin(gpio_b(1)) G28 set pin(gpio_b(2)) H27 set pin(gpio_b(3)) L24 Cheers, 

Dave
Altera_Forum
榮譽貢獻者 II
1,725 檢視

The board is just a plain old DE2 board. THey have since come out with the DE2 70 board.  

 

I cannot get anything to output at all. I checked the Pin list and it's fine. I also checked the labeling. It is GPIO_0 or GPIO_1  

 

Do I assign like this? 

GPIO_1(1) <=clock_27; 

 

or this  

clock_27 => GPIO_1(1) ; 

 

Thanks
Altera_Forum
榮譽貢獻者 II
1,725 檢視

 

--- Quote Start ---  

 

Do I assign like this? 

GPIO_1(1) <=clock_27; 

 

--- Quote End ---  

 

 

Yep, like that. 

 

Perhaps clock_27 has an issue. 

 

Why not start with 

 

GPIO_1(0) <= '0'; GPIO_1(1) <= '1';  

 

And see if you get the two different voltage levels on your GPIO pins. 

 

If you don't want to probe with a voltmeter or scope, use the LEDs. 

 

Cheers, 

Dave
Altera_Forum
榮譽貢獻者 II
1,725 檢視

Here's a 'basic' example for the DE2 board. Here's how to compile it: 

 

1) Download and unzip the file, eg., into c:/temp/de2_basic 

 

2) Start Quartus and select the Tcl console. If its not visible, bring it up using View->Utility Windows, Tcl console 

 

3) Change to the source folder, eg., 

 

tcl> cd {c:/temp/de2_basic} 

 

(The {} pass the path to Tcl as a string, allowing it to expand correctly under Windows. Its not needed under Linux.) 

 

4) Build the design 

 

tcl> source scripts/synth.tcl 

 

5) Download the design. 

 

Pressing the buttons on the board will change the hex display values. 

 

Cheers, 

Dave 

 

EPCS programming instructions (added 3/10/14) 

1. Download de2_basic.zip 2. Unzip into c:/temp/de2_basic 3. Start Quartus 4. Select the Tcl console If the Tcl console is not visible, make it visible via View->Utility Windows->Tcl console 5. Change directory to the zip folder tcl> cd {C:\temp\de2_basic} 6. Source the synthesis script tcl> source scripts/synth.tcl The script will output the following: Synthesizing the DE2 'basic' design ----------------------------------- - Creating the Quartus work directory - Create the project 'de2' * create a new de2 project - Creating the VHDL files list - Applying constraints - Processing the design - Processing completed 7. Download the configuration using JTAG a) Plug in your DE2 board b) Start the programmer Tools->Programmer c) Check that the USB-Blaster is detected The "Hardware Setup" should have text next to it that says "USB-Blaster ". If it has "None", then click the "Hardware Setup" button and configure the programmer to use the DE2 USB-Blaster d) Click the "Auto Detect" button in the programmer The programmer should detect an EP2C35F672 and be ready to download the file de2.sof e) Make sure the RUN/PROG button is in the RUN position f) Click the "Start" button The "basic" design connects the switches to the LEDs, and the push-button switches to the 7-segment displays. Toggle a switch and see that the LEDs change. Push a push-button and see that the 7-segment displays change. 8. EPCS programming To program the EPCS device a) Change the RUN/PROG button to PROG b) In the programmer window, change the "Mode" to "Active Serial Programming" c) Click on the "Add File" button and add the file de2.pof This adds the DE2 file to the GUI. Note that the "Device" is EPCS16. d) Check the "Program/Configure" and "Verify" check buttons The programmer will always erase the device, so the "Erase" button is optional e) Click the "Start" button. If you forgot to change the RUN/PROG button you will see the following error in the Quartus messages window: Info (209060): Started Programmer operation at Mon Mar 10 13:20:37 2014 Error (209025): Can't recognize silicon ID for device 1 Error (209012): Operation failed If you did everything correct, you will see Info (209060): Started Programmer operation at Mon Mar 10 13:20:46 2014 Info (209018): Device 1 silicon ID is 0x14 Info (209044): Erasing ASP configuration device(s) Info (209024): Programming device 1 Info (209022): Performing verification on device 1 Info (209018): Device 1 silicon ID is 0x14 Info (209011): Successfully performed operation(s) Info (209061): Ended Programmer operation at Mon Mar 10 13:21:06 2014 f) Change the PROG/RUN button back to RUN g) Cycle power Viola, the board loads the "basic" design.
Altera_Forum
榮譽貢獻者 II
1,725 檢視

Hello, 

 

The DE2 basic pin list is incorrect. I will not load on the machine and brings a number of errors up I cannot fix
Altera_Forum
榮譽貢獻者 II
1,725 檢視

Here is what I have been using. There is an error with the if statement and I have no idea what it is  

 

LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.numeric_std.all; entity DE2_top is Port( --//////////////////////// Clock Input //////////////////////// CLOCK_27 :in std_logic; -- 27 MHz CLOCK_50 :in std_logic; -- 50 MHz EXT_CLOCK :in std_logic; -- External Clock -- //////////////////////// Push Button //////////////////////// KEY :in std_logic_vector( 3 downto 0); --Pushbutton --//////////////////////// DPDT Switch //////////////////////// SW :in std_logic_vector( 17 downto 0 ); --Toggle Switch --//////////////////////// 7-SEG Dispaly //////////////////////// HEX0 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 0 HEX1 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 1 HEX2 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 2 HEX3 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 3 HEX4 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 4 HEX5 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 5 HEX6 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 6 HEX7 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 7 --//////////////////////////// LED //////////////////////////// LEDG :out std_logic_vector( 8 downto 0); --LED Green LEDR :out std_logic_vector( 17 downto 0); --LED Red --//////////////////////////// LED //////////////////////////// GPIO_0 :inout std_logic_vector(35 downto 0); GPIO_1 :inout std_logic_vector(35 downto 0) ); end DE2_top; architecture struct of DE2_top is begin -- GPIO (expansion headers) if sw(1) /= '0'then gpio_0 <= (others => 'Z'); gpio_1(0) <= '1'; gpio_1(1) <= '1'; gpio_1(2) <= '1'; gpio_1(3) <= '1'; else gpio_1(0) <= '0'; gpio_1(1) <= '0'; gpio_1(2) <= '0'; gpio_1(3) <= '0'; end if; end;
Altera_Forum
榮譽貢獻者 II
1,725 檢視

 

--- Quote Start ---  

 

The DE2 basic pin list is incorrect. 

 

--- Quote End ---  

In what way? The Tcl pin list was generated from the schematic (with minor renaming of signals). 

 

Note that there are several versions of the DE2 board. I recall seeing a CD release for two different revisions of board. My board will be one of the originals. I can check the board tomorrow if you'd like. 

 

 

--- Quote Start ---  

 

I will not load on the machine and brings a number of errors up I cannot fix 

--- Quote End ---  

I checked place-and-route on Quartus 11.0sp1 and it worked fine.  

 

What version are you using? 

 

Cheers, 

Dave 

 

PS. Here's what Quartus 11.0sp1 and 10.1 output: 

Synthesizing the DE2 'basic' design ----------------------------------- - Creating the Quartus work directory - Create the project 'de2' * create a new de2 project - Creating the VHDL files list - Applying constraints - Processing the design - Processing completed
Altera_Forum
榮譽貢獻者 II
1,725 檢視

 

--- Quote Start ---  

Here is what I have been using. There is an error with the if statement and I have no idea what it is. 

 

--- Quote End ---  

If statements need to be inside a process. Try the following: 

 

LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.numeric_std.all; entity DE2_top is Port( --//////////////////////// Clock Input //////////////////////// CLOCK_27 :in std_logic; -- 27 MHz CLOCK_50 :in std_logic; -- 50 MHz EXT_CLOCK :in std_logic; -- External Clock -- //////////////////////// Push Button //////////////////////// KEY :in std_logic_vector( 3 downto 0); --Pushbutton --//////////////////////// DPDT Switch //////////////////////// SW :in std_logic_vector( 17 downto 0 ); --Toggle Switch --//////////////////////// 7-SEG Dispaly //////////////////////// HEX0 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 0 HEX1 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 1 HEX2 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 2 HEX3 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 3 HEX4 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 4 HEX5 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 5 HEX6 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 6 HEX7 :out std_logic_vector( 6 downto 0); --Seven Segment Digit 7 --//////////////////////////// LED //////////////////////////// LEDG :out std_logic_vector( 8 downto 0); --LED Green LEDR :out std_logic_vector( 17 downto 0); --LED Red --//////////////////////////// LED //////////////////////////// GPIO_0 :inout std_logic_vector(35 downto 0); GPIO_1 :inout std_logic_vector(35 downto 0) ); end DE2_top; architecture struct of DE2_top is begin -- GPIO (expansion headers) process(sw) begin -- Default state gpio_1 <= (others => 'Z'); if sw(1) /= '0'then gpio_1(3 downto 0) <= (others => '1'); else gpio_1(3 downto 0) <= (others => '0'); end if; end process; -- Unused outputs gpio_0 <= (others => 'Z'); ledr <= (others=> '0'); ledg <= (others=> '0'); hex1 <= (others => '0'); -- and so on for the other hex ports end; Untested of course :) 

 

Note that *all* outputs and bidirectionals must be driven; either with a logic level or tri-state. Look at the example I sent you. 

 

Connect the switches to the LEDs, and that'll be easier to see. 

 

 

 

Cheers, 

Dave
Altera_Forum
榮譽貢獻者 II
1,725 檢視

Dave, 

 

Thanks for your help. I checked my breakout board and it works and is labeled correctly I double checked the pin list and the schematics and it is correct. Still when I hold a multi-meter across the com and 00 or 01 and flip switch 1 I see no change in voltage. Is the pin floating? I cannot get anything from the pins. Am I using the wrong comms? are certain grounds only for certain pins? This is really confusing and frustrating. Are the pins sinking only? How should I go about checking them? 

 

Thanks  

 

Bill
Altera_Forum
榮譽貢獻者 II
1,725 檢視

Hi Bill, 

 

--- Quote Start ---  

 

Is the pin floating? I cannot get anything from the pins. Am I using the wrong comms? are certain grounds only for certain pins? This is really confusing and frustrating. Are the pins sinking only? How should I go about checking them? 

 

--- Quote End ---  

 

 

You're going about things the right way. 

 

I would do the following; 

 

1) Make sure the LEDs and 7-segment displays work like I would expect. For example, there are the same number of switches as there are LEDs, so per the example I sent you, add this line to your project and re-synthesize: 

 

led_r <= sw(17 downto 0); 

led_g <= sw(8 downto 0); 

 

2) Check the pin assignments in the final place-and-route design. Quartus will generate a .pin file. Check a few of the switch and LED connections. 

 

3) Download to the board. Toggle a few switches. If the LEDs toggle, then you've confirmed that at least something is working. 

 

4) Look at the DE2 schematic. Determine which bank(s) power the GPIOs. Check that bank power supply is working. 

 

Hope that helps! 

 

Cheers, 

Dave
Altera_Forum
榮譽貢獻者 II
1,725 檢視

I figured out my problem. Apparently certain grounds are only for certain pins. I poked around the breakout board and figured this out. .... I learned something today:-P 

 

Thanks for your time Dave!
Altera_Forum
榮譽貢獻者 II
1,725 檢視

 

--- Quote Start ---  

I figured out my problem. Apparently certain grounds are only for certain pins. I poked around the breakout board and figured this out. .... I learned something today:-P 

 

--- Quote End ---  

 

 

What!? They should not be called ground in that case! 

 

So I assume this problem was this on the breakout board? 

 

In hindsight, would you have seen this if you had been probing at the GPIO connector on the DE115? 

 

Cheers, 

Dave
回覆