I want to read data from FT2232H used in an FT245 style synchronous FIFO mode (http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT2232H.pdf p.27) with DE0-Nano FPGA board:
process(clk)
begin
if (rising_edge(clk)) then
next_state <= current_state;
case current_state IS
when POLL_UNTIL_RXF_LOW =>
if (rxf = '0') then
current_oe <= '0';
next_state <= WAIT_SET_RD_LOW;
else
current_oe <= '1';
end if;
current_rd <= '1';
when WAIT_SET_RD_LOW =>
current_oe <= '0';
current_rd <= '1';
next_state <= SET_RD_LOW;
when SET_RD_LOW =>
current_oe <= '0';
current_rd <= '0';
next_state <= READ_DATA;
when READ_DATA =>
if (rxf = '0') then
current_oe <= '0';
current_rd <= '0';
-- access data here
else
current_oe <= '1';
current_rd <= '1';
next_state <= POLL_UNTIL_RXF_LOW;
end if;
when others =>
null;
end case;
end if;
end process;
rd <= current_rd;
oe <= current_oe;
siwu <= '1';
wr <= '0';
This code doesn't work well: about 51% of my data gets lost. I think, this is happening because clk
in this code is 60 MHz clock provided by FT2232H; however, the DE0-Nano has an on-board 50 MHz oscillator connected directly to one of the FPGA clock pins. Is it possible to read 60 MHz data with 50 MHz clocked FPGA at all? How do you do it?
-- access data here
. \$\endgroup\$current_state
andnext_state
, which are updated in two separate clocked processes. This means that it takes two clock cycles to do anything, and it effectively runs half as fast as you think it does. More importantly, it means that it drops every other byte coming out of the FT232H. \$\endgroup\$