Tell us how your experiment is running with Red Pitaya
#7354 by kooper
Thu Mar 16, 2017 6:30 pm
Hi!

I try to acquire some signal data over the network with python.
For signal generation (1 kHz, 1 V) I use the example from the wiki. For aquisition I use the following code:

Code: Select all#!/usr/bin/python

import sys
from time import sleep
import redpitaya_scpi as scpi
import matplotlib.pyplot as plot

ip = 'insert ip here'

rp_s = scpi.scpi(ip)

rp_s.tx_txt('ACQ:RST')
rp_s.tx_txt('ACQ:SOUR1:GAIN LV')
rp_s.tx_txt('ACQ:TRIG:LEV 0')
rp_s.tx_txt('ACQ:TRIG:DLY 0')
rp_s.tx_txt('ACQ:DEC 8')
rp_s.tx_txt('ACQ:START')

sleep(0.1)

rp_s.tx_txt('ACQ:TRIG CH1_PE')

while 1:
    rp_s.tx_txt('ACQ:TRIG:STAT?')
    if rp_s.rx_txt() == 'TD':
        break

rp_s.tx_txt('ACQ:SOUR1:DATA?')

buff_string = rp_s.rx_txt()
buff_string = buff_string.strip('{}\n\r').replace("  ", "").split(',')
buff = list(map(float, buff_string))

plot.plot(buff)
plot.ylabel('Voltage')
plot.grid()
plot.show()


First of all I got some result which looks good. But if I take a deeper look, I wonder why the signal is not starting at 0V. There is no delay and the trigger level is set to 0V.

Another confusing thing is that setting the trigger event comes after 'ACQ:START'. Am I right that with 'ACQ:START' the (ring?) buffer get filled? But where comes the trigger in?

THX!
#7357 by Nils Roos
Fri Mar 17, 2017 1:46 pm
I wonder why the signal is not starting at 0V. There is no delay and the trigger level is set to 0V.

Setting a trigger delay of 0 does not mean "no delay". The trigger delay is increased by 8192 samples internally, in order to have the trigger be in the middle of the buffer by default. If you want the trigger event to be at the beginning of the recorded data, you need to set a delay of 8192.

Another confusing thing is that setting the trigger event comes after 'ACQ:START'. Am I right that with 'ACQ:START' the (ring?) buffer get filled? But where comes the trigger in?

ACQ:START starts filling the ringbuffer, but recording does not stop when the end of the buffer is reached. The buffer will be filled over and over so that at any point in time it contains the latest 16384 samples. The trigger (plus the trigger delay) marks the point when recording into the ringbuffer is stopped. When the trigger happened and the trigger delay is over, the buffer will no longer be updated so that you can read out the contents.
#7361 by kooper
Fri Mar 17, 2017 10:54 pm
Thanks Nils to bring some light into the darkness!

First, is it possible to extend the buffer by simple change the size at the malloc or is this somewhat of hardwired in the FPGA?

Second, just to get this right, trigger in this scope is not the same as in the old analog days, where the beam starts at the left side of the CRT?!

By getting the buffer with ACQ:SOUR1:DATA? I lost the trigger information?

Thx
#7363 by kooper
Sat Mar 18, 2017 10:02 am
Ok by using ACQ:TPOS? I get the position in the data array and by using the delay I can control how many samples I get after the trigger occurs!?
#7369 by Nils Roos
Sun Mar 19, 2017 11:26 pm
is it possible to extend the buffer by simple change the size at the malloc or is this somewhat of hardwired in the FPGA?

The buffer size of 16384 samples per channel is hardwired.

trigger in this scope is not the same as in the old analog days, where the beam starts at the left side of the CRT?!

Ok by using ACQ:TPOS? I get the position in the data array and by using the delay I can control how many samples I get after the trigger occurs!?

A trigger condition is recognized instantaneously, like in the old days, but at that moment, you already have the last 16k samples buffered. So by stopping the recording 0-16383 samples after the trigger happened, you can shift the trigger position over the whole width of your 'screen' (or even further to the left if you use larger values).
Like you said, with "ACQ:TPOS?" you read the trigger position inside the buffer. But "ACQ:SOUR#:DATA?" does not read the buffer from absolute 0-16383. Instead, it reads relative to the point when recording stopped. For example if the trigger happened at (TPOS=) 1000 and you had an effective trigger delay of 2000, you will get 3000-16383 concatenated with 0-2999.

Who is online

Users browsing this forum: No registered users and 2 guests