Hi,
I was looking for a code example:
http://redpitaya.com/examples-new/on-gi ... log-input/
But the example for C is missing.
Thank you
Edit: Ok, i found the API description. Just one question:
How long does it take after the trigger until the adc data is read into the buffer?
Signal acquiring on fast ADC using external trigger
-
- Posts: 2
- Joined: Sat Aug 20, 2016 1:20 pm
-
- Posts: 1441
- Joined: Sat Jun 07, 2014 12:49 pm
- Location: Königswinter
Re: Signal acquiring on fast ADC using external trigger
Hi,
there's also some C examples on github in the RedPitaya/Examples/C directory.
The delay between "sample available" and "sample in buffer" is about 20ns.
there's also some C examples on github in the RedPitaya/Examples/C directory.
While the scope is waiting for a trigger, all incoming samples are recorded into the buffer immediately. When the trigger happens, the scope will continue recording samples in that fashion until the trigger delay is over, then stop.How long does it take after the trigger until the adc data is read into the buffer?
The delay between "sample available" and "sample in buffer" is about 20ns.
-
- Posts: 7
- Joined: Sun Jan 29, 2017 8:32 am
Re: Signal acquiring on fast ADC using external trigger
I am trying to do the same thing, capture fast ADC data, on receipt of a digital trigger :
I have two quadrature channels of baseband signal from the output of my NMR receiver connected to CH1 & CH2 inputs of the Red Pitaya.
And the digital trigger from the NMR pulse programmer connected to PL_DIO0_P (E1 pin 3)
Using the Web Oscilloscope Pro this triggers, captures and displays fine :
Turning that off, and using the example
In :
/opt/redpitaya/examples
Where there is a C/API example for triggered fast ADC capture (single channel)
acquire_trigger_posedge.c
I have modified it to look for an external logic level negative edge trigger :
rp_AcqSetTriggerLevel(1.0);
rp_AcqSetTriggerSrc(RP_TRIG_SRC_EXT_NE);
It captures fine, and returns data,
But it never waits for the trigger - it always returns randomly captured data, after the default 1 s delay,
even if I turn the trigger off, or say set it to one pulse every 10 s.
Does anyone know where the problem may lie ? Is it looking at the correct trigger source ?
cheers, Beau
I have two quadrature channels of baseband signal from the output of my NMR receiver connected to CH1 & CH2 inputs of the Red Pitaya.
And the digital trigger from the NMR pulse programmer connected to PL_DIO0_P (E1 pin 3)
Using the Web Oscilloscope Pro this triggers, captures and displays fine :
Turning that off, and using the example
In :
/opt/redpitaya/examples
Where there is a C/API example for triggered fast ADC capture (single channel)
acquire_trigger_posedge.c
I have modified it to look for an external logic level negative edge trigger :
rp_AcqSetTriggerLevel(1.0);
rp_AcqSetTriggerSrc(RP_TRIG_SRC_EXT_NE);
It captures fine, and returns data,
But it never waits for the trigger - it always returns randomly captured data, after the default 1 s delay,
even if I turn the trigger off, or say set it to one pulse every 10 s.
Does anyone know where the problem may lie ? Is it looking at the correct trigger source ?
cheers, Beau
- redpitaya
- Site Admin
- Posts: 907
- Joined: Wed Mar 26, 2014 7:04 pm
Re: Signal acquiring on fast ADC using external trigger
Hi,
First check if you are using latest OS version.
How to prepare SD card version with latest OS is described here.
http://redpitaya.readthedocs.io/en/late ... Dcard.html
use stable release.
Second, make sure you are following this instructions for building and running C examples.
http://redpitaya.readthedocs.io/en/late ... /comC.html
Here is the example which is working for me. Acquisition on external DIGITAL trigger.
Notice that trigger level line is commented since external trigger is a digital one so only trigger edge can be defined.
Also note that max. voltage on external trigger pin is +3.3V. Direct 5V digital signals may damaged the board.
Kind Regards, Zumy
First check if you are using latest OS version.
How to prepare SD card version with latest OS is described here.
http://redpitaya.readthedocs.io/en/late ... Dcard.html
use stable release.
Second, make sure you are following this instructions for building and running C examples.
http://redpitaya.readthedocs.io/en/late ... /comC.html
Here is the example which is working for me. Acquisition on external DIGITAL trigger.
Code: Select all
/* Red Pitaya C API example Acquiring a signal from a buffer
* This application acquires a signal on a specific channel */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "redpitaya/rp.h"
int main(int argc, char **argv){
/* Print error, if rp_Init() function failed */
if(rp_Init() != RP_OK){
fprintf(stderr, "Rp api init failed!\n");
}
/*LOOB BACK FROM OUTPUT 2 - ONLY FOR TESTING*/
rp_GenReset();
rp_GenFreq(RP_CH_1, 20000.0);
rp_GenAmp(RP_CH_1, 1.0);
rp_GenWaveform(RP_CH_1, RP_WAVEFORM_SINE);
rp_GenOutEnable(RP_CH_1);
uint32_t buff_size = 16384;
float *buff = (float *)malloc(buff_size * sizeof(float));
rp_AcqReset();
rp_AcqSetDecimation(RP_DEC_1);
//rp_AcqSetTriggerLevel(RP_CH_1, 0.3);
rp_AcqSetTriggerDelay(0);
rp_AcqStart();
/* After acquisition is started some time delay is needed in order to acquire fresh samples in to buffer*/
/* Here we have used time delay of one second but you can calculate exact value taking in to account buffer*/
/*length and smaling rate*/
sleep(1);
rp_AcqSetTriggerSrc(RP_TRIG_SRC_EXT_PE);
rp_acq_trig_state_t state = RP_TRIG_STATE_TRIGGERED;
while(1){
rp_AcqGetTriggerState(&state);
if(state == RP_TRIG_STATE_TRIGGERED){
break;
}
}
rp_AcqGetOldestDataV(RP_CH_1, &buff_size, buff);
int i;
for(i = 0; i < buff_size; i++){
printf("%f\n", buff[i]);
}
/* Releasing resources */
free(buff);
rp_Release();
return 0;
}
Notice that trigger level line is commented since external trigger is a digital one so only trigger edge can be defined.
Also note that max. voltage on external trigger pin is +3.3V. Direct 5V digital signals may damaged the board.
Kind Regards, Zumy
-
- Posts: 7
- Joined: Sun Jan 29, 2017 8:32 am
Re: Signal acquiring on fast ADC using external trigger
Much appreciated Zumy,
I will work through what you say.
cheers, Beau
I will work through what you say.
cheers, Beau
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 44 guests