Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

RS232 on DE2 board sample code



I am looking for some sample VHDL code (without using an embedded processor like Nios) to implement serial communications on the DE2 board. I need to send data from the board to the PC. The PC side uses C# and is already done. 


0 Kudos
2 Replies
Honored Contributor I

Unfortunately I cannot explain all of what I did here. It took a lot of time but I can tell you some things that should help. First I would suggest truly reading the entire manual for the DE2-70 board. That helped me an extreme amount. Second if you are trying to interface with a Doran scale I would suggest reading that entire manual as well (that one is a long one). This again is very time consuming and you will have to probably read them over again but it helps a great deal.  


For setting up the RS-232 port I used the SOPC builder and generated a soft core processor in which I added the RS232 input. There are some demos on the altera site that helped as well but you will have to dig for them they don't just pop out.  


Once you learn all those things from the manuals and demos you will have to make sure that you read the section for the data transmitting in the Doran scale carefully and ensure you are using the correct outputs (I had to switch mine because the manual is not very clear and I think it might be wrong can't remember though). So call Doran if you have issues and they should be able to help.  


Hope this helps and sorry but it's something that is just going to take some research and time unless I was right there next to you.  


Good Luck! If you have any more questions later that I could help with, let me know and I will try.
Honored Contributor I

I recommend reading up on the RS232 protocol spec first. I guess these days we all get a bit lazy relying on hardware and software UARTs to do all the tranmission for us, but it isn't hard to develop your own RS232 UART :) 


Depending on how you want to send and receive data using your FPGA, you can implement a simple design which uses a memory buffer to store and manipulate incoming data. Outgoing data can be loaded into a buffer and transmitted using the correct digital signal transitions. 


I guess first off: 

- What are the requirements of your application? 

- How are you going to get data into the VHDL-based UART ie. from external device, from soft-core processor etc 

- What are your transmission requirements ie. baud-rate, parity etc