Extract AXI Stream Data?

dedicated to the FPGA topics for all Red Pitaya programmers
Post Reply
sslerose
Posts: 35
Joined: Sat Nov 26, 2022 12:43 am

Extract AXI Stream Data?

Post by sslerose » Mon Jul 17, 2023 7:24 pm

Hello,

What the best way is to extract data from a Verilog module using the AXI Stream interface? Using STEMlab 125-14, no extensions.

I currently have a stream of signal data (roughly 20 bits wide) that I want to extract from a custom module intended to filter a signal. This data is scaled, so I would like to be able to divide all the data by a constant factor to get it to the correct scale (I have been told that trying to descale the data in the Verilog module is not ideal, and that it should be done outside of the FPGA for performance, is this correct?).

Currently I have a system that is intended to determine the peak value of the filtered data using a GPIO and Jupyter notebook and spit it out. However, I would ideally like to view the entire filtered waveform using the Red Pitaya's oscilloscope or have the data put into a file that can be used to observe the waveform using another program.

Some clarifying questions:
  1. I have an exponentially decaying signal being passed to the DAC via AXIS. It is signed and 16 bits wide (only lower 14 bits have data, i.e., max of signal is 16383) and connected directly to the DAC. Will this signal be passed through OUT1?
  2. I have the ADC connected directly to the filter via AXIS. The filter only accepts 16 bits (signed), so I assume it takes the lower 16 from the ADC which is from IN1?
  3. Do the ADC and DAC connect without a cable on the board? When I run my program without a connection, I still receive values from my GPIO2_i port even after correcting for the values I assigned to the GPIO2_o. I have the default tri value set to 0x000FFFFF, so the lower 20 bits will be used at input (i.e, be extracted from the modules), correct?
  4. I did not start from the 0.94 project, is this ok? I started blank, added a ZYNQ7 PS, necessary ports, Pavel's xdc constrains, and my custom modules, see image here. I essentially modeled my project after the Frequency Counter project, as it had a similar use case. It should be noted that I have the resets for all my modules connected to the GPIO, this is intentional as any time I declare some variables in my Python program, my modules must reset.
Any advice is greatly appreciated, please let me know if there is any additional information needed.

pavel
Posts: 799
Joined: Sat May 23, 2015 5:22 pm

Re: Extract AXI Stream Data?

Post by pavel » Tue Jul 18, 2023 2:00 pm

If scaling by x/32767 or x/131071 is OK, then it can be easily done with the 18x25 bit multiplier (DSP48).

The connection of the exponential signal generator seems correct.

The filter connection also seems correct.

There is crosstalk between the DAC outputs and the ADC inputs. It is therefore possible to pick up a strongly attenuated signal even when the outputs are not connected to the inputs.

I have recently added a playground project and a Jupyter notebook to my Red Pitaya notes:
https://pavel-demin.github.io/red-pitay ... layground/

It has very basic oscilloscope functionality. If you add your modules to the playground project, then you can use this simple oscilloscope to visualize your signal.

Your project is starting to look like my Multichannel Pulse Height Analyzer (MCPHA) project:
https://pavel-demin.github.io/red-pitaya-notes/mcpha/

Maybe you could use the MCPHA project as a starting point and replace the filters and peak detectors with your modules.

sslerose
Posts: 35
Joined: Sat Nov 26, 2022 12:43 am

Re: Extract AXI Stream Data?

Post by sslerose » Tue Jul 18, 2023 4:07 pm

Pavel,

Thank you very much for the clarification and taking the time to list your projects, it will be very helpful!

sslerose
Posts: 35
Joined: Sat Nov 26, 2022 12:43 am

Re: Extract AXI Stream Data?

Post by sslerose » Tue Jul 18, 2023 6:40 pm

I generated a bitstream of the Playground project and sent it to my Red Pitaya, however, when I go to run

Code: Select all

io.program("playground.bit")
in VSC, I receive a "TimeoutError" on the line

Code: Select all

self.socket.sendall(command.tobytes())
Any thoughts on why this might be? Do I have to be using the Alpine SD card image?


Also, I created filtering project based on the Playground project using the AXI4-hub as my communication point. But if I try to run

Code: Select all

io.program("trap_v3.bit")
in VSC is says that there is not such file or directory. So how could I utilize the pyhubio package using my own program?

Also, I am not seeing an oscilloscope core/module in the Playground project. Are you referring to reading from the FIFO? If not please correct me.

For reference I have VSC running on Windows 10 and into WSL with their extension. Thank you in advance.

pavel
Posts: 799
Joined: Sat May 23, 2015 5:22 pm

Re: Extract AXI Stream Data?

Post by pavel » Wed Jul 19, 2023 10:21 am

Thank you for trying the playground project.

I think the timeout error is because the corresponding application is not running on the Red Pitaya board. You need to start it through the web interface by clicking on the Playground link or to start the playground application automatically, copy its start.sh file from apps/playground to the topmost directory on the SD card.

Also make sure that the correct IP address is used in the first block of code in the Jupyter notebook.

The pyhubio package can be installed using pip.

For io.program("trap_v3.bit") to work, the trap_v3.bit file should be in the same directory as the Python code or Jupyter notebook.

The functionality of the oscilloscope is indeed the FIFO buffer that captures a sequence of ADC samples. This might be enough for simple tests. However, the trigger logic is missing in this playground project. The MCPHA project contains an oscilloscope with a longer buffer and with trigger logic.

sslerose
Posts: 35
Joined: Sat Nov 26, 2022 12:43 am

Re: Extract AXI Stream Data?

Post by sslerose » Wed Jul 19, 2023 7:49 pm

I installed the SD card zip file onto an empty card formatted as FAT32 and was able to get the led_blinker project working on startup by having the start.sh file in the top directory, so the image seems to work.
quote=pavel wrote:
Wed Jul 19, 2023 10:21 am
You need to start it through the web interface...
I am not sure how to connect through the web interface. Using the standard Red Pitaya SD format I am able to connect via rp-f0xxxx.local, however, when I switch to your Alpine build the webpage cannot be reached.
quote=pavel wrote:
Wed Jul 19, 2023 10:21 am
Also make sure that the correct IP address is used in the first block of code in the Jupyter notebook.
Given I cannot connect to the web interface, I am not sure what the IP of the Alpine build is. I have mine connected to a USB hub with an Ethernet port, I tried using the IP from the standard build and the one given to me by Windows command prompt but neither worked. I have access to an internet switch if you believe it may be of use.

I am actually able to run the 01-led-blinker python notebook without errors if I move the necessary apps folders to the root directory of the standard build, however, the led does not blink unless I source the start.sh file (with the initial directories changed via nano) via an Ubuntu console. Granted, this is really no different then running a cat command. I tried the same with the playground project but:
  • The "common_tools" folder does not contain a setup file, and
  • Ubuntu stated the "playground" file did not exist, even though I verified its existence.
I tried simply running the cat command for the bit file, but the Python program timed out again.

If you have any pointers, please let me know, I would love to work with your playground program.

PS: Would it generally be possible to use the AXI4 Hub and pyhubio package outside of your Alpine build? If I was able to run my own program on the standard Red Pitaya SD card utilizing these tools then that would be all I need. Thank you again.

pavel
Posts: 799
Joined: Sat May 23, 2015 5:22 pm

Re: Extract AXI Stream Data?

Post by pavel » Thu Jul 20, 2023 10:28 am

The playground project can be used outside of the Alpine build. You will need to copy playground directory, recompile playground.c using make and update paths in start.sh.

Since your Red Pitaya board is directly connected to the USB Ethernet adapter, this USB Ethernet adapter should be configured to have an IP address in the same 192.168.1.x subnet as the Red Pitaya board. For example, 192.168.1.111. Instructions on how to set a static IP address in Windows can be found at the following link:
https://kb.netgear.com/27476/How-do-I-s ... in-Windows

The IP address of the Red Pitaya board in this configuration is 192.168.1.100.

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