Dersimin projesi için PmodRF1 kullanacağım ve bu proje sayesinde ilk defa tranciever'lar ile çalışmış olacağım.Kullandığım board (Spartan-3E FPGA Board) gereği dizaynımı Verilog veya VHDL'de yapmam gerekiyor fakat PmodRF1'in manualinde sadece microcontroller ile yapılmış bir demo var.Acaba daha önce bu iki kit ile çalışma yapmış birisi var mı? Eğer varsa bana yol gösterebilir mi?
Öncelikle SPI arayüzünü öğrenip VHDL ile tasarlamaya çalışarak başlayabilirsin.
Transmit edecek olan board ve pmod arasında ki SPI arayüzünü şu şekilde yazdım; Recieve edecek olan pmod ve board arasında ki bağlantı daha karmaşık görünüyor onu da ekleyeceğim.
-- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values
-- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all;
entity fsm_rf1 is Port ( clk : in STD_LOGIC; data : in STD_LOGIC_VECTOR(7 DOWNTO 0); ss : out STD_LOGIC; mosi : out STD_LOGIC; sck : out STD_LOGIC; clr : in STD_LOGIC; start : in STD_LOGIC); end fsm_rf1;
architecture Behavioral of fsm_rf1 is
signal counter: STD_LOGIC_VECTOR (3 downto 0); signal sclk: std_logic; signal temp: std_logic_vector(7 downto 0);
type state_type is(initial,copy,clk_gen,shifting,completed); signal state: state_type;
attribute INIT: STRING; attribute INIT OF state: SIGNAL IS "initial";
begin process(clk,clr) begin if clr='1' then ss<='1'; mosi<='0'; sck<='1'; sclk<='0'; counter<="0000"; state <= initial; elsif clk'event and clk='1' then case state is when initial => if start='0' then state<=completed; else counter<="0000"; state<=copy; ss <= '0'; end if; sclk<='0'; when copy => temp<=data; state<=clk_gen; when clk_gen => sclk<=not sclk; state<=shifting; when shifting=> if counter="1000" then state<=completed; else counter<=counter + '1'; state<=clk_gen; end if; mosi<=temp(7); temp<=(temp(6 downto 0) & '0'); sclk<=not sclk; when completed=> ss<='1'; state<=initial; when others=> state<=initial; end case; sck<=sclk; end if; end process;
end Behavioral;
Bu daTestBench'i;
-------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 15:17:15 12/15/2011 -- Design Name: -- Module Name: D:/Okan University/Advanced Digital Design/Final Project/pmod_rf1/fsm_rf1_tb.vhd -- Project Name: pmod_rf1 -- Target Device: -- Tool versions: -- Description: -- -- VHDL Test Bench Created by ISE for module: fsm_rf1 -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- -- Notes: -- This testbench has been automatically generated using types std_logic and -- std_logic_vector for the ports of the unit under test. Xilinx recommends -- that these types always be used for the top-level I/O of a design in order -- to guarantee that the testbench will bind correctly to the post-implementation -- simulation model. -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL;
-- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL;
ENTITY fsm_rf1_tb IS END fsm_rf1_tb;
ARCHITECTURE behavior OF fsm_rf1_tb IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT fsm_rf1 PORT( clk : IN std_logic; data : IN std_logic_vector(7 downto 0); ss : OUT std_logic; mosi : OUT std_logic; sck : OUT std_logic; clr : IN std_logic; start : IN std_logic ); END COMPONENT;
--Inputs signal clk : std_logic := '0'; signal data : std_logic_vector(7 downto 0) := (others => '0'); signal clr : std_logic := '0'; signal start : std_logic := '0';
--Outputs signal ss : std_logic; signal mosi : std_logic; signal sck : std_logic;
-- Clock period definitions constant clk_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT) uut: fsm_rf1 PORT MAP ( clk => clk, data => data, ss => ss, mosi => mosi, sck => sck, clr => clr, start => start );
-- Clock process definitions clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process;
-- Stimulus process stim_proc: process begin clr<='1'; -- hold reset state for 100 ns. wait for 100 ns; clr<='0'; data<="01010101"; start<='1';
wait for clk_period*10; data<="11010111"; wait for clk_period*10; data<="00000000"; wait for clk_period*10;
Dersimin projesi için PmodRF1 kullanacağım ve bu proje sayesinde ilk defa tranciever'lar ile çalışmış olacağım.Kullandığım board (Spartan-3E FPGA Board) gereği dizaynımı Verilog veya VHDL'de yapmam gerekiyor fakat PmodRF1'in manualinde sadece microcontroller ile yapılmış bir demo var.Acaba daha önce bu iki kit ile çalışma yapmış birisi var mı? Eğer varsa bana yol gösterebilir mi?
Teşekkürler,
İyi Çalışmalar,
http://digilentinc.com/Products/Detail.cfm?NavPath=2,400,790&Prod=BASYS2
http://digilentinc.com/Products/Detail.cfm?NavPath=2,401,811&Prod=PMOD-RF1