-2
\$\begingroup\$

I know how to turn on the fpga LEDS using push buttons and switches. I'm still having trouble figuring out how can I receive a signal from the buttons to the expansion connectors. Also, how should I modify the UCF?

Basically, how can I connect the expansion connector pins on spartan 3 fpga in order to turn on an external LED using the spartan 3 push buttons?

\$\endgroup\$
  • 2
    \$\begingroup\$ There aren't any "expansion connector pins" or LED-specific pins on a Spartan 3 FPGA. You're talking about a specific design. Figure out what the name of the actual board you have is. \$\endgroup\$ – darron Nov 23 '13 at 20:04
  • \$\begingroup\$ I just want to use the 20 pins from A1 and A2 in the Spartan-3 Starter Board to toggle a led on my breadboard. I already know how to toggle the LEDS from the Spartan-3 but not an external LED. \$\endgroup\$ – EMPV Nov 23 '13 at 20:10
  • \$\begingroup\$ Which Spartan 3 starter board do you have? Would be useful to link it from your question. \$\endgroup\$ – David Nov 23 '13 at 21:00
  • \$\begingroup\$ I'm using Spartan3 Device: XC3S200 Package: FT256 \$\endgroup\$ – EMPV Nov 23 '13 at 21:07
  • \$\begingroup\$ Why is it so difficult to tell ppl what board you are using rather than wasting everyone time by saying it is a spartan 3 FPGA . If you know the name of your board, then at LEAST you should mention it here or do a simple search for your board and I bet you find 100 of examples of similar projects. \$\endgroup\$ – FarhadA Nov 23 '13 at 21:18
1
\$\begingroup\$

The following code written for the Basys 2 board which is a Spartan 3E board BUT you will have to modify the constraints to fit your board. Just choose a IO pin and a button on your board to use.

All you have to do is pass your button value onto your IO pin like so:

PIO <= btn;

This will make so when your button is HIGH, your IO pin will be as well and vice versa for LOW.

Here is a simple demo project that uses this principle. It has been tested on the Basys 2. Just hook up your LED to the IO pin and Ground.

VHDL top module:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity buttonLED_top is
    PORT(
        PIO: out std_logic;
        btn: in std_logic
    );
end buttonLED_top;

architecture Behavioral of buttonLED_top is

begin
    -- This is where we connect the button to the LED
    -- Make sure to connect your LED to the IO pin and Ground
    PIO <= btn;

end Behavioral;

Constraints (ucf):

# Connect your LED to B2 and GND
# Pin B2
NET "PIO" LOC = "B2" | PULLDOWN;

# Push Button 0
# This will be used to activate the LED
NET "btn" LOC = "G12";
\$\endgroup\$
  • \$\begingroup\$ I have pins in A1 A2 B1 B2, these pins range from PB1-PB38 (aditionally to VDD and GND). Your module is pretty much identical to the one i had, what I think is missing is what LOC pins from the ones mentioned above should I assign my "PIO" when writing my UCF. \$\endgroup\$ – EMPV Nov 23 '13 at 20:57
  • \$\begingroup\$ You should change the LOC for "PIO" in the contraints file to whatever pin you are going to use for the LED. \$\endgroup\$ – MLM Nov 23 '13 at 22:50
0
\$\begingroup\$

If it's a mainstream starter board, you should be able to find a manual for it online. Said manual should have a full schematic, and pin outs for all connectors. This will let you map specific pins of the 'expansion connector' to specific pins on the FPGA. After that you only need to associate a net name to the pin location in the UCF file.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.