Forum Discussion
Altera_Forum
Honored Contributor
17 years agoProblem with PLL in EP1C12 device
Hello everyone, long time no see =]
Recently I've built my own evaluation board with EP1C12 Cyclone device (yes, it's an old one, but I obtained it for free). The board is working, I can configure the FPGA using JTAG Byte Blaster (parallel port), also FPGA chip is working properly, except the PLL. I've created simple test project, which uses PLL. The PLL is created as a Altera Megafunction and it's suppose to double the clock frequency (from 50 MHz to 100 MHz). Reset and clock signals are connected properly to PLL core. What could be wrong ? The code is listed below. PLL_test.vhd:library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
entity PLL_test is
generic
(
DIV_FACTOR : positive := 20
);
port
(
clk : in std_logic;
nrst : in std_logic;
divout : out std_logic;
locked : out std_logic
);
end PLL_test;
architecture behavioral of PLL_test is
COMPONENT PLL IS
PORT
(
areset : IN STD_LOGIC := '0';
inclk0 : IN STD_LOGIC := '0';
c0 : OUT STD_LOGIC ;
locked : OUT STD_LOGIC
);
END COMPONENT;
signal divider : std_logic_vector(15 downto 0);
signal div_rst,div_clk,PLL_lock : std_logic;
begin
clk_mul : PLL
PORT MAP
(
areset => not nrst,
inclk0 => clk,
c0 => div_clk,
locked => PLL_lock
);
div_rst <= PLL_lock and nrst;
locked <= PLL_lock;
freq_divider : process(div_clk,div_rst) is
begin
if div_rst = '0' then
divider <= (others => '0');
divout <= '0';
elsif rising_edge(div_clk) then
divider <= divider + 1;
if divider <= DIV_FACTOR/2 then
divout <= '0';
else
divout <= '1';
end if;
if divider = DIV_FACTOR then
divider <= (others => '0');
end if;
end if;
end process freq_divider;
end behavioral; The divider is supposed to generate signal with frequency ten times lower than PLL clock out frequency (10 MHz in this case), cause my oscilloscope is old and has bandwidth of 25 MHz.15 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I forgot to mention that in timing simulation everything is OK. --- Quote End --- So it should work in hardware as well. Are you sure to have assigned the pins correctly? You didn't mention a particular problem that you experienced with your design. - Altera_Forum
Honored Contributor
The IEEE.STD_LOGIC_ARITH and IEEE.STD_LOGIC_UNSIGNED libraries make it possible ;) I forgot to mention that in timing simulation everything is OK.
- Altera_Forum
Honored Contributor
I am not sure about your testing of std_logic against integer.
if divider <= DIV_FACTOR/2 ?? if divider = DIV_FACTOR ?? - Altera_Forum
Honored Contributor
The div_rst signal is active low. When the nrst signal is off (high) and PLL_lock signal is on (high) then div_rst is off (high), so no reset occurs. It's simple precaution against unexpected behavior of PLL before it's locked.
- Altera_Forum
Honored Contributor
I can't see, if the PLL Megafunction is configured correctly, but the clock divider is hold in reset by this line, so no output can be expected.
P.S.: O.K., I see it's actually ndiv_rst, it should work then. The division factor is 21 in your design, resulting in 4.76 MHz output clock with 100 MHz input. Do you see a locked state?div_rst <= PLL_lock and nrst;