Python: fast data acquisition

Applications, development tools, FPGA, C, WEB
aschuetz
Posts: 34
Joined: Tue Nov 24, 2015 11:26 am

Python: fast data acquisition

Post by aschuetz » Mon Apr 18, 2016 11:07 am

Dear all,

I use Python for data acquisition from the RP via SCPI. This works fine but it is to slow. I'm pretty sure that neither the network connections nor Python is the bottleneck because I did something similar with much more data which is quite fast. My acquisition is based on the example from the webpage: http://redpitaya.com/examples-new/singl ... r-acquire/

Here is my code (in parts):

Code: Select all

[...]

import redpitaya_scpi as scpi
rp_s = scpi.scpi('xxx.xxx.xxx.xxx',timeout=5)

# start acquisition
    try:
        rp_s.tx_txt('ACQ:START')
    except:
        print('Data acquisition exception ... Is SCPI server running?')  
        sys.exit(0)  
    
    rp_s.tx_txt('ACQ:AVG ON')

    # set trigger to channel 2 for TTL trigger signal
    rp_s.tx_txt('ACQ:TRIG CH2_PE')

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

    # get current
    rp_s.tx_txt('ACQ:SOUR1:DATA?')

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

[...]
I tried to switch off averaging, plotting and saving the data. But it doesn't boost my program. I also tried to reduce the data by using

Code: Select all

rp_s.tx_txt('ACQ:SOUR1:DATA:STA:END? 1000,5000')
instead of

Code: Select all

rp_s.tx_txt('ACQ:SOUR1:DATA?')
. But the manual seems to be wrong because and it confused me with the syntax:

Code: Select all

ACQ:SOUR<n>:DATA:STA:END?<start_pos>,<end_pos>
In the example it is:

Code: Select all

ACQ:SOUR1:GET:DATA 10,13
I don't understand this part ...

Does someone know how to acquire data faster? This seems to be a single shot acquiring only. Is the something like a circular buffer with a fast reading procedure?

Thank you,
Alex

tonybj
Posts: 1
Joined: Tue Apr 19, 2016 10:54 am

Re: Python: fast data acquisition

Post by tonybj » Tue Apr 19, 2016 12:07 pm

I'm having the same problem, just waiting for a trigger takes a minimum of 80ms regardless of signal frequency.

In my current application this is the performance in regards to buffer size:

2 samples -> 200ms
100 samples -> 250ms
2000 samples ->250ms
16000 samples ->670ms

aschuetz
Posts: 34
Joined: Tue Nov 24, 2015 11:26 am

Re: Python: fast data acquisition

Post by aschuetz » Fri Apr 29, 2016 9:28 am

tonybj wrote: 2 samples -> 200ms
100 samples -> 250ms
2000 samples ->250ms
16000 samples ->670ms

How did you change the buffersize? Directly in the acquisition.c or is there any command for SCPI?

Alex

jerzydziewierz
Posts: 31
Joined: Mon Mar 28, 2016 1:10 pm

Re: Python: fast data acquisition

Post by jerzydziewierz » Fri Apr 29, 2016 10:23 am

This is a known issue with SCPI,
only 16k samples and long turnaround time.

One solution is to not use SCPI and use continious acquisition method instead. look for rp_remote_acquire on this forum.

I guess, over time, everything will switch to this new method . . . . .

aschuetz
Posts: 34
Joined: Tue Nov 24, 2015 11:26 am

Re: Python: fast data acquisition

Post by aschuetz » Mon May 02, 2016 9:32 am

This sounds interesting. While "rp_remote_acquire" is not included in the master I've found a repository for that https://github.com/HrRossi/RedPitaya/tree/dev_ddrdump where "rp_remote_acquire" is included in the "Test" folder.

I cloned it via "git clone -b dev_ddrdump https://github.com/HrRossi/RedPitaya.git". Then I installed the SDK. After calling "make" I got the binary. But I cannot use it. After calling "rp_remote_acquire" without arguments I tried the following via SSH on the RedPitaya to save data into a file:

Code: Select all

./rp_remote_acquire -m file -d 1 -f /tmp/out.dat
open scope failed, 2
Why do I receive that error?

I checked the acquisition with "acquire.c" where I do receive data.

jerzydziewierz
Posts: 31
Joined: Mon Mar 28, 2016 1:10 pm

Re: Python: fast data acquisition

Post by jerzydziewierz » Mon May 02, 2016 2:25 pm

I got the binary. But I cannot use it.

Code: Select all

 open scope failed, 2
this command requires a specific FPGA software loaded, so just to make sure, have you loaded the FPGA bitfile?

aschuetz
Posts: 34
Joined: Tue Nov 24, 2015 11:26 am

Re: Python: fast data acquisition

Post by aschuetz » Mon May 02, 2016 3:26 pm

jerzydziewierz wrote: this command requires a specific FPGA software loaded, so just to make sure, have you loaded the FPGA bitfile?
Probably not. Where do I find it? There is a folder called "FPGA" with source code. Do I have to compile it? Is there any daemon available to load it on start-up?

Thanks,
Alex

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

Re: Python: fast data acquisition

Post by Nils Roos » Tue May 03, 2016 12:05 am

The rp_remote_acquire program needs a device driver (rpad) to work, and the driver only loads when it finds a certain fpga bitstream. There is a link to download a dedicated ecosystem that does both during boot in the thread that deals with rp_remote_acquire.

aschuetz
Posts: 34
Joined: Tue Nov 24, 2015 11:26 am

Re: Python: fast data acquisition

Post by aschuetz » Tue May 03, 2016 8:32 am

Nils Roos wrote:The rp_remote_acquire program needs a device driver (rpad) to work, and the driver only loads when it finds a certain fpga bitstream. There is a link to download a dedicated ecosystem that does both during boot in the thread that deals with rp_remote_acquire.
Thanks for the answer. I would like to use the current ecosystem and as it is written "ecosystems 0.92-388 and later" it should work. So I've downloaded the binary and copied it into the /tmp folder. But I get an error while installing the fpga bitstream:

Code: Select all

redpitaya> nginx -p /opt/www
nginx: symbol lookup error: nginx: undefined symbol: _ZNSt8ios_base4Init11_S_refcountE
redpitaya> insmod rpad.ko
insmod: ERROR: could not insert module rpad.ko: Invalid module format
redpitaya> 
Do you know what's going wrong here?

Thanks,
Alex
[/code]

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

Re: Python: fast data acquisition

Post by Nils Roos » Tue May 03, 2016 9:23 pm

When I posted the project, 0.92 was the highest ecosystem version in existence.

Ecosystem v0.94 broke binary compatibility for basically everything that went before, so you can't take the 0.92 components and use them on 0.94 or later. You can either use the complete 0.92 variant ecosystem or adapt and rebuild the driver and application on 0.94 .

Even stopping nginx is now done differently than before ("systemctl stop redpitaya_nginx").

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