remote program with python have a wrong data form RF input

Applications, development tools, FPGA, C, WEB
Post Reply
sophistGuapi
Posts: 1
Joined: Wed Jan 17, 2024 6:35 am

remote program with python have a wrong data form RF input

Post by sophistGuapi » Wed Jan 17, 2024 8:49 am

I'm new of red pitaya develop.
I want to get data form red pitaya RF input,and compute them use python in my computer.At first I have program base on https://redpitaya.readthedocs.io/en/lat ... e-examples.I launch this example will endless loop in

Code: Select all

while 1:
    rp_s.tx_txt('ACQ:TRIG:FILL?')
    print(rp_s)
    if rp_s.rx_txt() == '1':
        break
so I delete these codes and run it succesful.
but when I loop the code to get data and update in plot,It just print first data with these codes:

Code: Select all

def get_source_data(device):
    device.tx_txt('ACQ:SOUR1:DATA?')
    buff_string = device.rx_txt()
    buff_string = buff_string.strip('{}\n\r').replace("  ", "").split(',')
    buff = list(map(float, buff_string))
    return buff
I learn the code in forum and improve it:

Code: Select all

def get_source_data(device):
    device.tx_txt('ACQ:START')
    device.tx_txt('ACQ:SOUR1:DATA?')
    buff_string = device.rx_txt()
    buff_string = buff_string.strip('{}\n\r').replace("  ", "").split(',')
    buff = list(map(float, buff_string))
    return buff
Now the codes can update plot normally but sometime it get a wrong data like this(signal of sine):
it look like some points suddenly drop to other side, I found these sample points are near together(like 1510 and 1511).
If I set the DEC to 32 or more,it will disappear in plot,but some time it will be suddenly arise again.
I need to know why and how to resolve this problem,thinks.

User avatar
redpitaya
Site Admin
Posts: 912
Joined: Wed Mar 26, 2014 7:04 pm

Re: remote program with python have a wrong data form RF input

Post by redpitaya » Mon Jan 22, 2024 11:45 am

Hello sophistGuapi,

Thank you for writing on the forum.

Yes, the ACQ:TRIG:FILL command only works on OS versions 2.00-15 and above. This is mentioned in the documentation, but we will include notes in the examples as well.

The issue you are experiencing might be related to Red Pitaya not having enough time to capture the data, before being asked for more. The Red Pitaya always captures a buffer of 16384 samples and when setting higher decimation values, the time also increases (for decimation 32 it takes 32*16384/125e6 to capture the full buffer). At higher decimations we recommend putting a time delay between ACQ:START and ACQ:TRIG command. Also your code is missing the trigger command (the trigger must be set after starting the acquisition). Like in the examples:

Code: Select all

rp_s.tx_txt('ACQ:START')
# insert time.sleep() here
rp_s.tx_txt('ACQ:TRIG CH1_PE')		# the trigger condition is specified here (the trigger level and other acquisition settings can be outside the while loop)

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

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 90 guests