Forum Discussion

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

Uart

Hi. i have one design that is UART written in verilog code. The simulation is successfully done. However, when i program my design to the DE2 board and connect it to the PC using the RS232, there is no output shown in hyper terminal. i would like to ask a favor that help me to have a look on my coding to check that whether my design got any problem. Your effort would be much appreciated. thanks

16 Replies

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

    I have another source for using the serial IO. I got this from a friend who used it for a university project.

    The module "serial_out" works as a adapter which reads input data from a FIFO and sends the data in blocks of 8 bit to the TX pin on RS232.

    The instantiation is (Verilog):

    
    serial_out instanceSerialOut(
        .clk_i(iSerialClock),  //input clock, 40MHz for 115200 Baudrate
        .rst_i(iRESET),        //reset signal
        .data_i(InputData), //input data bus, size can be changed inside serial_out
        .empty_i(FifoEmpty),//signal pin from FIFO, for FIFO is empty signal
        .req_o(ReadRequest_To_Fifo),//signal pin to FIFO, for read request
        .txd_o(oTX_Serial)); //pin to UART_TX pin
    

    The data which is read from the fifo is split into blocks of 8 bit each in the serial_out module. Just change the case statement inside the module to the size of the data you read from your fifo.

    That should work fine.

    If you want to run the serial io slower just use half the clock rate.

    e.g. 20MHz = 57600 Baudrate

    cheers,

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

    Hi beginner,

    since your post is not related to this thread, could you please delete it and open up a new thread.

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

    To Spellic: He actually should be banned. He posted the same question on five different threads.

    The guy is not polite and hijacks all theads, regadless of the topic.

    I say ban him.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I need your help to figure out how to connect the PC RS232 to the NIOS UART on a C III starter board. I have a daughter card that exposes the FPGA pins, so I have access physically to ALL I/O pins, Also 5 V and 3.3 V pins on that card. I also have a RS232 to TTL tiny external board that is connected to the PC Serial cable, and has 4 pins as output. The four pins are Power, GND, Tx and Rx. I tried to connect the Tx and Rx to their perspective equal Rx and Tx in the NIOS (pin assignment is correct) after I added the RS232 UART in the nios using SOPC builder, with no flow control.

    I cannot send or receive on either sides, I mean Nios running c code cannot read or write, the function call stuck. Also on the PC the c code cannot read or write it does also stuck on the function call.

    I am using ANSI standard C code for fopen, fgetc, fputc, etc..

    Can you help me please to find out how to connect the PC to the UART on the FPGA?

    I appreciate it. Thanks.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    update: The code works fine for the DE2-70 board. Just make sure that Quartus does not complain about set-up and hold times. :)

    i got a de-70 board and realized now that the sample code is not working on it right away. i will try to figure out if it is caused by the different rs232 chip on the board or if my interface causes the problem.

    from my perspective the code should be fine. i will post an update once i solved the problem.

    Spellic

    @Colors: I have no experience with the NIOS stuff, maybe you post your request somewhere else? Besides, I am referring here to the DE2 boards with Cyclone II FPGA. I don't think those two chip family's are compatible.