Page 1 of 1
Matlab interface with usb only no ethernet connection
Posted: Wed Feb 18, 2015 10:11 am
by WouterS
Hi everyone
I have a question about connecting the red pitaya with matlab so i can generate signals without using the ethernet connection.
when you are using the ethernet connection you are using the command "dos('plink.exe -l root -pw root <IP> /opt/bin/generate 1 1 40000 sine');" to make connection with youre redpitaya by using matlab. Does anyone knows if you can replace this command with something else if you are not allowed to use ethernet connection. Because it seems possible (i get meassurements with puTTY no ethernet connecton) but i dont get the hang of it
Wouter
"
Re: Matlab interface with usb only no ethernet connection
Posted: Fri Feb 20, 2015 1:31 am
by Nils Roos
Hi Wouter,
If you connect the Red Pitaya (CON socket) to your computer with USB, it will look and act like a FTDI USB serial adapter.
Once the FTDI driver finishes installing, it will be recognized as a COM port. You can alter the plink parameters to establish a connection over this serial link.
Assuming the FTDI adapter is your COM10, the plink call would be
Code: Select all
dos('plink.exe -serial COM10 -sercfg 115200,8,n,1 /opt/bin/generate 1 1 40000 sine');
Since the USB console is active and can be connected to from the moment the Red Pitaya powers up, you have to allow for the boot process to finish before issuing commands this way.
Re: Matlab interface with usb only no ethernet connection
Posted: Fri Feb 20, 2015 3:08 pm
by WouterS
Hi,
The command seems fine, but when i try to test it it says:"Unable to open the connection", strange because when i meassure with putty on the same port COM3 it can meassure my signals
Any hints on that?
Kind regards
Wouter
Re: Matlab interface with usb only no ethernet connection
Posted: Fri Feb 20, 2015 9:32 pm
by Nils Roos
The only idea I have on that is that the serial port can only be opened by one process. If you are connected to the Red Pitaya with PuTTY, plink can not claim the serial interface and vice versa. Even another instance of the same program can not use the interface as long as it is opened.
Re: Matlab interface with usb only no ethernet connection
Posted: Mon May 04, 2015 1:16 pm
by WouterS
Hi Nils
I wanted to test this command line cause its one of the latest tasks i have to do to finish my bachelor thesis. But i don't get this fixed, and i installed the virtual com port and been looking for it but i don't see my fault.
Do you got a clue where i have to search next , because if i enter the command line it doesn't generate the signal but it also doesn't give an error message.
It would be awesome if this work, they might start using the red pitaya for measurements at this university and usb would be more useful cause we don't have access to the internet everywhere.
http://imgur.com/x9h6mSW
Kind regards
Wouter
Re: Matlab interface with usb only no ethernet connection
Posted: Mon May 04, 2015 10:54 pm
by Nils Roos
As far as I can tell, the plink.exe that you (and I) are using does not actually send the command over the serial link. Neither does it accept a file with commands via the -m parameter in that case. What it does is open an interactive session - try pressing enter after calling plink^^
To all outer appearances, a serial session is handled by plink much like a raw session, it just forwards stdin and stdout.
I've succeeded in sending commands with the following:
Code: Select all
echo /opt/bin/generate 1 2 500 sine | plink.exe -sercfg 115200,8,n,1,X -serial COM10
The problem with this is that I haven't figured out how to terminate plink afterwards, other than by manually pressing ctrl-c.
Re: Matlab interface with usb only no ethernet connection
Posted: Fri Jul 24, 2015 2:20 am
by albert.ruiz
Hi all,
I tried to connect my RP through the serial port and generate a signal with the commands:
s = serial('COM4','BaudRate',115200,'DataBits',8,'StopBits',1,'Parity','none','FlowControl','none');
fopen (s)
s.Terminator = 'CR/LF'
fprintf(s,'SOUR1:FUNC SINE')
fprintf(s,'SOUR1:FREQ:FIX 2000')
fprintf(s,'SOUR1:VOLT 0.5')
fprintf(s,'OUTPUT1:STATE ON')
fclose(s)
But it doesn't do anything, while using the TCP/IP communications it does perfectly. Why is that? Is there some step I need to do before running the code.
I prefer to communicate with the serial port as I will have no access to internet in the field.
Cheers,
Albert
Re: Matlab interface with usb only no ethernet connection
Posted: Fri Jul 24, 2015 6:52 pm
by Nils Roos
Hi Albert,
As far as I know, the scpi-server does not listen to the console's standard input, which is where the serial connection delivers it's data to.
It may be possible to reroute the standard input to the listening port of the scpi-server - maybe with netcat or something.
I prefer to communicate with the serial port as I will have no access to internet in the field.
You don't need internet, you just need a network connection between two devices. You can for example connect the RP to a notebook with a LAN cable. Configure both devices for static IP addresses and you're good. Or you can have either device act as a wireless access point and connect them up that way.