Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20684 Discussions

rs232 uart ip :: user guide

Altera_Forum
Honored Contributor II
3,328 Views

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
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

Chapter 7 of the "embedded peripherals ip user guide (https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/ug/ug_embedded_ip.pdf)". 

 

Your 'address' wire input will need to be a little wider... 

 

If you want to connect only part of a bus to a narrower signal you can always specify the bits of the bus you wish to connect. 

e.g. 

.writedata (writedata), // .writedata 

 

Cheers, 

Alex
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,451 Views

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
0 Kudos
Reply