Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

External Clock for DE2 board

Hello everyone, I have a simple question. Can we use a function generator as the source for the external clock of the de2 board??? I really want to use a clock frequency other than the ones provided by the board which are (27 MHz) and (50 MHz). Thank you for your help.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sure, but you can also use a PLL on the board to change the 50MHz or 27MHz to whatever frequency you like (within reason).

    Why not do that? It saves a function generator.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Well, this is my VHDL code :

    ---------------------- Frequency division by 2 -------------------

    LIBRARY ieee;

    USE ieee.std_logic_1164.all;

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

    ENTITY freq_div2 IS

    PORT (

    clk : IN STD_LOGIC;

    reset_n : IN STD_LOGIC;

    out2 : OUT STD_LOGIC);

    END freq_div2;

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

    ARCHITECTURE example OF freq_div2 IS

    signal clk_div : std_logic :='0';

    BEGIN

    process (clk, reset_n, clk_div)

    variable countr : integer range 0 to 7:= 0;

    begin

    if reset_n ='0' then

    countr :=0;

    elsif (clk'event AND clk = '0') then

    countr := countr +1;

    if countr =1 then

    clk_div <= not clk_div;

    countr :=0 ;

    end if;

    end if;

    end process;

    out2 <= clk_div;

    end example;

    Then I use the (Pin Planner) to assign the (clk) to the appropriate clock pin. For example (PIN_N2) for (50 MHz). How do you suggest I use the (PLL)?? Thanks a lot.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There's no need to do this. Just add a PLL to your design from the IP Catalog (in older versions of the software, it was the MegaWizard Plug-In Manager) and set it to divide by two. Connect the 50 MHz input clock pin of the board to the input reference clock of the PLL and the output to whatever logic you want to clock at 25 MHz as well as an output pin of the device. Done.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can instantiate a PLL primitve and connect your custom logic to it ... for example, I posted a design to this thread that creates a PLL and connects to the scan chain ...

    http://www.alteraforum.com/forum/showthread.php?t=46527

    In the case of the DE2 you could use the 50MHz as the PLL input and then configure the PLL for one or more outputs with different frequencies. Use the PLL in the IP catalog to get a sense of what is possible. The GUI just helps fill in the generics on the component.

    Cheers,

    Dave