send data from MATLAB to FPGA

Shagas

Joined May 13, 2013
804
Why do you want to send data from Matlab to fpga?
In any case your best best is probably UART. Get a 3dollar usb->UART converter like this one and implement a UART module on the FPGA (or download one, there are loads of free available implementations) so that the FPGA can talk to the converter.
In Matlab: You open a serial object and you write to it in individual bytes.

C:
% Serial object
s = serial('COM12','BaudRate',9600,'DataBits',8);

% Close any open objects so they don't interfere
newobjs = instrfind;
fclose(newobjs);

% Open our serial object
fopen(s);
You can write:

get(s)

To display all the parameters of the s object that you might want to configure and you do that by writing:

set(s, '<parametername>', <parametervalue> );

I have experience with reading from the port using 'fread()' but don't haven't tried writing to it. Shouldn't be too hard.
I don't know if you will need a special toolbox for the serial stuff to work on Matlab. If you run into toolbox issues then try Octave, maybe they have a serial implementation aswell.
 

Thread Starter

omerysmi

Joined Oct 10, 2014
55
Why do you want to send data from Matlab to fpga?
In any case your best best is probably UART. Get a 3dollar usb->UART converter like this one and implement a UART module on the FPGA (or download one, there are loads of free available implementations) so that the FPGA can talk to the converter.
In Matlab: You open a serial object and you write to it in individual bytes.

C:
% Serial object
s = serial('COM12','BaudRate',9600,'DataBits',8);

% Close any open objects so they don't interfere
newobjs = instrfind;
fclose(newobjs);

% Open our serial object
fopen(s);
You can write:

get(s)

To display all the parameters of the s object that you might want to configure and you do that by writing:

set(s, '<parametername>', <parametervalue> );

I have experience with reading from the port using 'fread()' but don't haven't tried writing to it. Shouldn't be too hard.
I don't know if you will need a special toolbox for the serial stuff to work on Matlab. If you run into toolbox issues then try Octave, maybe they have a serial implementation aswell.
i need to detect some object from camera with MATLAB and then to operate servo motors..so that's why i need to send data from matlab to fpga. Do you think that there is another way to do it?
 

Shagas

Joined May 13, 2013
804
I don't think so. Alternatively you can use some other program to communicate with the FPGA and read/write data to a file which you will
use to write/read with matlab but you will still have to use RS232 because DE1 doesn't even have an ethernet PHY.
 
Top