S
Sink0
Guest
Hi need to implement a bidirectional 8 bit interface of a FPGA with a
microcontroller. For now i am developing with a Ciclone II but i will
have to make it for a Spartan-3A too.
Inside the FPGA i have 2 fifos one that will hold the data that i will
wire to the uC and on the other i have to put the data that the uC
sends to FPGA. The communication is controlled by the uC, so there
will be a we pin to set the pins direction.. a 8 bit birectional data
bus, a data_rdy pin to tell uC that there is data availabe on the
FIFO, and a "clk" pin. I mean clock becouse it wont be a continuously
clock. Just something like on every posedge the data will be sampled
on FPGA (if we is asserted) or the FPGA will change the the output (if
we is not asserted). On the FPGA there will be a 50Mhz clock. I am
implementing both fifos using altera megafuntion (and probably the
same will be done with Xilinx FPGA). I have a few questions. First
will this code works to control the port direction? Or it should be
clocked?
module bidir_port (
out_en,
data_in,
data_out,
port
);
input out_en;
input [7:0] data_in;
output [7:0] data_out;
inout [7:0] port;
assign port = out_en ? data_out : 8'bz;
assign data_in = port;
endmodule;
Second, i have two options to create this communication. First, to
use the communication control pin to clock the FIFOs, but i dont know
if need to use a constiguously clock on FIFOs ... The other option
would be to synchronize all the signals to FPGA 50Mhz, and create a
pulse on the wt_en and rd_en port of fifos on every edge of the uC
ctrol pin.
Will both work? Anything i should pay attention?
Thank you!!
microcontroller. For now i am developing with a Ciclone II but i will
have to make it for a Spartan-3A too.
Inside the FPGA i have 2 fifos one that will hold the data that i will
wire to the uC and on the other i have to put the data that the uC
sends to FPGA. The communication is controlled by the uC, so there
will be a we pin to set the pins direction.. a 8 bit birectional data
bus, a data_rdy pin to tell uC that there is data availabe on the
FIFO, and a "clk" pin. I mean clock becouse it wont be a continuously
clock. Just something like on every posedge the data will be sampled
on FPGA (if we is asserted) or the FPGA will change the the output (if
we is not asserted). On the FPGA there will be a 50Mhz clock. I am
implementing both fifos using altera megafuntion (and probably the
same will be done with Xilinx FPGA). I have a few questions. First
will this code works to control the port direction? Or it should be
clocked?
module bidir_port (
out_en,
data_in,
data_out,
port
);
input out_en;
input [7:0] data_in;
output [7:0] data_out;
inout [7:0] port;
assign port = out_en ? data_out : 8'bz;
assign data_in = port;
endmodule;
Second, i have two options to create this communication. First, to
use the communication control pin to clock the FIFOs, but i dont know
if need to use a constiguously clock on FIFOs ... The other option
would be to synchronize all the signals to FPGA 50Mhz, and create a
pulse on the wt_en and rd_en port of fifos on every edge of the uC
ctrol pin.
Will both work? Anything i should pay attention?
Thank you!!