Interface between c# GUI and FPGA

Status
Not open for further replies.
Hello,

maybe I should ask that earlier: "Qamar do you have access to FPGA development Board?". For your project the final phase is real working hardware device, or just only simulation?

Regards
 

If you want to do it very fast you can use Instant SoC.
You simply write a few lines of C++ code and the tool generates the VHDL code.
There are ready UART classes etc.
Here you can see an example using UART.
Hello @MarkPh,
today I visited "Instant SoC" websit and i must admit that it looks interesting I would like to try implement "instant SoC" ( i tried few times implement various RiscV Ipcores but it wasn't easy). Did you tried implement this "Instant Soc"? If yes on which development board and if you have any hints they would be helpful for me.

Thanks in advance
 

Hi @FlyingDutch,
I have tried Instant SoC on several boards, mostly with Xilinx Artix and then build it with Vivado. E.g. I have used it on Arty A7, Nexys DDR.
On these it works really great. Very fast and easy to work with.
I have also used it a lot on the board we have designed. No problems.
 
i'm very grateful of you all for your kind time let me explain you where i'm standing now on my project
first of all i wrote a code in verilog for sending data to my fpga through UART by using vivado and showed output back on tara term
computer_Tx...>FPGA_Rx=for burning code into FPGA(nexys a7) and then FPGA_Tx...>computer_Rx=Data showed on Tara Term
--- Updated ---

Leave that LED blinking part i did it very easy but not used windows application form for doing it , simply burned a verilog code in FPGA and LED's of nexys a7 started blinking by implementing a (counter) program
now i need your kind help in knowing how:
linking my windows application form with verilog code and how can i send commands from form to FPGA and then show that commamnds on another pc means
Computer with Graphical user interface (windows application form in C#).....>Fpga having burned with verilog code..>Another computer with tara term showing what is sent from first pc. What i think first Data will be sent by GUI to FPGA using serial communication through UART and FPGA will receive it on Rx and then using rs232 we can send that data from Tx of FPGA to another computer communication port and then computer will show it on tara term.
want to know
1.how to write logic in verilog
2. Can Fpga continously receive input from computer
3. how to code Fpga to continously out data on its Tx so that another computer show output likewise
--- Updated ---

Hello,

maybe I should ask that earlier: "Qamar do you have access to FPGA development Board?". For your project the final phase is real working hardware device, or just only simulation?

Regards
Yes i do it is nexys a7 digilent board
 
Last edited:
Hi,
[GROUP=][GROUP=]h[/GROUP][/GROUP]
1.how to write logic in verilog
do an internet search for "verilog tutorial". Many thousands of hits. Even a lot of videos. Just use it.

2. Can Fpga continously receive input from computer
What does "continously" mean? Without the tiniest gap?

Klaus
 

may this picture help you understand what i'm saying
--- Updated ---

and i know there are many codes available but i'm not able to find codes related to my work kindly help me with this
 

Attachments

  • Untitled.png
    44.8 KB · Views: 131

Hi,

O.K.

Now give one example what information you want to transmit. No general statements. Really an exact example.
Where does it start? Why does it start? --> ??? --> Where does it end? What should happen?
How should it work? are there any parameters.
Also exactly to this one example give some timing informations: How often? What speed?
And give data information. What does it need to do (command) and what parameters does it need?

I don´t expect a finished solution, no code
I expect just the raw requirement.

Example: (not related to your project)
Textual description:
When I press the "L" key on the keyboard I want the PC to draw a horizontal line on the screen, from position (fixed) 100 / 100 to 200 / 100 color green
Start: Where: keyboard. Why: press the "L" button
What should happen: draw a horizontal line ... Where: on the screen
Parameters: No.
Timing: command sent and processed within 50ms

Klaus
 

Hello Quamar

you can do it in process (Verilog). Periodically read Rx from serial in process (you be able do it every period of time using simple counter) and then steer Tx respectively to information red from serial Rx.

Best egards
--- Updated ---

Hello Qmar,

I send you in second post of this thread link with explanation how to program serial port from "Visual Studio" (in C#). Based on this code I wrote full application which is periodically exchanging information (in two direction), This application (written in C#) is connected with embedded system based on ARM CortexM3 (STM32F103GT6 microcontroller). It looks like this:

1) The screen with serial port parameters:


2) Second screen with basic embedded system parameters (send to PC from board with STM32F103):



These parameters are sending periodicaly from microcontroller to C# application on PC.

3) Extended parameters shown in tabular layout (also sens periodically):



Everything you can write basing on code to whom I send you link in post number two. The hardware part is FT232 chip also described in post two.

The one difference is that on the second side is FPGA not microcontroller. So you have to program comunication between C# application (on PC) and FPGA board (in Verilog). The hint: I sent the message (order) using serial port informing FPGA that it have to send information from FPGA to PC applicastion. So for sending different data from FPGA to PC hou have to have several different orders. Write what is not understandable?

In C# application it is not difficult to represend data recrived from emmbedded system in graphical for like this (example from my application):




Best Regards
--- Updated ---


I forget: in order to easy programm comunication on serial port on FPGA using a Soft-CPU (for example Microblaze - IP Core from Xiling) is worth attention.
 
Last edited:


Yes, I would definitely use some soft-processor to program comunication on serial port (from FPGA side). Qumar let to know what is unclear to you.
Best Regards
 

please kind tell me which IDE you are using
--- Updated ---

this is my GUI in c# i want if select anything and send it on com port it should go and FPGA on other hand should receive it and send corresponding data to other computer
--- Updated ---

this is my GUI in c# i want if select anything and send it on com port it should go and FPGA on other hand should receive it and send corresponding data to other computer
--- Updated ---

let me go to step b step
1. make a verilog code and burn it on FPGA through UART
2. code should include things such that for example if letter "x" is received on its receive port it should send let's say 00011 to to its transmission port and further by using rs232 it can be send to other computer and result is shown on tara term
3. make coding behind buttons in the following windows form (GUI) such that if something is selected and sent on serial port FPGA should receive it and act accordingly
 

Attachments

  • Screenshot (2).png
    117 KB · Views: 124
Last edited:

@OP,
There are many tutorials freely available that will show you how to sent data from a PC to FPGA board -- use your favorite search engine!
I think unless this part of your work is fixed it does not make much sense to work on the GUI part.

Pure RTL based : https://www.pantechsolutions.net/blog/uart-interface-with-xilinx-spartan-fpga/

Microblaze uP based: https://lancesimms.com/Xilinx/VC707_Microblaze_UART_to_LED_Example_Part1.html

Zynq based: https://reference.digilentinc.com/v...77.117608107.1608194371-1777858975.1600357486

Of course the above projects need to be adapted for the development board you are using.
 
please kind tell me which IDE you are using

I am using "Visual Studio 2019" together with "Windows Forms" from ".NET Framew2ork" (everything is free).


let me go to step b step

1. make a verilog code and burn it on FPGA through UART

Not - write Verilog code (to program behaviour of FPGA) and then send configuration binary file to FPGA (write configuration to FPGA board Flash memory) using JTAG hardware programer for your board.

2. code should include things such that for example if letter "x" is received on its receive port it should send let's say 00011 to to its transmission port and further by using rs232 it can be send to other computer and result is shown on tara term

Yes - something like that.

3. make coding behind buttons in the following windows form (GUI) such that if something is selected and sent on serial port FPGA should receive it and act accordingly

Yes exactly.

Best Regards
 

please guide what i have done till now is made my GUI serial port is enabled and i have done to send my binary data on serial port and have checked through tera term it is showing what i have to serial port. ok now what type of programming should be done on fpga part that it should take it and just pass it to another Pc which will show my data on tera term
 

Next step is to implement UART receiver and transmitter on FPGA, e.g. referring to the first link in post #31, or any other example design obtained from the internet.
 

Next step is to implement UART receiver and transmitter on FPGA, e.g. referring to the first link in post #31, or any other example design obtained from the internet.

Yes exactly as @FvM said you have to implement UART on FPGA board and in loop read one byte (it is one full frame of UART transmission - usually 8-bit) on UART Rx and retransmit this byte on UART Tx (connection to Tera-Term terminal).

Regards
 

Next step is to implement UART receiver and transmitter on FPGA, e.g. referring to the first link in post #31, or any other example design obtained from the internet.
Thank you for your advice kindly give me some links for the verilog code to implement it
--- Updated ---

Yes exactly as @FvM said you have to implement UART on FPGA board and in loop read one byte (it is one full frame of UART transmission - usually 8-bit) on UART Rx and retransmit this byte on UART Tx (connection to Tera-Term terminal).

Regards
yes exactly the same technique is on my mind but not able to find any verilog code related
 

So has your school never introduced Verilog in their curriculum in previous classes? By the time you get to your final year if they expect you to do a project with an FPGA then you should have at least taken a class where they teach you digital design and Verilog.

Thank you for your advice kindly give me some links for the verilog code to implement it
--- Updated ---


yes exactly the same technique is on my mind but not able to find any verilog code related
If you don't have any Verilog knowledge (because your school sucks) then use Xilinx's IP integrator and make a Microblaze system with two uarts and a microblaze, then you can write software to read one uart and transmit out the second uart and won't have to write any Verilog.

If you need Verilog code for a UART then opencores has a uart IP core, but since it appears you don't know any Verilog it's pointless to use that core as you would have to know enough Verilog to instantiate two uarts in a top-level file and write some code to control them.

For something this simple I would pull a uart from opencores and use an FSM to read the RX uart and write the Rx'd bytes to a FIFO on the read side of the FIFO another FSM reads the FIFO and sends it to the TX uart. Shouldn't take very long to write something like that. Depending on the uart core you might be able to avoid using the FIFO entirely and directly control both the RX and TX uarts from the same FSM.
 

please refer me to some code
 

please refer me to some code
Did you even try using a search engine and type "opencores" into it? When I try that the first link is the opencores website, which as I said has a UART core on it.

Always asking for code makes me not want to be helpful. It shows a lack of initiative.
 

first of all you are giving me help in project, not a life so please be kind in choosing your words in an open thread. Your words reflect yourself and next thing most of my work i have done myself. Fpga just taking input and giving output so plzz don't be judgy without knowing and if you don't want to help please don't humiliate others by typing some sentences. Thank you
--- Updated ---

i was asking for code because i have tried UArt core from opencores but not able to implement it
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…