Generating pulses with RP
Posted: Fri May 06, 2016 8:19 am
Hi there, how exactly does the generation of signals (in particular pulses of arbitrary shape) work in Red Pitaya and what are its limitations? My aim is to generate a single square pulse that starts at 0 V, rises as rapidly as possible, lasts for about 100ns (not sure whether such a short duration is possible) and then returns to 0 V. What are the limitations of the RP with regards to the rise time of such a square signal? I've been experimenting with the arbitrary waveform functions of the API, but I am not getting the results I want. As a first step, I would like to know how exactly signal generation is implemented in the FPGA and how this relates to the API functions. As I understand it, the digital signal shape is stored in the generate buffer of the FPGA and this buffer is then converted to an analog signal at the chosen frequency (so the whole buffer is read out with a frequency of up to 62.5 MHz). When is the signal generation started, though? As soon as rp_GenOutEnable is called or when rp_GenTriggerSource is set? Also, does the conversion start from the first element of the buffer or from wherever the pointer happened to end up the last time a signal was generated?
I tried to produce a single burst of a square wave (see code below), but instead of producing just one waveform, it generates continuous output. I assumed that whenever the trigger happens, the buffer would be output exactly one time and then the voltage level should return to 0 V. However, it doesn't. I think the online API library is not very clear in its explanations, so if anyone could answer my questions, I would appreciate it very much.
I tried to produce a single burst of a square wave (see code below), but instead of producing just one waveform, it generates continuous output. I assumed that whenever the trigger happens, the buffer would be output exactly one time and then the voltage level should return to 0 V. However, it doesn't. I think the online API library is not very clear in its explanations, so if anyone could answer my questions, I would appreciate it very much.
Code: Select all
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <errno.h>
#include <sys/param.h>
#include "redpitaya/rp.h"
#include "main.h"
int main();
{
if(rp_Init() != 0){
fprintf(stderr, "RP API init failed\n");
}
rp_GenReset();
rp_GenAmp(RP_CH_1, 1.0);
rp_GenFreq(RP_CH_1, 10000);
rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SQUARE);
rp_GenMode(RP_CH_1, RP_GEN_MODE_BURST);
rp_GenBurstCount(RP_CH_1, 1);
rp_GenBurstRepetitions(RP_CH_1, 1);
rp_GenTriggerSource(RP_CH_1, RP_GEN_TRIG_SRC_INTERNAL);
rp_GenOutEnable(RP_CH_1);
rp_Release();
return 0;
}