FPGARelated.com
Forums

pullup

Started by nobody ●July 10, 2009
I have a mom switch normally open switching pin 71, general I/O, on a
Coolrunner II CPLD, XC2C64A VQ100 to ground. I have an LED,  165 ohm
connecting 3.3V into pin 8, general I/O, therefore a low emits
radiation at 532nm, it does. Having enabled a pullup resistor on pin
7i in the ucf, the switch i expected a momentary on and off again on
the LED when pressed and released. Instead, the LED lights and stays
on. I want the LED to follow the switch and not a one shot event. Any
ideas would be appreciated.

Sincerely,
Cy Drollinger
Thanks for the replies: Alan, and Gabor. Below is the VHDL I appended
much of it so not to long but the logic for the switch is available as
well as a couple of lines for the UCF. I was not aware of the global
on keeper and pullup. I have tried the keeper or pullup in the ucf but
both have the same result as nothing in the UCF. The reason no pullup
on the board was I fully intended to use the pullup of the CPLD, that
is why Xilinx made them available so I did not have to. Thanks for the
consideration of my problem.

Is there a better way to post VHDL especially when it gets long?



UCF:


NET "SW(0)" LOC = "71" | PULLUP ;
NET "SW(1)" LOC = "72" | PULLUP ;
NET "SW(2)" LOC = "74" | PULLUP ;

NET "LEDs(1)" LOC = "P1" | PULLUP ;
NET "LEDs(2)" LOC = "P2" | PULLUP ;
NET "LEDs(3)" LOC = "P3" | PULLUP ;
NET "LEDs(4)" LOC = "P4" | PULLUP ;
NET "LEDs(5)" LOC = "P6" | PULLUP ;
NET "LEDs(6)" LOC = "P7" | PULLUP ;
NET "LEDs(7)" LOC = "P8" | PULLUP ;
NET "LEDs(8)" LOC = "P9" | PULLUP ;




VHDL



entity CPLD is
    Port (
		mclk : in  STD_LOGIC;										--pin 22
		mclk_ce : out  STD_LOGIC;									--pin 70 Logic '0' MCLK high imp.
logic '1' MCLK 50 MHz pdf clk_osc
	        Variant : out  STD_LOGIC_VECTOR (0 to 2);				--pin 34, 33, 30
		Mode : out  STD_LOGIC_VECTOR (0 to 2);					--pin 42, 39, 36
                LEDs : inout  STD_LOGIC_VECTOR (8 downto 1);			--pin
1-4 and 6-9
		SW : inout  STD_LOGIC_VECTOR (0 to 2));				--pin 71, 72, 74 need to
be debounced
end CPLD;

architecture Behavioral of CPLD is

signal done 			:std_logic;
signal prog_B 			:std_logic;

Signal clk_count		: integer range 0 to 50000000 :=0;

begin

one_second: process(mclk)
begin
    if mclk'event and mclk='1' then
      if clk_count = 50000000 then
           clk_count <= 0;
			  if LEDs(8) ='1' then
					LEDs(8) <= '0';
				else
					LEDs(8) <='1';
				end if;
       else
           clk_count <= clk_count + 1;
       end if;
    end if;
end process one_second;


-- Author		: Cy Drollinger
-- Date			: 6-18-09
-- Description	: Hardwiring the CPLD for the board configuration of
the usb and fpga

					-- FPGA MODE --
--Mode <= "101";																	--DS312 page 67 mode jtag
--Mode <= "111";																	--DS312 page 67 mode jtag
--Mode <= "110";																	--DS312 page 67 mode Slave Parallel
--Mode <= "011";																	--DS312 page 67 mode BPI down
--Mode <= "010";																	--DS312 page 67 mode BPI up
--Mode <= "001";																	--DS312 page 67 mode SPI
--Mode <= "000";																	--DS312 page 67 mode master serial

					-- FPGA SPI FLASH VARIANCE --
--Variant <= "111";															--DS312 page 78 variant for fast
read write spi flash M25P16
Variant <= "101";																-- Read
--Variant <= "110";															--Read Array

done <= FPGA_done;
LEDs(1) <= '0';
LEDs(2) <= '0';
LEDs(3) <= '0';
LEDs(4) <= '0';
LEDs(5) <= '0';
LEDs(6) <= sw(0);
LEDs(7) <= sw(1);
--LEDs(8) <= sw(2);

prog_B <= SW(0);
FPGA_prog_B <= prog_B;

mclk_ce <= '1';



end Behavioral;
On Jul 10, 8:52=A0am, nobody <cydrollin...@gmail.com> wrote:
> Thanks for the replies: Alan, and Gabor. Below is the VHDL I appended > much of it so not to long but the logic for the switch is available as > well as a couple of lines for the UCF. > NET "SW(0)" LOC =3D "71" | PULLUP ; > > NET "LEDs(8)" LOC =3D "P9" | PULLUP ; > > VHDL > > one_second: process(mclk) > begin > =A0 =A0 if mclk'event and mclk=3D'1' then > =A0 =A0 =A0 if clk_count =3D 50000000 then > =A0 =A0 =A0 =A0 =A0 =A0clk_count <=3D 0; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if LEDs(8) =3D'1' the=
n
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 LEDs(8) <=3D '0';
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 LEDs(8) <=3D'1';
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 end if; > =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0clk_count <=3D clk_count + 1; > =A0 =A0 =A0 =A0end if; > =A0 =A0 end if; > end process one_second; > LEDs(1) <=3D '0'; > LEDs(2) <=3D '0'; > LEDs(3) <=3D '0'; > LEDs(4) <=3D '0'; > LEDs(5) <=3D '0'; > LEDs(6) <=3D sw(0); > LEDs(7) <=3D sw(1); > --LEDs(8) <=3D sw(2);
did you post the right code? this code looks like it is supposed to flash the led at 1s. does it work? also, you say led is on pin8, but led(8) is on pin9.
Yes, sorry about the confusion. The starting post is the detailed
explanation of the circuit, but have been implementing along the way.
The starting post description did just as it has been explained. The
VHDL posted has a one second on and a one second off flash on the
green led. the switches on 6 and 7 have the same functionality as the
starting post. Mom switch 0 or 1 turns on the corresponding led 6 or 7
but it does not go off after release. Thank you for your consideration
with my problem and your posts.


Cy

On Jul 10, 4:45=A0pm, nobody <cydrollin...@gmail.com> wrote:
> Yes, sorry about the confusion. The starting post is the detailed > explanation of the circuit, but have been implementing along the way. > The starting post description did just as it has been explained. The > VHDL posted has a one second on and a one second off flash on the > green led.
does the flashing led work? this would indicate whether the cpld can properly drive the led.
On Jul 10, 8:52=A0am, nobody <cydrollin...@gmail.com> wrote:
> Thanks for the replies: Alan, and Gabor. Below is the VHDL I appended > much of it so not to long but the logic for the switch is available as > well as a couple of lines for the UCF. I was not aware of the global > on keeper and pullup. I have tried the keeper or pullup in the ucf but > both have the same result as nothing in the UCF.
re-reading gabor's response, i believe he is right. you have to use all keepers or all pullups. since the default for coolrunner2 is keeper (also called bus-hold), pullups in ucf are ignored and a warning given (did you ignore the warnings?). in ise processes: right click fit, select properties and change unused i/o pad termination and input and tristate i/o termination to pullup. or use an external pullup on the switch. note that pullups on the led outputs aren't required and aren't doing anything.
alan@nishioka.com <alan@nishioka.com> wrote:
(snip)
> > re-reading gabor's response, i believe he is right. you have to use > all keepers or all pullups. since the default for coolrunner2 is > keeper (also called bus-hold), pullups in ucf are ignored and a > warning given (did you ignore the warnings?).
If I understand the original post, the LED goes from the output to Vcc, not to ground. (Hopefully with a resistor.) In that case, a pullup would not turn the LED on. The keeper may or may not have enough pull to keep an LED on. -- glen
On Jul 10, 10:00=A0pm, glen herrmannsfeldt <g...@ugcs.caltech.edu>
wrote:
> a...@nishioka.com <a...@nishioka.com> wrote: > > re-reading gabor's response, i believe he is right. =A0you have to use > > all keepers or all pullups. =A0since the default for coolrunner2 is > > keeper (also called bus-hold), pullups in ucf are ignored and a > > warning given (did you ignore the warnings?). > > If I understand the original post, the LED goes from the output > to Vcc, not to ground. =A0(Hopefully with a resistor.) =A0In that > case, a pullup would not turn the LED on. =A0The keeper may or may > not have enough pull to keep an LED on. =A0
the problem is on the input switch side not on the output led side. since coolrunner2 defaults to keeper, he isn't getting a pullup on the momentary switch, but a keeper instead. so it powers up high, then he switches it low and it stays low. and due to coolrunner2 hardware, in order to get any pullups at all, he needs to turn off *all* keepers. the keeper (or pullup) on the led side is doing nothing (it is too weak) and is actually disabled by the software (one of the warnings from ise).
Alan,

Thank you for the heads up on the properties under the fit category. I
thought that if I set the pullups in the UCF it would be handled. I on
occasion look through the warnings when all else fails, I will try and
be a bit more diligent in what ISE is warning. The leds now follow the
switch on and off momentarily.

Sincerely,


Cy Drollinger
glen herrmannsfeldt wrote:
> alan@nishioka.com <alan@nishioka.com> wrote: > (snip) >> re-reading gabor's response, i believe he is right. you have to use >> all keepers or all pullups. since the default for coolrunner2 is >> keeper (also called bus-hold), pullups in ucf are ignored and a >> warning given (did you ignore the warnings?). > > If I understand the original post, the LED goes from the output > to Vcc, not to ground. (Hopefully with a resistor.) In that > case, a pullup would not turn the LED on. The keeper may or may > not have enough pull to keep an LED on.
The pullup is nominally 100K Ohms, that would not normally light any LED. Jon