Forum Discussion

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

rs232 uart ip :: user guide

hi,

// unnamed.v
// Generated using ACDS version 16.0 211
`timescale 1 ps / 1 ps
module unnamed (
		input  wire        address,    // avalon_rs232_slave.address
		input  wire        chipselect, //                   .chipselect
		input  wire   byteenable, //                   .byteenable
		input  wire        read,       //                   .read
		input  wire        write,      //                   .write
		input  wire  writedata,  //                   .writedata
		output wire  readdata,   //                   .readdata
		input  wire        clk,        //                clk.clk
		input  wire        UART_RXD,   // external_interface.RXD
		output wire        UART_TXD,   //                   .TXD
		output wire        irq,        //          interrupt.irq
		input  wire        reset       //              reset.reset
	);
	unnamed_rs232_0 rs232_0 (
		.clk        (clk),        //                clk.clk
		.reset      (reset),      //              reset.reset
		.address    (address),    // avalon_rs232_slave.address
		.chipselect (chipselect), //                   .chipselect
		.byteenable (byteenable), //                   .byteenable
		.read       (read),       //                   .read
		.write      (write),      //                   .write
		.writedata  (writedata),  //                   .writedata
		.readdata   (readdata),   //                   .readdata
		.irq        (irq),        //          interrupt.irq
		.UART_RXD   (UART_RXD),   // external_interface.export
		.UART_TXD   (UART_TXD)    //                   .export
	);
endmodule

doccument::ftp://66.35.227.3/up/pub/altera_material/14.0/university_program_ip_cores/communications/rs232.pdf

above one is an rs_232 uart ip provided by quartus(generated by qusy).but i am not able to find an user manual for it..so i dont know how can i assign value to 32 bit input register. actual value is only 8 bits what should i do with rest of the bits??

i also dont know chipselect, address & byteenale values ?

can anybody help me on this? anyhere please tell me how to use it.

any help is really appriciated

thanks and regards

8 Replies

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

    hi,

    i need to send a 45 bit register data stored inside the fpga(@200hz) to pc for processing. after some searching. i found out that uart is the way to do it.. but then i came across this problem :(

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

    hi,

    thanks much for the information. now i got some idea about this. i need to create a qsys system which include nios 2 processor and uart and onchip rom.

    but how will i connect the register(updating @200 hz) value inside the fpga to the processor ?

    to the rs232 txdata register?

    if it is so: txdata register declare that first 8 bit are only used to transmit data..

    so do i need to worry about 16 bit txdata width ?

    i just need to asssign 8 bit data to txdata register right?? (lsb 8 bits )

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

    Yes, you can just write to the lower 8-bits of the txdata register (address 0x01). You should check the 'trdy' bit before writing to the txdata register. Alternatively, ensure you only write to this register again after a suitable interval - the time it takes to send the character.

    Cheers,

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

    hi,

    thanks much for the information Alex,

    do i really need a "C' code to send the data to pc, I am taking default "hello world program as my reference". so i am confused , because if i need a C code , then how i will transfer output of verilog code to c code to print it in pc ? i mean how to connect verilog code and c code?

    else after generating the qusy system ( nios II + on chip ram + rs 232 uart) , can i connect it directly using verilog & then transfer to putty ?

    thanks and regards

    update ::::::::::::::::

    basically if "" output [7:0] x_out " is my output register how can i access it using c code (if we need c code for this ).

    thanks in advance
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No - you don't need any C code to send characters to the UART.

    However, you mention a 'Hello World' program as your 'reference'. This will be in C and will be for use on, typically, a Nios processor core. So, I'm a little confused as to what you're trying to do.

    You can either connect the UART IP directly in your Verilog - as you showed in your first post (no c code required), or you connect the UART IP to a Nios soft processor, via Avalon, and run software (C code) on the Nios - which is where the 'Hello World' programs comes in.

    Which one are you're trying to do?

    Cheers,

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

    Hi,

    i didnt decided how to do it..( dont have much knowledge in c). so if i use the first method that is with out a c code ::

    i dont need any nios processor and on chip ram right?

    connect it, compile then directly dump it in fpga.. is it appear in putty terminal?

    https://www.youtube.com/watch?v=7xj9dhvdcwu

    above one is the you tube video tutorial for hello world program. can you please suggest an easy way? still i am searching how to do it :(

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

    hi,

    what i wanted to do is :: there is a design running in my fpga @ (200 hz & 46 bit width) . output is coming out from top module in 46 bit register. i wanted to print or save it in my pc. after few searching, i thought i will do usb _uart( had in sockit_) . thats why i asking these doubts . doing it for the first time :)

    is it possible to change the c code & instead of "" hello world"" , print my register value ?

    regards