cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ftamulonis
Visitor
Visitor
3,862 Views
Registered: ‎10-22-2013

LED_blink Code

Jump to solution

Hi Everyone. I am having some problems with my LED blink code. The main problem happens when after successfully downloading the program onto my FPGA and pressing the PROG button the LEDs light up faintly then turn off. I am using the Spartan-6 SP605 development board with the XC6SLX45T FPGA. Here is my code: 

 

--------------------------------------------------------------

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity Top is
Port ( CLK_50Mhz : in STD_LOGIC;
LED : out STD_LOGIC);
end Top;

architecture Behavioral of Top is
signal Counter: std_logic_vector(24 downto 0);
signal CLK_1Hz: std_logic;
begin
Prescaler: process(CLK_50MHz)
begin
if rising_edge(CLK_50MHz) then
if Counter < "1011111010111100001000000" then
Counter <= Counter + 1;
else
CLK_1Hz <= not CLK_1Hz;
Counter <= (others => '0');
end if;
end if;
end process Prescaler;

LED <= CLK_1Hz;


end Behavioral;

 

------------------------------------------------------------ 

 

and here is the UCF file : 

NET "CLK_50Mhz" LOC = "M20";
NET "LED" LOC = "D17";

 

--------------------------------------------------------------

 

 

Overall i would like the LED located at D17, which I think is the DS3 user LED to blink on and off . 

 

 

For Connection purposes I am using USB to JTAG cable. 

 

 

0 Kudos
1 Solution

Accepted Solutions
ftamulonis
Visitor
Visitor
4,896 Views
Registered: ‎10-22-2013

I got it to work. I just had to change the clock definition. 

 

 

Thank you everyone

View solution in original post

0 Kudos
5 Replies
mcgett
Xilinx Employee
Xilinx Employee
3,857 Views
Registered: ‎01-03-2008

> The main problem happens when after successfully downloading the program onto

> my FPGA and pressing the PROG button the LEDs light up faintly then turn off.

 

When you press the PROGRAM button on the board are you erasing the bitstream that you just downloaded.  Don't do that.

------Have you tried typing your question into Google? If not you should before posting.
Too many results? Try adding site:www.xilinx.com
0 Kudos
ftamulonis
Visitor
Visitor
3,853 Views
Registered: ‎10-22-2013

Thank you mcgett. I did look on google and Xilinx but I could not find any solutions for this specific board (Sp-605).

 

 

How will I know that the program has run on the board. 

 

Thank you again

0 Kudos
avrumw
Expert
Expert
3,844 Views
Registered: ‎01-23-2009

If you download your bitfile to the FPGA over JTAG and Impact says "Successful" then the code is in your FPGA.

 

FPGA code does not "run" - once downloaded your FPGA becomes the hardware you have described in your RTL code. If the clock is running and your code is correct, then the LED will start flashing.

 

If it doesn't flash, then you did "something" wrong...

 

The "PROGRAM" button is the way of restoring the FPGA to the initial image that is put in the Flash memory. In other words, it is (as mcgett said) overwriting the code you put into the FPGA with other code. The fact that the LED lights up part way is merely a side effect - when the FPGA is being programmed, it floats all its inputs and outputs (which causes the LED to partially light up).

 

Avrum

0 Kudos
ftamulonis
Visitor
Visitor
3,841 Views
Registered: ‎10-22-2013

 

"If it doesn't flash, then you did "something" wrong..."

 

Do you know what that "somthing" might be. I have check the program, which is in the orignally post, and re checked my UCF file for correct Pin assignments. It all seems correct. the only thing I could think is changing the assignment of the CLK pin and trying a different LED. 

 

Thank you. 

0 Kudos
ftamulonis
Visitor
Visitor
4,897 Views
Registered: ‎10-22-2013

I got it to work. I just had to change the clock definition. 

 

 

Thank you everyone

View solution in original post

0 Kudos