Synced ultrasonic emission and reception (time triggered)

Just about everything about Red Pitaya
Post Reply
dourgon
Posts: 2
Joined: Wed Apr 12, 2017 10:45 am

Synced ultrasonic emission and reception (time triggered)

Post by dourgon » Thu Apr 13, 2017 10:53 am

Hello Red Pitaya community,

I have been learning about RP for the last few weeks as part of a small research project. This is my first experience with the RP and with the Zynq, after previous experiences as a student with regular FPGAs.

I am currently working on a project that requires the RP to generate a PWM signal (this I can manage), which is fed into a piezo transducer. On the other end, the receiving piezo signal is amplified and fed back into the RP's fast ADC input for processing in the Linux system. I need to get several samples from the ADC before doing any processing.

I have been reading Anton Potočnik's tutorials to get some familiarity with the RP and then tried to get something together based on Pavel Demin's notes. I have been especially using the ADC recorder (https://github.com/pavel-demin/red-pita ... c_recorder) as a basis.

From what I understood and following some more in-depth reading in the Zynq book, this system is streaming data through AXI directly into the RAM. I added my own state machine for the PWM (bursts) generation (as an AXI IP block) but my issue is that I would need to trigger the ADC at a specific point in time, based on the traveling speed of the waves in the material I am working on, and the distance between the two piezos. The state machine could handle that I guess, by generating a start and stop signal, but I don't have a clear idea of where and how to plug them in to get the behavior I am looking for. I though about resetting the FIFO block, but was not sure and received warning about the timing of my signal which was not properly synced with the clock.

I looked into the ADC recorder trigger project (https://github.com/pavel-demin/red-pita ... er_trigger) but from what I understood, the triggering is done in the sense of an oscilloscope, based on a voltage level, which is not exactly what I am looking for.

So that's it for my main questioning, I hope I've been clear enough with my issues and thanks you in advance for any help you could provide me ;)

Best regards,

Rémi

izi
Posts: 34
Joined: Wed May 27, 2015 11:49 am

Re: Synced ultrasonic emission and reception (time triggered

Post by izi » Tue Apr 18, 2017 8:39 pm

Hi,

We are currently working on a new FPGA image and software, which should fulfill your needs.
The software is written in Python and as a graphical user interface we are using Jupyter.
http://jupyter.org/
The image linked below provides the FPGA image, Python API and working examples for the ADC, DAC, ...
http://downloads.redpitaya.com/download ... 17.img.zip
Signal processing Python libraries scipy and numpy are also provided.
So you should be able to process the data and visualize it without copying it to a PC.
Click through the next steps to get to the example you would be interested into.
1. Open the main page from your RP board
2. click on the Jupyter icon
3. click on the RedPitaya folder
4. click on the welcome notebook
5. select the example with synchronized generator and scope
The example can be run with a loop-back cable from gen to osc to see how it works.

I would recommend using the 125MHz DAC unless the approximately 50MHz bandwidth is not enough for you,
for example if you need very step edges or very short pulses.
Otherwise the DAC is great for creating desired pulse shapes or periodic signals.
Also we do not have a FPGA image with PWM support on GPIO pins yet.

For now the oscilloscope is limited to a 16k sample data buffer, I hope this is enough for your problem.

We are currently testing Jupyter with beta testers, so we should be able to offer some extra support.
Please try to run the examples, ask if you have trouble getting them to work (beta code!),
then we can discuss a proper setup for your problem.

Regards,
Iztok Jeras

dourgon
Posts: 2
Joined: Wed Apr 12, 2017 10:45 am

Re: Synced ultrasonic emission and reception (time triggered

Post by dourgon » Thu Apr 20, 2017 10:44 pm

Hi,

First of all, thanks for the help, I really appreciate it :) I have been able to run the synchronized oscilloscope notebook, along with a generator notebook, and to view the signal after connecting the IN1 and OUT1 SMA connectors.

However, the problem I am trying to solve is more about a time triggering (after a delay between the emission of the signal and ADC sampling) than a synchronization. Indeed, the ultrasonic signal needs to travel through the material before being captures by the ADC for processing in the Linux.

I don't know if this solution based on the newer RP software would be practical for this kind of application. That's why I have also been trying this week to look more into Pavel Demin's ADC recorder trigger project. I tried to use my state machine custom IP to produce a triggering signal to activate the oscilloscope (rather than using an external trigger as in the original project).

My original idea was in fact to do as much of the signal generation and timing directly in the FPGA, while setting the parameters on the Linux side (and read by the state machine through AXI Lite) and processing the signals after they've been pushed to the RAM.

So far I haven't been successful and the triggering is not working properly. I'm still open to other solutions as you mentioned before, but if you have any advice regarding my approach that would also be very interesting to me.

Please let me know if you need any further information to clarify my ideas ;)

Thanks,

Rémi

izi
Posts: 34
Joined: Wed May 27, 2015 11:49 am

Re: Synced ultrasonic emission and reception (time triggered

Post by izi » Thu Apr 27, 2017 11:28 am

Sorry for the late reply, I was working o a new release:
http://downloads.redpitaya.com/download ... ta.img.zip

There are two Pzthon examples which I think would be a good fit for you.

The idea is to start oscilloscope at the same time you start the generator, thus achieving synchronization.
https://github.com/RedPitaya/jupyter/bl ... _gen.ipynb
If the sound delay through the measured material is longer then the length of the buffer,
then the 'post_trigger' time can be set to a value larger then the buffer size.
This value multiplied with the sampling period defines when acquisition will stop after the generator is started.

There is a demo application using this principle.
The example has not been cleaned yet, so it is not published in the Jupyter welcome page.
https://github.com/RedPitaya/jupyter/bl ... ngth.ipynb
But there is apparently still a bug in HW.
I am not sure what is wrong, but it appears like the synchronization between gen and osc can shift by half a clock period
which might be possible if there is something wrong with the DDR interface to the DAC. Or something entirely different.

All the mentioned code is present in the latest release.

I will be on vacation this and next week, so bug fixes will have to wait.

Regards,
Iztok Jeras

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