Jump to content
  • 0

UART CODE


Trax

Question

Hello,

 

I'm new to FPGA programming

 

I would like to be able to write some registers in my basys3 board using the uart interface, the sample code in the GPIO demo however only sends date it does not recive them.

Where can i find some code that would implement an uart reciver?

 

Also where are good places to look for code samples and snipets.

 

Cheers

Trax

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Here's two copies: One from a System on a Chip (SoC) for xess.com's XuLA2-LX25 board, and the other from a similar SoC project using Digilent's CMod-S6 board.  Both cores were developed on and for a Basys3 board, although the Basys project isn't posted anywhere at this time.  Also, you'll find a txuart.v file within each directory.

The XuLA2 UART in particular is a full service UART.  It will handle 5,6,7, or 8 bit data words, no parity, even parity, odd parity, mark/space (fixed) parity bits, one or two stop bits, and the baud rate is highly selectable.  (The baud rate selection is basically a divide of the clock, so from a 100MHz basys board clock, set the control register to 32'd25 to get 8 bits, No parity, 1 stop bit, and a 4MBaud rate.  In a similar fashion, setting the control register to a 32'd10417 will set you up for 9.6kB.

Yours,

Dan

Link to comment
Share on other sites

Oh, here's another one for you: the wbubus.v component of the XuLA2 SoC converts character data into wishbone bus commands.  So, if you want to control 32'bit registers, with 32'bit addresses, both reading and writing, that'll do it for you.  (The host software half to the same thing can be found in ttybus.c.  On my Basys3 I drive it with the UART ports, on the XuLA2 I drive it from the user JTAG command, and on the S6 I drive it from the DEPP interface)  I use the same thing on my Basys3 board, as well as on my CMod-S6--but only when the CMod isn't running a CPU as well.  What's more, using this interface, the CMod S6 project also has examples for reading/writing the flash memory.  The flash memory example was also originally generated, tested, and proven on a Basys3 board and only ported to the CMod S6.

Dan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...