Electronic – FPGA able to send data, but unable to receive data. (UART – RS232)

debuggingembeddedfpgars232uart

I have a DE0-nano FPGA board and I am trying to establish a serial connection with my PC.

I am using the RS232 implementation from here: http://www.fpga4fun.com/SerialInterface.html

I have tested sending from the FPGA, and it worked perfectly. However, when I try to send to the FPGA, it seems to not be working.

Here is my verilog code:

module Learning(
    input clk,
    input RxD,
     output LED
);

wire RxD_data_ready;
wire [7:0] RxD_data;
reg [7:0] data;

async_receiver RX(.clk(clk), .RxD(RxD), .RxD_data_ready(RxD_data_ready), .RxD_data(RxD_data));

always @(posedge clk) if(RxD_data_ready) data <= RxD_data;

assign LED = (data == 8'h24);

endmodule

Basically I have designed it such that a specific LED on my board turns on while I am sending the hexadecimal value 24. Since I am sending this value at a very high frequency I do expect the LED to remain on for the whole transmission. However, nothing is happening. It stays off.

I already tried the reverse bit option from my rs232 program. Also, using a symmetrical value like 0x55 didn't work.

What could be the issue?

Best Answer

Since you can't debug Verilog the way you can with C and a microcontroller, you need to take incremental debugging steps...

  • If you just assign LED 1, does the LED turn on and stay on?
  • Is data being read at all? Maybe just toggle the LED if any character comes in
  • Make sure these work and them move on to 0x24

My advice is to take baby steps when debugging, especially with a hardware description language.