DIgital Pulse sequence ( train of pulses)

Just about everything about Red Pitaya
Post Reply
JeanTeissier
Posts: 2
Joined: Sat Apr 16, 2016 12:31 pm

DIgital Pulse sequence ( train of pulses)

Post by JeanTeissier » Mon Apr 18, 2016 6:03 pm

Dear All,

I bought a RB as a cheap Spectrum and Network analyzer, but it turns out to be sooooo moooore !!!! :D
I just checked that it could almost replace our PulseBlaster 500 for running fast RMN sequences ( and divide the cost of the experiment :-) )

We have several aux analog outputs as well as digital outputs (see below).
I can't find it on the forum but does it exist a way to write pulses sequences (with Matlab ?) on the card, and then start it with a trigger?
I mean can I write the following sequence:

For 100ns set 10010202011 for the digital, xxx for the OUT1, yyy for OUT2, etc for all channels
then 200ns set 0000000000 for....
then 1000 ns set .....
etc..
etc...

At the end I write this on the card, and then start this on a trigger.

For RMN experiments this would be so great !!!

Best
Jean



Auxiliary analog output channels
- Number of channels: 4
- Output type: Low pass filtered PWM (I)
- PWM time resolution: 4ns (1/250 MHz)
- Connector: dedicated pins on IDC connector E2 (pins 17,18,19,20) v - Output voltage range: 0 to +1.8 V
- Output coupling: DC
General purpose digital input/output channels: (N)
- Number of digital input/output pins: 16
- Voltage level: 3.3 V
- Direction: configurable
- Location: IDC connector E1 (pins 3­24 )

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: DIgital Pulse sequence ( train of pulses)

Post by Nils Roos » Mon Apr 18, 2016 9:01 pm

Hi Jean,

to my knowledge, there is not yet an application to do that. But it is not very difficult to implement.

What amount of pre-programmed events would you say is required to be useful ?

JeanTeissier
Posts: 2
Joined: Sat Apr 16, 2016 12:31 pm

Re: DIgital Pulse sequence ( train of pulses)

Post by JeanTeissier » Tue Apr 19, 2016 7:33 am

Hello,

Well I would say, the ability to add analog/digital pulses/states one after another, like in my example and with a final state.

If possible, the ability to loop some part of the sequences X times would be awesome, but I don't know if it is possible.

FOR NRM and else, the output of the fast pulse cards is just a set of pulses on different channels. I added an example.

The best ( for me at least :-) ) would be to have the ability to send the list of pulses through Matlab.

If you believe it is possible,and want to implement it, I would be happy to help with my (very modest) knowledge...
You do not have the required permissions to view the files attached to this post.

CulLight
Posts: 1
Joined: Wed Apr 20, 2016 6:34 pm

Re: DIgital Pulse sequence ( train of pulses)

Post by CulLight » Wed Apr 20, 2016 6:43 pm

Hi,

I was also looking for a way to save multiple pulses in a buffer and then output the whole buffer with a software or hardware trigger.
I was imaging something like
sequence = {[dur_1 digital_1] ; [dur_2 digital_2] ; [dur_3 digital_3] ; [dur_4 digital_4] ; ........ ; [dur_n digital_n] }
where dur_i is the duration of the pulse and digital_i is the binary value representing the state of all digital outputs, meaning digital = 14 would be 0*2^0 + 1*2^1 + 1*2^2 + 1* 2^3, ergo channel 2,3,4 are on.

However I dont know how to do such a buffered programming. Do I need to programm the FPGA? How do I do that?

Thanks so much in advance

Losgadie
Posts: 7
Joined: Tue Aug 25, 2015 12:47 pm

Re: DIgital Pulse sequence ( train of pulses)

Post by Losgadie » Sun May 29, 2016 6:21 am

Hi
I would like to do a similar thing if possible using Matlab. I'm using the scpi commands to create a single RF pulse
though I had some problems with a short pulse (5μs) getting two pulses the first Ok but the second of random length- but by putting a reset in the loop that seems to be fixed(see below). What I really need for my application is to create a digital pulse that start a short delay (say 10μs) before the RF pulse and ends after it (say 10μs).
I've had no success at even just switching the digital O/P on and off - I'm very experienced! . The code below should switch the DIO pins on and off after the LED (which flashes)but I can see no digital pulse on the connector.
I would really appreciate any help.
Thanks
Terry

%% Define Red Pitaya as TCP/IP object

clc
clear all
close all
IP= '192.168.1.101'; % Input IP of your Red Pitaya...
port = 5000; % If you are using WiFi then IP is:
tcpipObj=tcpip(IP, port); % 192.168.128.1
fopen(tcpipObj);
tcpipObj.Terminator = 'CR/LF'
noOfScans=1000;
for irun=1:1:noOfScans
fprintf(tcpipObj,'GEN:RST');
%% The example generates a single RF pulse approx 5 μs every 0.5 second
fprintf(tcpipObj,'SOUR1:FREQ:FIX 29000000'); % Set frequency of output signal
fprintf(tcpipObj,'SOUR1:VOLT 0.5'); % Set amplitude of output signal
fprintf(tcpipObj,'SOUR1:FUNC SINE');
fprintf(tcpipObj,'SOUR1:BURS:STAT ON'); % Set burst mode to ON
fprintf(tcpipObj,'SOUR1:BURS:NCYC 145'); % Set 1 pulses of sine wave
fprintf(tcpipObj,'SOUR1:BURS:NOR 1'); % Infinity number of sine wave pulses
fprintf(tcpipObj,'SOUR1:BURS:INT:PER 100'); % Set time of burst period in microseconds = 5 * 1/Frequency * 1000000
fprintf(tcpipObj,'SOUR1:TRIG:IMM'); % Set generator trigger to immediately
fprintf(tcpipObj,'OUTPUT1:STATE ON'); % Set output to ON
%% Digtal IO to flash LED and create DIO pulse
fprintf(tcpipObj,'DIG:PIN:DIR OUTP,DIO0_N');
fprintf(tcpipObj,'DIG:PIN DIO0_N,0');
fprintf(tcpipObj,'DIG:PIN DIO0_N,1');
fprintf(tcpipObj,'DIG:PIN LED1,1');
pause(0.5)
fprintf(tcpipObj,'DIG:PIN LED1,0');
fprintf(tcpipObj,'DIG:PIN DIO0_N,0')

%% Close connection with Red Pitaya
pause(1);
display([' No Of Experiment ',num2str(irun)]);
end

fclose(tcpipObj)

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: DIgital Pulse sequence ( train of pulses)

Post by Nils Roos » Sun May 29, 2016 11:25 am

The actual values for the direction parameter are "IN" and "OUT", although the documentation says otherwise (see also here).
So your GPIO is still configured as input (the default), because the "DIG:PIN:DIR OUTP,DIO0_N" returns an error.

Losgadie
Posts: 7
Joined: Tue Aug 25, 2015 12:47 pm

Re: DIgital Pulse sequence ( train of pulses)

Post by Losgadie » Fri Jun 03, 2016 12:59 pm

Hi
Thanks very much for that- its explains a lot
I now have a digital and RF pulse. but the delay are too large for my application and there is an issue with the RF pulse not going to zero- though sometimes it does?
The code fragment I have is below

%% Define Red Pitaya as TCP/IP object
clc
clear all
close all
IP= '192.168.1.101'; % Input IP of your Red Pitaya...
port = 5000; % If you are using WiFi then IP is:
tcpipObj=tcpip(IP, port); % 192.168.128.1
fopen(tcpipObj);
tcpipObj.Terminator = 'CR/LF'
noOfScans=1000;
for irun=1:1:noOfScans
fprintf(tcpipObj,'GEN:RST');
%% The example generates a single RF pulse approx 5 7micros every 0.5 second
%%
fprintf(tcpipObj,'SOUR1:FREQ:FIX 29000000'); % Set frequency of output signal
fprintf(tcpipObj,'SOUR1:VOLT 0.5'); % Set amplitude of output signal
fprintf(tcpipObj,'SOUR1:FUNC SINE');
fprintf(tcpipObj,'SOUR1:VOLT:OFFS 0.0');
fprintf(tcpipObj,'SOUR1:BURS:STAT ON'); % Set burst mode to ON
fprintf(tcpipObj,'SOUR1:BURS:NCYC 145'); % Set 1 pulses of sine wave
%fprintf(tcpipObj,'SOUR1:BURS:NOR 1'); % Infinity number of sine wave pulses
%fprintf(tcpipObj,'SOUR1:BURS:INT:PER 10'); % Set time of burst period in microseconds = 5 * 1/Frequency * 1000000
fprintf(tcpipObj,'SOUR1:TRIG:IMM');
% Enable Gating pulse
fprintf(tcpipObj,'DIG:PIN:DIR OUT,DIO0_N');
fprintf(tcpipObj,'DIG:PIN DIO0_N,0');% Switch DIO OFF
fprintf(tcpipObj,'DIG:PIN DIO0_N,1');% Switch DIO ON
fprintf(tcpipObj,'OUTPUT1:STATE ON'); % Set output to ON
fprintf(tcpipObj,'OUTPUT1:STATE OFF');
% Disable Gating pulse
fprintf(tcpipObj,'DIG:PIN DIO0_N,0');% Switch DIO OFF
% Set output to ON
%% Digtal IO to flash LED
fprintf(tcpipObj,'DIG:PIN LED1,1');
fprintf(tcpipObj,'DIG:PIN LED1,0');


%% Close connection with Red Pitaya
pause(1);
display([' No Of Experiment ',num2str(irun)]);
end

fclose(tcpipObj);

and this produces this output
Screen Shot 2016-06-03 at 12.36.28.png
For the digital pulse (red)I really want to have a short delay before the pulse say 10microseconds
and the same after. I'm assuming that the code is interpreted from Matlab so the timings are what they are
but can I improve this?
Also I need the RF pulse to go to zero.
Any help would be really appreciated!!
Thanks
Terry
You do not have the required permissions to view the files attached to this post.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: DIgital Pulse sequence ( train of pulses)

Post by Nils Roos » Sat Jun 04, 2016 1:12 pm

For the digital pulse (red)I really want to have a short delay before the pulse say 10microseconds and the same after. I'm assuming that the code is interpreted from Matlab so the timings are what they are but can I improve this?
First you could do a little experiment to find out what you should expect with your setup: just switch the GPIO pin on and off a few times and measure the pulses - you wont get any better than that.
Also I need the RF pulse to go to zero.
It took me a while to figure out what happens: this is an artefact of the way the generator logic works internally.
Here's a short run-down:
  • the waveform buffer is filled with one period of the target waveform
  • to generate the output signal, a read pointer traverses the buffer at 125MHz with a constant increment, which is chosen to yield the requested frequency
  • frequency f and increment (step size) d are related according to f = d * 125000000Hz / 16384
  • when the read pointer overshoots the end of the buffer, the overshoot is carried over into the next round as start offset
  • a burst is complete when the read pointer overshoots the end of the buffer in the last cycle of the burst - in this situation, the last sample that appears on the output will be the one that the read pointer addresses after the overshoot (ie from the start of the waveform)
In your case, with a frequency of 29MHz the step size is d = 3801.088, so your burst ends somewhere from 0 to 3800 samples into the sine wave. That is nearly PI/2 radians - in other words anywhere from 0V to +amplitude, depending on frequency and number of cycles in one burst.

I can also offer a solution: as long as your burst duration is smaller than 131µs, you can pre-calculate the complete burst waveform and generate it as an arbitrary waveform, single cycle burst with a frequency setting of 7629.39453125Hz (ie step size d=1). In your pre-calculated data you can make sure that the wave ends in 0V.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 114 guests