Synchronization of generate and acquire

Just about everything about Red Pitaya
edgo
Posts: 34
Joined: Wed Jun 25, 2014 11:38 pm

Synchronization of generate and acquire

Post by edgo » Thu Jun 26, 2014 5:46 pm

With reference to an earlier discussion back in the Community:

https://redpitaya.zendesk.com/hc/commun ... chitecture

Wijnand asked:
Q: I want to use generate and acquire in (motion) control applications but then with single ADC and DAC commands. Are generate and acquire build on single ADC/DAC commands?

Crt replied:
A: Generate and acquire utilites could be combined in one tool and it is also possible to synchronize the acquisition and data generation.

I'm hoping that Crt will see this and shed some light on the subject.

My question: how would we accomplish the synchronization of generate and acquire?

I've looked through the "FPGA memory map" document, and in the Oscilloscope section there is the offset/description of "0x4 / Trigger source" ... would we select a Trigger source setting here like "8-arbitrary wave generator application positive edge" when initializing our application? Any other insights into how to accomplish this?

Thanks,

Ed

Crt Valentincic
Posts: 67
Joined: Wed May 28, 2014 12:15 pm

Re: Synchronization of generate and acquire

Post by Crt Valentincic » Fri Jun 27, 2014 8:56 am

Exactly. Acquisition can be triggered by AWG module if you select it as a trigger source. Here is an example:

Code: Select all

// trigger source is AWG
monitor 0x40100004 0x8
// ARM trigger
monitor 0x40100000 0x1
// write pointer is running
redpitaya> monitor 0x40100018
0x0000049c
redpitaya> monitor 0x40100018
0x00002031
// trigger pointer is 0
redpitaya> monitor 0x4010001c
0x00000000
// AWG
monitor 0x40200000 0x21
// acq. was triggered - read trigger pointer
redpitaya> monitor 0x4010001c
0x0000386f
Registers are explained here: https://github.com/RedPitaya/RedPitaya/ ... t?raw=true

edgo
Posts: 34
Joined: Wed Jun 25, 2014 11:38 pm

Re: Synchronization of generate and acquire

Post by edgo » Fri Jun 27, 2014 10:13 pm

Thanks, Črt! I'll work with this and see how it goes ... probably have more questions!

Ed

srb53
Posts: 4
Joined: Wed Jul 02, 2014 11:24 am

Re: Synchronization of generate and acquire

Post by srb53 » Wed Jul 02, 2014 2:59 pm

Hi,
Should i use a similar method to read the ADC level after an external trigger? Also, can a delay between trigger and read be easily implemented?

Thanks

edgo
Posts: 34
Joined: Wed Jun 25, 2014 11:38 pm

Re: Synchronization of generate and acquire

Post by edgo » Wed Jul 02, 2014 10:09 pm

Črt,

I've been able to hack the "monitor" code to run all of the commands you suggested at one time, from within one program.

But now, I don't seem to be able to acquire data using the trigger pointer read in the last step of your example.

Possibly I have a incorrect idea of how to accomplish this. But what I would like to do after getting the trigger pointer, is acquire X number of samples from ADC buffer, using the trigger pointer, i.e. always on the positive edge. Of course if trigger pointer is too close to end of 16384 buffer then I will not be able to get many data points.

After the last step "acq. was triggered - read trigger pointer" I have then initialized like the oscilloscope app with "rp_app_init()" and then called "rp_get_signals()". I don't get good data like ordinary "acquire" program usually returns.

Any suggestions you can add about the correct way to do this would be appreciated! I've been looking through the guts of the oscilloscope code to shed some light, also.

cheers,

Ed

Crt Valentincic
Posts: 67
Joined: Wed May 28, 2014 12:15 pm

Re: Synchronization of generate and acquire

Post by Crt Valentincic » Tue Jul 15, 2014 7:43 am

Once you "ARM" the acquisition module, the write pointer will start running around the circular 16k buffer, witting ADC samples into it's memory with sample freq. decimated by decimation factor. Write pointer position is then captured into trigger pointer register right at the moment when trigger arrives. After that user can read the complete circular buffer (starting from trigger pointer).
I have already started to update this part of documentation http://wiki.redpitaya.com/index.php?tit ... ifications and I hope that I will have time to complete it in the next few days.

airizar
Posts: 10
Joined: Wed Jul 09, 2014 4:25 pm

Re: Synchronization of generate and acquire

Post by airizar » Mon Jul 28, 2014 10:03 pm

For true synchronization between generation and acquire you need to modify the FPGA design.
Writing from compiled code does not guarantee deterministic delays between generation and acquisition.
It is not difficult to modify the code. I've managed to do it by generating a trigger after certain amount of counts of a counter. The trigger I used is entering the scope via the external trigger ( I had to reroute one of the external digital outputs as the external trigger)

Regards

Andoni

srb53
Posts: 4
Joined: Wed Jul 02, 2014 11:24 am

Re: Synchronization of generate and acquire

Post by srb53 » Wed Jul 30, 2014 2:18 pm

Hi,
Can someone please tell me what i'm doing wrong?

i'm connected to my Redpitaya via ethernet using putty.
i'm trying to measure the amplitude of a 50 µs pulse known to be ~900 mV at a rep rate of 0.1 Hz.
i use the following commands:

redpitaya> monitor 0x40100000 0x1 - Reset write state machine
redpitaya> monitor 0x40100004 0x6 - Set trigger to external, pos edge
redpitaya> monitor 0x40100014 0x1024 - Set decimation to sample every 8 µs
redpitaya> monitor 0x40100000 0x0 - Arm trigger
redpitaya> monitor 0x40110004 - Read the 4th sample within memory
0x0000008d - Value read from memory is inconsistent with trace on my oscilloscope

Any help would be appreciated.

Thanks

Steve

Crt Valentincic
Posts: 67
Joined: Wed May 28, 2014 12:15 pm

Re: Synchronization of generate and acquire

Post by Crt Valentincic » Mon Aug 18, 2014 12:56 pm

I would suggest that you first confirm that trigger successfully stopped the acquisition, by reading
trigger source register that should be in such case reset to zero.
Notice also that acquisition is started when trigger is ARMed and it stops once trigger arrives.
Last sample taken is located at the position where trigger stopped the acquisition (monitor 0x4010001c).
The acquired data is in ADC raw signed format (-8192 to 8191) that equals same voltage range as it is defined by gain setting.

srb53
Posts: 4
Joined: Wed Jul 02, 2014 11:24 am

Re: Synchronization of generate and acquire

Post by srb53 » Thu Aug 21, 2014 2:23 pm

Hi Crt,

Thanks for your reply,

i still can't manage to get the correct level from a triggered event, is the sequence below correct?

redpitaya> monitor 0x40100000 0x1
redpitaya> monitor 0x40100014 0x1024
redpitaya> monitor 0x40100000 0x0
redpitaya> monitor 0x40100004 0x3
redpitaya> monitor 0x40100004
0x00000000

As you see, i reset the write state machine > set the decimation factor > arm the trigger > set the trigger to chA neg edge > check the trigger source has returned to zero.

If i then read the write pointer location:
redpitaya> monitor 0x4010001c
0x00002d94

Should i try to read the previous memory location? i.e. 0x40112d94. if this is all correct, i don't get the correct result. Any ideas?

Thanks

Steve

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