FPGA and ethernet communication

12 visualizzazioni (ultimi 30 giorni)
amey patil
amey patil il 25 Nov 2011
Modificato: Star Strider il 27 Lug 2014
I want to use TCPIP protocol on port 80 to connect fpga kit named ML505 with matlab.
Can i do it???
If yes den how??
I know there are some commands like
echotcpip = start or stop TCP/IP echo server
resolvehost = Network name or network address
tcpip = Create TCPIP object
What is the use of this commands i didnot get the meaning of creating TCPIP object when my object is xilixs FPGA ML505 kit???

Risposta accettata

Amy
Amy il 12 Lug 2014
Modificato: Star Strider il 27 Lug 2014
You can download a HTTP web server IP core from http://www.webphyfpga.com that transfers data between MATLAB and FPGA using the HTTP protocol and the MATLAB 'urlread' command. Physical Ethernet connection to the FPGA is made via standard LVDS IO and a RJ-45 jack (see photo below).
There's also an online demo that allows you to experiment transferring data over the internet with an actual FPGA running the IP core using the MATLAB code below. To try it, navigate to http://webphyfpga.ddns.net in your browser and log onto the FPGA. In the MATLAB code, set 'fpga_ip' = the resolved IP address (e.g. http://173.76.169.42:8080/) from your browser's URL box. Use the embedded webcam to view the board live as you move the servo motor and illuminate LEDs.
% IP address of FPGA
fpga_ip = "http://173.76.169.42:8080/";
% Write 8 bytes to BRAM address 0x1002 and read them back.
s = urlread (strcat(fpga_ip,'wr_0x1002_0x0123456789ABCDEF'),'post',{'',''});
s = urlread (strcat(fpga_ip,'rd_0x1002_0x8'),'post',{'',''});
fprintf('read 0x%s from FPGA\n',s);
% Move servo motor and write to 7 segment display.
s = urlread (strcat(fpga_ip,'wr_0x0_0x1234'),'post',{'',''});

Più risposte (2)

Walter Roberson
Walter Roberson il 25 Nov 2011
"object" in this context means a MATLAB Object Oriented Programming (OOP) variable of a specific data Class. "object" does not refer to physical objects in this context.
For now, you should just interpret "object" in this context as being a complicated kind of variable that MATLAB knows is associated with a particular TCP/IP connection.
  4 Commenti
amey patil
amey patil il 12 Dic 2011
But if matlab guys are giving us tools for doing physical communication then it is pausible with matlab to make it really happen.I m trying with latest version of MATLAB that is R2011B .Hope that it will allow me to make actual connection with Hardware of my expectation.
Walter Roberson
Walter Roberson il 12 Dic 2011
No. The physical connections would already have to be made before MATLAB could be used to transfer data over the connections.
You need
http://www.mathworks.com/help/toolbox/instrument/tcpip.html
Connection = tcpip('192.168.0.2', 80);
fopen(Connection)
After that you would use fwrite(Connection, ...) and fread(Connection, ...)
There is another possibility in your situation: depending on exactly what the server interface is defined as on the FPGA, it could be that you would not use tcpip() and fopen() directly at all, and that you would instead use urlread() or urlwrite() to send commands to the FPGA and get back the response.

Accedi per commentare.


Daniel Shub
Daniel Shub il 26 Nov 2011
Prior to r2011a (???) MATLAB could only act as a TCPIP client. Now MATLAB can act as both a client and a server. I believe this requires the instrument control toolbox. Are you trying to connect to or from MATLAB? The documentation is pretty good. You should start with:
doc tcpip
  1 Commento
Walter Roberson
Walter Roberson il 26 Nov 2011
The MATLAB File Exchange contribution "tcpudpip" is able to act as both a client and a server with earlier versions of MATLAB.
Port 80 is HTTP, so likely the FPGA would act as the server, likely making the point moot.

Accedi per commentare.

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by